Skip to content

Commit 9ab1b97

Browse files
committed
Improve handling of circular type reference errors in Phpstan
1 parent b0f2ba5 commit 9ab1b97

File tree

2 files changed

+6
-45
lines changed

2 files changed

+6
-45
lines changed

phpstan-baseline.neon

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
parameters:
22
ignoreErrors:
3-
-
4-
message: "#^Circular definition detected in type alias PipelineExpression\\.$#"
5-
count: 1
6-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
7-
83
-
94
message: "#^PHPDoc tag @param references unknown parameter\\: \\$applyFilters$#"
105
count: 1
@@ -50,26 +45,11 @@ parameters:
5045
count: 1
5146
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Bucket/AbstractOutput.php
5247

53-
-
54-
message: "#^Circular definition detected in type alias FacetStageExpression\\.$#"
55-
count: 1
56-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Facet.php
57-
58-
-
59-
message: "#^Return type \\(static\\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\GeoNear\\)\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\GeoNear\\:\\:limit\\(\\) should be compatible with return type \\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Limit\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\:\\:limit\\(\\)$#"
60-
count: 1
61-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GeoNear.php
62-
6348
-
6449
message: "#^Unable to resolve the template type T in call to method Doctrine\\\\ODM\\\\MongoDB\\\\DocumentManager\\:\\:getClassMetadata\\(\\)$#"
6550
count: 1
6651
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
6752

68-
-
69-
message: "#^Circular definition detected in type alias PipelineParamType\\.$#"
70-
count: 1
71-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php
72-
7353
-
7454
message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Lookup\\:\\:getExpression\\(\\) return type has no value type specified in iterable type array\\.$#"
7555
count: 1
@@ -85,21 +65,6 @@ parameters:
8565
count: 1
8666
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php
8767

88-
-
89-
message: "#^Circular definition detected in type alias MergeStageExpression\\.$#"
90-
count: 1
91-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Merge.php
92-
93-
-
94-
message: "#^Circular definition detected in type alias WhenMatchedParamType\\.$#"
95-
count: 1
96-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Merge.php
97-
98-
-
99-
message: "#^Circular definition detected in type alias WhenMatchedType\\.$#"
100-
count: 1
101-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Merge.php
102-
10368
-
10469
message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Merge\\:\\:whenMatched\\(\\) has parameter \\$whenMatched with no value type specified in iterable type array\\.$#"
10570
count: 1
@@ -130,16 +95,6 @@ parameters:
13095
count: 1
13196
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search.php
13297

133-
-
134-
message: "#^Return type \\(static\\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Search\\)\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Search\\:\\:sort\\(\\) should be compatible with return type \\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Sort\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\:\\:sort\\(\\)$#"
135-
count: 1
136-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search.php
137-
138-
-
139-
message: "#^Return type \\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Search\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Search\\\\AbstractSearchOperator\\:\\:sort\\(\\) should be compatible with return type \\(Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Sort\\) of method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\:\\:sort\\(\\)$#"
140-
count: 1
141-
path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/AbstractSearchOperator.php
142-
14398
-
14499
message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\Aggregation\\\\Stage\\\\Search\\\\Compound\\:\\:geoShape\\(\\) has parameter \\$geometry with no value type specified in iterable type array\\.$#"
145100
count: 1

phpstan.neon.dist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,16 @@ parameters:
1717
ignoreErrors:
1818
# Ignore typing providers in tests
1919
- '#^Method Doctrine\\ODM\\MongoDB\\Tests\\[^:]+(Test)::(get\w+|data\w+|provide\w+)\(\) return type has no value type specified in iterable type (array|iterable)\.#'
20+
21+
# Ignore circular references in Psalm types
22+
- message: '#^Circular definition detected in type alias#'
23+
path: lib/Doctrine/ODM/MongoDB/Aggregation/
24+
2025
# To be removed when reaching phpstan level 6
2126
checkMissingVarTagTypehint: true
2227
checkMissingTypehints: true
2328
checkMissingIterableValueType: true
29+
2430
# Disabled due to inconsistent errors upon encountering psalm types
2531
reportUnmatchedIgnoredErrors: false
2632

0 commit comments

Comments
 (0)