-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathphpstan.neon
More file actions
165 lines (142 loc) · 11.1 KB
/
Copy pathphpstan.neon
File metadata and controls
165 lines (142 loc) · 11.1 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
includes:
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-strict-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-deprecation-rules/rules.neon
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-phpunit/extension.neon
- %currentWorkingDirectory%/.build/vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
# You can currently choose from 11 levels (0 is the loosest and 10 is the strictest).
level: max
tmpDir: %currentWorkingDirectory%/.build/cache/.phpstan.cache
paths:
- %currentWorkingDirectory%/src/
- %currentWorkingDirectory%/tests/
- %currentWorkingDirectory%/.github/scripts/
excludePaths:
- %currentWorkingDirectory%/.build/
ignoreErrors:
# The missing type IS the fixture's purpose: it pins the type resolver's fallback for
# properties without any type metadata. Adding a type would delete the test case.
-
identifier: missingType.property
message: '#^Property MagicSunday\\Test\\Classes\\UntypedPropertyHolder\:\:\$anything has no type specified\.$#'
path: %currentWorkingDirectory%/tests/Classes/UntypedPropertyHolder.php
# The missing value type IS the fixture's purpose: a docblock would make the docblock
# extractor win, and the bare native iterable type is exactly the case under test.
-
identifier: missingType.iterableValue
message: '#^Property MagicSunday\\Test\\Classes\\IterablePropertyHolder\:\:\$items type has no value type specified in iterable type iterable\.$#'
path: %currentWorkingDirectory%/tests/Classes/IterablePropertyHolder.php
# The missing value type IS the fixture's purpose: naming an element type turns the
# property into a CollectionType, which a different strategy resolves - the builtin
# object-to-array cast under test would then never be reached and its test would pass
# vacuously.
-
identifier: missingType.iterableValue
message: '#^Property MagicSunday\\Test\\Classes\\BuiltinCoercionHolder\:\:\$bag type has no value type specified in iterable type array\.$#'
path: %currentWorkingDirectory%/tests/Classes/BuiltinCoercionHolder.php
# The missing generic types ARE the fixture's purpose: it pins that a container which
# never declares what it holds is refused with actionable guidance instead of handing the
# raw payload to the property accessor. Specifying them would delete the test case.
-
identifier: missingType.generics
message: '#^Class MagicSunday\\Test\\Fixtures\\Docs\\NestedCollections\\UnannotatedCollection extends generic class ArrayObject but does not specify its types\: TKey, TValue$#'
path: %currentWorkingDirectory%/tests/Fixtures/Docs/NestedCollections/UnannotatedCollection.php
# The unresolvable element type IS the fixture's purpose: it pins that a collection whose
# annotation names a template parameter is refused with actionable guidance. Specifying
# the type would delete the test case.
-
identifier: missingType.generics
message: '#^Property MagicSunday\\Test\\Fixtures\\Docs\\NestedCollections\\CollectionShapesHolder\:\:\$templated with generic class MagicSunday\\Test\\Fixtures\\Docs\\NestedCollections\\TemplatedCollection does not specify its types\: T$#'
path: %currentWorkingDirectory%/tests/Fixtures/Docs/NestedCollections/CollectionShapesHolder.php
# The deprecated call IS the test's purpose: addType() is marked deprecated but remains
# public and documented as the escape hatch that outranks the built-in strategies, so the
# legacy path needs a pin. Migrating the call would delete the test case.
# Anchored at the start only: the message continues onto a second line with the
# replacement the annotation names.
-
identifier: method.deprecated
message: '#^Call to deprecated method addType\(\) of class MagicSunday\\JsonMapper\:#'
path: %currentWorkingDirectory%/tests/JsonMapper/Value/ClosureTypeHandlerTest.php
# The empty class name IS the test's purpose: it pins that a collection type naming no
# wrapper class is refused rather than passed to the resolver, which would report it as a
# class that does not exist. A class-string here would delete the test case. End-anchored on
# the GIVEN type - the empty-class-name ObjectType<mixed> shape - so it cannot also swallow a
# future genuinely-wrong $type passed to the same method in this file.
-
identifier: argument.type
message: '#^Parameter \#1 \$type of method MagicSunday\\JsonMapper\\Collection\\CollectionFactory\:\:fromCollectionType\(\) expects .+, Symfony\\Component\\TypeInfo\\Type\\CollectionType<Symfony\\Component\\TypeInfo\\Type\\GenericType<Symfony\\Component\\TypeInfo\\Type\\ObjectType<mixed>>> given\.$#'
path: %currentWorkingDirectory%/tests/JsonMapper/Collection/CollectionFactoryTest.php
# The empty name IS the test's purpose: it is what a lookup that found nothing produces -
# an unset environment variable, a missing config key - which is exactly the input the
# guard under test exists for. A class-string here would delete the test case.
-
identifier: argument.type
message: '#^Parameter \#1 \$className of method MagicSunday\\JsonMapper\\Resolver\\ClassResolver\:\:add\(\) expects class\-string, string given\.$#'
path: %currentWorkingDirectory%/tests/JsonMapper/Resolver/ClassResolverTest.php
# The contract violation IS the test's purpose: a closure's declared return type is
# documentation to PHP, not a runtime check, so a consumer whose resolver returns the wrong
# thing reaches the guard under test through the same public add(). Satisfying the analyser
# here would delete the test case.
-
identifier: argument.type
message: '#^Parameter \#2 \$resolver of method MagicSunday\\JsonMapper\\Resolver\\ClassResolver\:\:add\(\) expects class\-string\|\(Closure\(mixed\)\: class\-string\)\|\(Closure\(mixed, MagicSunday\\JsonMapper\\Context\\MappingContext\)\: class\-string\), Closure\(\)\: 123 given\.$#'
path: %currentWorkingDirectory%/tests/JsonMapper/Resolver/ClassResolverTest.php
# The contradicting docblock IS the fixture's purpose: it pins that a docblock which WIDENS
# its own native type cannot grant a value the property rejects. PHPStan flagging it is the
# point - the issue notes that static analysis catches this class of mistake, which is why
# the mapper only has to refuse to act on it. Making the docblock agree deletes the test case.
-
identifier: property.phpDocType
message: '#^PHPDoc tag @var for property MagicSunday\\Test\\Fixtures\\TypePrecedence\\WideningPropertyHolder\:\:\$value with type int\|null is not subtype of native type int\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/WideningPropertyHolder.php
-
identifier: property.phpDocType
message: '#^PHPDoc type for property MagicSunday\\Test\\Fixtures\\TypePrecedence\\WideningConstructorHolder\:\:\$value with type int\|null is not subtype of native type int\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/WideningConstructorHolder.php
-
identifier: parameter.phpDocType
message: '#^PHPDoc tag @param for parameter \$value with type int\|null is not subtype of native type int\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/WideningConstructorHolder.php
-
identifier: parameter.phpDocType
message: '#^PHPDoc tag @param for parameter \$value with type int\|string is not subtype of native type int\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/ScalarWideningConstructorHolder.php
-
identifier: property.phpDocType
message: '#^PHPDoc type for property MagicSunday\\Test\\Fixtures\\TypePrecedence\\ScalarWideningConstructorHolder\:\:\$value with type int\|string is not subtype of native type int\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/ScalarWideningConstructorHolder.php
# The missing type IS the fixture's purpose: a property with no type metadata at all is what
# lets a value reach a natively typed constructor parameter unchecked. Typing it would delete
# the test case.
-
identifier: missingType.property
message: '#^Property MagicSunday\\Test\\Fixtures\\TypePrecedence\\UntypedConstructorHolder\:\:\$count has no type specified\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/UntypedConstructorHolder.php
# The missing type IS the fixture's purpose: an untyped property keeps the resolver
# permissive so a raw array reaches the `self`-typed constructor parameter. Typing it would
# delete the test case.
-
identifier: missingType.property
message: '#^Property MagicSunday\\Test\\Fixtures\\TypePrecedence\\SelfTypedConstructorHolder\:\:\$child has no type specified\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/SelfTypedConstructorHolder.php
# The missing type IS the fixture's purpose: an untyped property keeps the resolver
# permissive so a raw array reaches the `parent`-typed constructor parameter. Typing it
# would delete the test case.
-
identifier: missingType.property
message: '#^Property MagicSunday\\Test\\Fixtures\\TypePrecedence\\ParentTypedConstructorHolder\:\:\$origin has no type specified\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/ParentTypedConstructorHolder.php
# The unreachable null IS the fixture's purpose: the getter's declared nullability is what
# makes the mapper resolve the property as nullable and hand the null to the setter, while
# the non-nullable field it wraps is the other half of the case. Narrowing the return type
# collapses both and deletes the test case.
-
identifier: return.unusedType
message: '#^Method MagicSunday\\Test\\Fixtures\\TypePrecedence\\AccessorWideningHolder\:\:getValue\(\) never returns null so it can be removed from the return type\.$#'
path: %currentWorkingDirectory%/tests/Fixtures/TypePrecedence/AccessorWideningHolder.php
# The unused parameter IS the fixture's purpose: it pins that a non-promoted constructor
# parameter sharing a property name must not supply that property's default.
-
identifier: constructor.unusedParameter
message: '#^Constructor of class MagicSunday\\Test\\Classes\\SameNamedConstructorParameterHolder has an unused parameter \$count\.$#'
path: %currentWorkingDirectory%/tests/Classes/SameNamedConstructorParameterHolder.php