PHP Rule php:S1448 not ignoring @Entity classes

Hello everyone!

I have some questions regarding rule exceptions. In the example below, we are using the @Entity annotation, but the rule is still being applied. Is there any additional step required for this exception to work correctly?

Example:

<?php
namespace X\Y\Z;
/**
 * Description of MyClass
 *
 * @author ABC DEF <abc@def.com.br>
 * @Entity(repositoryClass="X\Y\Z\MyClassRepository")
 * @Table(name="my_class")
 * @Requisito RF000
 * @HasLifecycleCallbacks
 */
class MyClass implements IMyInterface {...}

My apologies, I’ve had to redact some information to avoid privacy or security concerns.

  • Which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension):

    • SonarQube ID information
      Version: 26.2.0.119303
      Date: 2026-03-26
  • how is SonarQube deployed: zip, Docker, Helm:

    • Docker
  • what are you trying to achieve:

    • We are looking to have the PHP rule S1448 (“Classes should not have too many methods”) ignore classes that are marked with the @Entity annotation.
  • what have you tried so far to achieve this:

    • We verified that the @Entity annotation is correctly placed in the docblock of the PHP class.

I appreciate your support so far!

Excuses for the delayed response @cesarfreire . It is indeed a false-positive. The rule’s exception was only looking into attributes and not PHPDoc comments.

It will be fixed with the next release.

Thanks for reporting!

No problem! Thanks for getting back to me.