Skip to content

Commit 9cf5d1a

Browse files
[Backport #1928 to 5.x] Improve phpstan config (#1929)
1 parent 3630985 commit 9cf5d1a

3 files changed

Lines changed: 14 additions & 39 deletions

File tree

docs/examples/specs/using-links/attributes/User.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class User
2525
#[MyAttribute]
2626
public $uuid;
2727

28+
/** @phpstan-ignore attribute.notFound */
2829
#[ArrayShape(['ping' => 'pong'])]
2930
public array $arrayShape;
3031
}

phpstan-baseline.neon

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: '#^Property OpenApi\\Annotations\\AbstractAnnotation\:\:\$x \(array\<string, mixed\>\) does not accept string\.$#'
5-
identifier: assign.propertyType
6-
count: 1
7-
path: docs/examples/processors/schema-query-parameter/SchemaQueryParameter.php
8-
9-
-
10-
message: '#^Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist\.$#'
11-
identifier: attribute.notFound
12-
count: 1
13-
path: docs/examples/specs/using-links/attributes/User.php
14-
153
-
164
message: '#^Call to function method_exists\(\) with ReflectionProperty and ''isPromoted'' will always evaluate to true\.$#'
175
identifier: function.alreadyNarrowedType
@@ -60,12 +48,6 @@ parameters:
6048
count: 1
6149
path: src/Processors/AugmentProperties.php
6250

63-
-
64-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$properties \(array\<OpenApi\\Annotations\\Property\>\) does not accept string\.$#'
65-
identifier: assign.propertyType
66-
count: 1
67-
path: src/Processors/AugmentSchemas.php
68-
6951
-
7052
message: '#^Parameter \#1 \$annotation of method OpenApi\\Processors\\DocBlockDescriptions\:\:description\(\) expects OpenApi\\Annotations\\Operation\|OpenApi\\Annotations\\Parameter\|OpenApi\\Annotations\\Schema, OpenApi\\Annotations\\AbstractAnnotation given\.$#'
7153
identifier: argument.type
@@ -84,24 +66,6 @@ parameters:
8466
count: 1
8567
path: src/Processors/DocBlockDescriptions.php
8668

87-
-
88-
message: '#^Property OpenApi\\Annotations\\JsonContent\:\:\$encoding \(array\<OpenApi\\Annotations\\Encoding\>\) does not accept string\.$#'
89-
identifier: assign.propertyType
90-
count: 1
91-
path: src/Processors/MergeJsonContent.php
92-
93-
-
94-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$examples \(array\<OpenApi\\Annotations\\Examples\>\) does not accept string\.$#'
95-
identifier: assign.propertyType
96-
count: 1
97-
path: src/Processors/MergeJsonContent.php
98-
99-
-
100-
message: '#^Property OpenApi\\Annotations\\Schema\:\:\$examples \(array\<OpenApi\\Annotations\\Examples\>\) does not accept string\.$#'
101-
identifier: assign.propertyType
102-
count: 1
103-
path: src/Processors/MergeXmlContent.php
104-
10569
-
10670
message: '#^Call to function method_exists\(\) with ReflectionProperty and ''isPromoted'' will always evaluate to true\.$#'
10771
identifier: function.alreadyNarrowedType

phpstan.neon

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ parameters:
1414
- 'tests/Fixtures/*'
1515
treatPhpDocTypesAsCertain: false
1616
ignoreErrors:
17-
- '#does not accept default value of type #'
18-
## Examples
19-
- '#^Property [a-zA-Z0-9\\]+::\$[a-zA-Z]+ is unused.$#'
17+
-
18+
# ignore Generator::UNDEFINED default value
19+
message: '#OpenApi\\Annotations#'
20+
identifier: property.defaultValue
21+
-
22+
# ignore unused example fixtures
23+
message: '#OpenApi\\Examples#'
24+
identifier: property.unused
25+
-
26+
# ignore assigning Generator::UNDEFINED as property value
27+
message: '#Property OpenApi\\Annotations.*::\$.* does not accept string.#'
28+
identifier: assign.propertyType
29+

0 commit comments

Comments
 (0)