Skip to content

Commit 718e347

Browse files
committed
GNSR cleanup
2 parents a09ac35 + 69ed3ac commit 718e347

File tree

133 files changed

+2676
-20353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+2676
-20353
lines changed

build/PHPStan/Build/GeneratorYieldSendTypeExtension.php

Lines changed: 0 additions & 90 deletions
This file was deleted.

build/PHPStan/Build/ScopeGetTypeInGeneratorNamespaceRule.php

Lines changed: 0 additions & 92 deletions
This file was deleted.

build/phpstan.neon

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ parameters:
118118
count: 1
119119
path: ../src/Diagnose/PHPStanDiagnoseExtension.php
120120
- '#^Short ternary operator is not allowed#'
121-
-
122-
identifier: shipmonk.deadMethod
123-
path: ../src/Analyser/Generator
124121
reportStaticMethodSignatures: true
125122
tmpDir: %rootDir%/tmp
126123
stubFiles:
@@ -141,7 +138,6 @@ rules:
141138
- PHPStan\Build\SkipTestsWithRequiresPhpAttributeRule
142139
- PHPStan\Build\MemoizationPropertyRule
143140
- PHPStan\Build\OrChainIdenticalComparisonToInArrayRule
144-
- PHPStan\Build\ScopeGetTypeInGeneratorNamespaceRule
145141

146142
services:
147143
-
@@ -152,7 +148,3 @@ services:
152148
class: PHPStan\Build\ContainerDynamicReturnTypeExtension
153149
tags:
154150
- phpstan.broker.dynamicMethodReturnTypeExtension
155-
-
156-
class: PHPStan\Build\GeneratorYieldSendTypeExtension
157-
tags:
158-
- phpstan.broker.expressionTypeResolverExtension

conf/config.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ extensions:
237237
validateExcludePaths: PHPStan\DependencyInjection\ValidateExcludePathsExtension
238238
autowiredAttributeServices: PHPStan\DependencyInjection\AutowiredAttributeServicesExtension
239239
validateServiceTags: PHPStan\DependencyInjection\ValidateServiceTagsExtension
240-
gnsr: PHPStan\DependencyInjection\GnsrExtension
241240
fnsr: PHPStan\DependencyInjection\FnsrExtension
242241

243242
autowiredAttributeServices:

phpstan-baseline.neon

Lines changed: 18 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -12,84 +12,12 @@ parameters:
1212
count: 1
1313
path: src/Analyser/AnalyserResultFinalizer.php
1414

15-
-
16-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.'
17-
identifier: phpstanApi.instanceofType
18-
count: 1
19-
path: src/Analyser/Generator/ExprHandler/AssignHandler.php
20-
21-
-
22-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantBooleanType is error-prone and deprecated. Use Type::isTrue() or Type::isFalse() instead.'
23-
identifier: phpstanApi.instanceofType
24-
count: 2
25-
path: src/Analyser/Generator/ExprHandler/BooleanNotHandler.php
26-
27-
-
28-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantBooleanType is error-prone and deprecated. Use Type::isTrue() or Type::isFalse() instead.'
29-
identifier: phpstanApi.instanceofType
30-
count: 2
31-
path: src/Analyser/Generator/ExprHandler/EqualHandler.php
32-
33-
-
34-
rawMessage: 'Method PHPStan\Analyser\Generator\ExprHandler\EqualHandler::resolveEqualSpecifiedTypes() should return array{PHPStan\Analyser\SpecifiedTypes, PHPStan\Analyser\SpecifiedTypes} but returns PHPStan\Analyser\SpecifiedTypes.'
35-
identifier: return.type
36-
count: 1
37-
path: src/Analyser/Generator/ExprHandler/EqualHandler.php
38-
39-
-
40-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.'
41-
identifier: phpstanApi.instanceofType
42-
count: 1
43-
path: src/Analyser/Generator/ExprHandler/IdenticalHandler.php
44-
45-
-
46-
rawMessage: Casting to string something that's already string.
47-
identifier: cast.useless
48-
count: 4
49-
path: src/Analyser/Generator/GeneratorScope.php
50-
51-
-
52-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantBooleanType is error-prone and deprecated. Use Type::isTrue() or Type::isFalse() instead.'
53-
identifier: phpstanApi.instanceofType
54-
count: 1
55-
path: src/Analyser/Generator/GeneratorScope.php
56-
57-
-
58-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.'
59-
identifier: phpstanApi.instanceofType
60-
count: 3
61-
path: src/Analyser/Generator/GeneratorScope.php
62-
63-
-
64-
rawMessage: 'Doing instanceof PHPStan\Type\ConstantScalarType is error-prone and deprecated. Use Type::isConstantScalarValue() or Type::getConstantScalarTypes() or Type::getConstantScalarValues() instead.'
65-
identifier: phpstanApi.instanceofType
66-
count: 2
67-
path: src/Analyser/Generator/SpecifiedTypesHelper.php
68-
6915
-
7016
rawMessage: Cannot assign offset 'realCount' to array<mixed>|string.
7117
identifier: offsetAssign.dimType
7218
count: 1
7319
path: src/Analyser/Ignore/IgnoredErrorHelperResult.php
7420

75-
-
76-
rawMessage: 'Doing instanceof PHPStan\Type\ConstantScalarType is error-prone and deprecated. Use Type::isConstantScalarValue() or Type::getConstantScalarTypes() or Type::getConstantScalarValues() instead.'
77-
identifier: phpstanApi.instanceofType
78-
count: 2
79-
path: src/Analyser/LegacyTypeSpecifier.php
80-
81-
-
82-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantBooleanType is error-prone and deprecated. Use Type::isTrue() or Type::isFalse() instead.'
83-
identifier: phpstanApi.instanceofType
84-
count: 5
85-
path: src/Analyser/LegacyTypeSpecifier.php
86-
87-
-
88-
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.'
89-
identifier: phpstanApi.instanceofType
90-
count: 4
91-
path: src/Analyser/LegacyTypeSpecifier.php
92-
9321
-
9422
rawMessage: Casting to string something that's already string.
9523
identifier: cast.useless
@@ -144,6 +72,24 @@ parameters:
14472
count: 1
14573
path: src/Analyser/RuleErrorTransformer.php
14674

75+
-
76+
rawMessage: 'Doing instanceof PHPStan\Type\ConstantScalarType is error-prone and deprecated. Use Type::isConstantScalarValue() or Type::getConstantScalarTypes() or Type::getConstantScalarValues() instead.'
77+
identifier: phpstanApi.instanceofType
78+
count: 2
79+
path: src/Analyser/TypeSpecifier.php
80+
81+
-
82+
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantBooleanType is error-prone and deprecated. Use Type::isTrue() or Type::isFalse() instead.'
83+
identifier: phpstanApi.instanceofType
84+
count: 5
85+
path: src/Analyser/TypeSpecifier.php
86+
87+
-
88+
rawMessage: 'Doing instanceof PHPStan\Type\Constant\ConstantStringType is error-prone and deprecated. Use Type::getConstantStrings() instead.'
89+
identifier: phpstanApi.instanceofType
90+
count: 4
91+
path: src/Analyser/TypeSpecifier.php
92+
14793
-
14894
rawMessage: 'Template type TNodeType is declared as covariant, but occurs in contravariant position in parameter node of method PHPStan\Collectors\Collector::processNode().'
14995
identifier: generics.variance

src/Analyser/Analyser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace PHPStan\Analyser;
44

55
use Closure;
6-
use PHPStan\Analyser\Generator\GeneratorNodeScopeResolver;
76
use PHPStan\Collectors\CollectedData;
87
use PHPStan\Collectors\Registry as CollectorRegistry;
98
use PHPStan\DependencyInjection\AutowiredParameter;
@@ -27,7 +26,7 @@ public function __construct(
2726
private RuleRegistry $ruleRegistry,
2827
private CollectorRegistry $collectorRegistry,
2928
#[AutowiredParameter(ref: '@' . NodeScopeResolver::class)]
30-
private GeneratorNodeScopeResolver|NodeScopeResolver $nodeScopeResolver,
29+
private NodeScopeResolver $nodeScopeResolver,
3130
#[AutowiredParameter]
3231
private int $internalErrorsCountLimit,
3332
)

src/Analyser/FileAnalyser.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
use PhpParser\Node;
66
use PHPStan\AnalysedCodeException;
7-
use PHPStan\Analyser\Generator\GeneratorNodeScopeResolver;
8-
use PHPStan\Analyser\Generator\GeneratorScopeFactory;
97
use PHPStan\BetterReflection\NodeCompiler\Exception\UnableToCompileNode;
108
use PHPStan\BetterReflection\Reflection\Exception\CircularReference;
119
use PHPStan\BetterReflection\Reflector\Exception\IdentifierNotFound;
@@ -61,9 +59,8 @@ final class FileAnalyser
6159

6260
public function __construct(
6361
private ScopeFactory $scopeFactory,
64-
private GeneratorScopeFactory $generatorScopeFactory,
6562
#[AutowiredParameter(ref: '@' . NodeScopeResolver::class)]
66-
private GeneratorNodeScopeResolver|NodeScopeResolver $nodeScopeResolver,
63+
private NodeScopeResolver $nodeScopeResolver,
6764
#[AutowiredParameter(ref: '@defaultAnalysisParser')]
6865
private Parser $parser,
6966
private DependencyResolver $dependencyResolver,
@@ -257,11 +254,7 @@ public function analyseFile(
257254
$nodeCallback($node, $scope, $callbackInvocationNumber);
258255
};
259256

260-
if ($this->nodeScopeResolver instanceof NodeScopeResolver) {
261-
$scope = $this->scopeFactory->create(ScopeContext::create($file), $realNodeCallback);
262-
} else {
263-
$scope = $this->generatorScopeFactory->create(ScopeContext::create($file));
264-
}
257+
$scope = $this->scopeFactory->create(ScopeContext::create($file), $realNodeCallback);
265258
$realNodeCallback(new FileNode($parserNodes), $scope);
266259
$this->nodeScopeResolver->processNodes(
267260
$parserNodes,

0 commit comments

Comments
 (0)