-
Notifications
You must be signed in to change notification settings - Fork 299
/
phpstan.neon
129 lines (99 loc) · 5.85 KB
/
phpstan.neon
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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<Knp\\DoctrineBehaviors\\Contract\\Entity\\TreeNodeInterface\>\|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