Skip to content

Commit 68640a8

Browse files
committed
Revert "Bump to PHPStan 2.1.34 and fix compatible code (#7844)"
This reverts commit 01406fb.
1 parent 7e2b9ef commit 68640a8

File tree

7 files changed

+11
-42
lines changed

7 files changed

+11
-42
lines changed

build/target-repository/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
],
1010
"require": {
1111
"php": "^7.4|^8.0",
12-
"phpstan/phpstan": "^2.1.34"
12+
"phpstan/phpstan": "^2.1.33"
1313
},
1414
"autoload": {
1515
"files": [

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nikic/php-parser": "^5.7",
2424
"ondram/ci-detector": "^4.2",
2525
"phpstan/phpdoc-parser": "^2.3",
26-
"phpstan/phpstan": "^2.1.34",
26+
"phpstan/phpstan": "^2.1.33",
2727
"react/event-loop": "^1.6",
2828
"react/promise": "^3.3",
2929
"react/socket": "^1.17",

phpstan.neon

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -438,29 +438,3 @@ parameters:
438438
-
439439
identifier: symplify.noMissnamedDocTag
440440
path: rules/TypeDeclarationDocblocks/TypeResolver/ConstantArrayTypeGeneralizer.php
441-
442-
-
443-
identifier: typePerfect.narrowReturnObjectType
444-
path: src/PHPStan/ScopeFetcher.php
445-
446-
-
447-
identifier: varTag.nativeType
448-
path: src/BetterPhpDocParser/PhpDocParser/StaticDoctrineAnnotationParser.php
449-
450-
-
451-
identifier: argument.type
452-
paths:
453-
- rules/Privatization/TypeManipulator/TypeNormalizer.php
454-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php
455-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php
456-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php
457-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php
458-
- rules/TypeDeclarationDocblocks/Rector/Class_/AddVarArrayDocblockFromDimFetchAssignRector.php
459-
- src/NodeTypeResolver/PHPStan/Type/TypeFactory.php
460-
461-
-
462-
identifier: argument.templateType
463-
paths:
464-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayMapRector.php
465-
- rules/TypeDeclaration/Rector/FunctionLike/AddClosureParamTypeForArrayReduceRector.php
466-
- src/NodeTypeResolver/PHPStan/Type/TypeFactory.php

rules/Php81/NodeManipulator/NullToStrictStringIntConverter.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\Php81\NodeManipulator;
66

7-
use PHPStan\Analyser\Fiber\FiberScope;
87
use PhpParser\Node\Arg;
98
use PhpParser\Node\Expr;
109
use PhpParser\Node\Expr\Cast\Int_ as CastInt_;
@@ -214,10 +213,6 @@ private function isAnErrorType(Expr $expr, Type $type, Scope $scope): bool
214213
}
215214

216215
$parentScope = $scope->getParentScope();
217-
if ($parentScope instanceof FiberScope) {
218-
$parentScope = $parentScope->toMutatingScope();
219-
}
220-
221216
if ($parentScope instanceof Scope) {
222217
return $parentScope->getType($expr) instanceof ErrorType;
223218
}

src/DependencyInjection/PHPStan/PHPStanContainerMemento.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use PHPStan\Parser\AnonymousClassVisitor;
1010
use PHPStan\Parser\ArrayMapArgVisitor;
1111
use PHPStan\Parser\RichParser;
12+
use PHPStan\Parser\VariadicFunctionsVisitor;
13+
use PHPStan\Parser\VariadicMethodsVisitor;
1214
use Rector\Util\Reflection\PrivatesAccessor;
1315

1416
/**
@@ -39,6 +41,8 @@ public static function removeRichVisitors(RichParser $richParser): void
3941
// remove all the rest, https://github.com/phpstan/phpstan-src/tree/1d86de8bb9371534983a8dbcd879e057d2ff028f/src/Parser
4042
$nodeVisitorsToKeep = [
4143
$container->findServiceNamesByType(AnonymousClassVisitor::class)[0] => true,
44+
$container->findServiceNamesByType(VariadicFunctionsVisitor::class)[0] => true,
45+
$container->findServiceNamesByType(VariadicMethodsVisitor::class)[0] => true,
4246
$container->findServiceNamesByType(ArrayMapArgVisitor::class)[0] => true,
4347
];
4448

src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\NodeTypeResolver\PHPStan\Scope;
66

7-
use PHPStan\Analyser\Fiber\FiberScope;
87
use Error;
98
use PhpParser\Node;
109
use PhpParser\Node\Arg;
@@ -159,10 +158,6 @@ public function processNodes(
159158
&$nodeCallback,
160159
$filePath,
161160
): void {
162-
if ($mutatingScope instanceof FiberScope) {
163-
$mutatingScope = $mutatingScope->toMutatingScope();
164-
}
165-
166161
// the class reflection is resolved AFTER entering to class node
167162
// so we need to get it from the first after this one
168163
if ($node instanceof Class_ || $node instanceof Interface_ || $node instanceof Enum_) {

src/NodeTypeResolver/Reflection/BetterReflection/SourceLocatorProvider/DynamicSourceLocatorProvider.php

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

77
use PHPStan\BetterReflection\SourceLocator\Type\AggregateSourceLocator;
88
use PHPStan\BetterReflection\SourceLocator\Type\SourceLocator;
9+
use PHPStan\Reflection\BetterReflection\SourceLocator\FileNodesFetcher;
910
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedDirectorySourceLocatorFactory;
10-
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocatorRepository;
11+
use PHPStan\Reflection\BetterReflection\SourceLocator\OptimizedSingleFileSourceLocator;
1112
use Rector\Contract\DependencyInjection\ResettableInterface;
1213
use Rector\Testing\PHPUnit\StaticPHPUnitEnvironment;
1314

@@ -29,8 +30,8 @@ final class DynamicSourceLocatorProvider implements ResettableInterface
2930
private ?AggregateSourceLocator $aggregateSourceLocator = null;
3031

3132
public function __construct(
32-
private readonly OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory,
33-
private readonly OptimizedSingleFileSourceLocatorRepository $optimizedSingleFileSourceLocatorRepository
33+
private readonly FileNodesFetcher $fileNodesFetcher,
34+
private readonly OptimizedDirectorySourceLocatorFactory $optimizedDirectorySourceLocatorFactory
3435
) {
3536
}
3637

@@ -67,7 +68,7 @@ public function provide(): SourceLocator
6768
$sourceLocators = [];
6869

6970
foreach ($this->filePaths as $file) {
70-
$sourceLocators[] = $this->optimizedSingleFileSourceLocatorRepository->getOrCreate($file);
71+
$sourceLocators[] = new OptimizedSingleFileSourceLocator($this->fileNodesFetcher, $file);
7172
}
7273

7374
foreach ($this->directories as $directory) {

0 commit comments

Comments
 (0)