includes: - phpstan-extension.neon - vendor/symplify/phpstan-rules/config/static-rules.neon - vendor/symplify/phpstan-rules/config/array-rules.neon - vendor/symplify/phpstan-rules/config/doctrine-rules.neon - vendor/symplify/phpstan-rules/config/regex-rules.neon - vendor/symplify/phpstan-rules/config/forbidden-static-rules.neon - vendor/symplify/phpstan-rules/config/test-rules.neon parameters: paths: - src - tests - utils/phpstan-behaviors/src level: 8 checkGenericClassInNonGenericObjectType: false # to allow installing with various phsptan versions without reporting old errors here reportUnmatchedIgnoredErrors: false ignoreErrors: # traits - '#Call to an undefined method Knp\\DoctrineBehaviors\\Contract\\Provider\\UserProviderInterface::changeUser\(\)#' - '#Call to an undefined method Knp\\DoctrineBehaviors\\Contract\\Entity\\TreeNodeInterface::getId\(\)#' - '#Call to an undefined method Knp\\DoctrineBehaviors\\Contract\\Entity\\TreeNodeInterface::to(Flat)?Array\(\)#' # buggy - '#of function call_user_func_array expects callable#' # mixed - '#return type has no value type specified#' - '#has parameter (.*?) with no (typehint|value type) specified#' - '#Unable to resolve the template type T#' # cache buggy - '#Access to an undefined property Knp\\DoctrineBehaviors\\Tests\\Fixtures\\Entity\\TreeNodeEntity\:\:\$parentNodePath#' - '#Property with protected modifier is not allowed\. Use interface contract method instead#' # tests - '#Offset 0 does not exist on array\|ArrayAccess\|null#' - '#Cannot call method addChildNode\(\) on Knp\\DoctrineBehaviors\\Contract\\Entity\\TreeNodeInterface\|null#' - '#Do not use "\$entityManager->getRepository\(\)" outside of the constructor of repository service#' # resolve in follow up PR - '#Use explicit return value over magic &reference#' # magic - message: '#Array with keys is not allowed\. Use value object to pass data instead#' paths: # node tree in array - 'src/Model/Tree/TreeNodeMethodsTrait.php' # annotation mapping - src/EventSubscriber/TranslatableEventSubscriber.php - message: '#Do not use @method tag in class docblock#' paths: - tests/Fixtures/Entity/TranslatableEntity.php - message: '#Use explicit methods over array access on object#' paths: - tests/ORM/TreeNodeTest.php - '#Method call on new expression is not allowed#' - '#Do not use factory/method call in constructor\. Put factory in config and get service with dependency injection#' - '#Property Knp\\DoctrineBehaviors\\Tests\\ORM\\Blameable\\BlameableWithEntityTest\:\:\$userEntity \(Knp\\DoctrineBehaviors\\Tests\\Fixtures\\Entity\\UserEntity\) does not accept object\|string\|null#' - '#\$this as argument is not allowed\. Refactor method to service composition#' - '#Use separate function calls with readable variable names#' - message: '#Do not compare call directly, use a variable assign#' path: src/Model/*/*MethodsTrait.php # known retype - '#Cannot cast array\|bool\|float\|int\|string\|UnitEnum\|null to string#' - message: '#Use required typed property over of nullable property#' path: tests/Provider/TestUserProvider.php - '#"Doctrine\\ORM\\EntityManagerInterface" dependency is allowed only in "\*Repository", "Doctrine\\Bundle\\DoctrineBundle\\EventSubscriber\\EventSubscriberInterface" types#' # @todo fix in symplify, common use case for entities - message: '#Use required typed property over of nullable property#' path: '*/Entity/*' - message: '#Attribute key "repositoryClass" cannot be used#' path: tests/Fixtures/Entity/TreeNodeEntity.php - message: '#Class has a static method must so must contains "Static" in its name#' paths: - tests/Fixtures/Entity/TranslatableCustomizedEntity.php - tests/Fixtures/Entity/Translation/TranslatableCustomizedEntityTranslation.php - message: '#There should be no empty class#' path: tests/Fixtures/Entity/Translatable/ExtendedTranslatableEntityWithJoinTableInheritanceTranslation.php # false positive, already checked for type - message: '#Cannot call method getName\(\) on ReflectionClass\|null#' path: src/EventSubscriber/TranslatableEventSubscriber.php # entities - message: '#Property Knp\\DoctrineBehaviors\\Tests\\Fixtures\\Entity\\(.*?)\:\:\$(.*?) is never written, only read#' path: tests/Fixtures/Entity/* # not generics - '#Parameter \#1 \$type of method Knp\\DoctrineBehaviors\\Tests\\AbstractBehaviorTestCase\:\:getService\(\) expects class\-string(.*?), string given#' - '#Property Knp\\DoctrineBehaviors\\Tests\\AbstractBehaviorTestCase\:\:\$entityManager \(Doctrine\\ORM\\EntityManagerInterface\) does not accept doctrine\.orm\.entity_manager#' # specific implementation - '#Property Knp\\DoctrineBehaviors\\Tests\\ORM\\Blameable\\BlameableTest\:\:\$userProvider \(Knp\\DoctrineBehaviors\\Tests\\Provider\\EntityUserProvider\) does not accept Knp\\DoctrineBehaviors\\Contract\\Provider\\UserProviderInterface#' # different entity can return differnt types - reusable trait - message: '#sprintf\(\) call mask types does not match provided arguments types#' path: src/Model/Loggable/LoggableTrait.php