Skip to content

Commit

Permalink
[Parser] Remove SmartPhpParserFactory and SmartPhpParser
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jan 6, 2025
1 parent 2e82ab4 commit 0e43bcb
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
-
name: 'Active Classes'
run: |
vendor/bin/class-leak check bin config src rules utils --skip-suffix "Rector" --skip-type="Rector\\Utils\\Compiler\\Unprefixer" --skip-type="Rector\\PhpDocParser\\PhpParser\\SmartPhpParserFactory" --skip-type="Rector\\NodeCollector\\BinaryOpConditionsCollector" --skip-type="Rector\\Set\\Contract\\SetListInterface"
vendor/bin/class-leak check bin config src rules utils --skip-suffix "Rector" --skip-type="Rector\\Utils\\Compiler\\Unprefixer" --skip-type="Rector\\NodeCollector\\BinaryOpConditionsCollector" --skip-type="Rector\\Set\\Contract\\SetListInterface"
-
name: 'Compatible PHPStan versions'
Expand Down
4 changes: 0 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,6 @@ parameters:
message: '#@\\ini_set\(.*\)" is forbidden to use#'
path: bin/rector.php

-
message: '#Creating new PHPStan\\Parser\\(CachedParser|SimpleParser) is not covered by backward compatibility promise\. The class might change in a minor PHPStan version#'
path: src/PhpDocParser/PhpParser/SmartPhpParserFactory.php

# known existing class
-
message: '#Instead of "instanceof/is_a\(\)" use ReflectionProvider service or "\(new ObjectType\(<desired_type>\)\)\->isSuperTypeOf\(<element_type>\)" for static reflection to work#'
Expand Down
37 changes: 0 additions & 37 deletions src/PhpDocParser/PhpParser/SmartPhpParser.php

This file was deleted.

55 changes: 0 additions & 55 deletions src/PhpDocParser/PhpParser/SmartPhpParserFactory.php

This file was deleted.

5 changes: 3 additions & 2 deletions src/PhpParser/AstResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use Rector\NodeTypeResolver\NodeTypeResolver;
use Rector\PhpDocParser\PhpParser\SmartPhpParser;
use Rector\PhpParser\Node\BetterNodeFinder;
use Rector\PhpParser\Parser\RectorParser;
use Rector\Reflection\MethodReflectionResolver;
use Rector\StaticTypeMapper\Resolver\ClassNameFromObjectTypeResolver;
use Rector\ValueObject\MethodName;
Expand All @@ -53,7 +54,7 @@ final class AstResolver
private array $parsedFileNodes = [];

public function __construct(
private readonly SmartPhpParser $smartPhpParser,
private readonly RectorParser $rectorParser,
private readonly NodeScopeAndMetadataDecorator $nodeScopeAndMetadataDecorator,
private readonly NodeNameResolver $nodeNameResolver,
private readonly ReflectionProvider $reflectionProvider,
Expand Down Expand Up @@ -306,7 +307,7 @@ public function parseFileNameToDecoratedNodes(?string $fileName): array
}

try {
$stmts = $this->smartPhpParser->parseFile($fileName);
$stmts = $this->rectorParser->parseFile($fileName);
} catch (Throwable $throwable) {
/**
* phpstan.phar contains jetbrains/phpstorm-stubs which the code is not downgraded
Expand Down

0 comments on commit 0e43bcb

Please sign in to comment.