Skip to content

Commit 538e041

Browse files
committed
Remove PHPStan Printer undefined pPHPStan_ method fallback, PHPStan Printer prints all its virtual nodes
Amp-Thread-ID: https://ampcode.com/threads/T-01a179f2-995f-7745-8d8c-4c174ba5c0ce
1 parent 2f8afd4 commit 538e041

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

‎src/NodeTypeResolver/PHPStan/Scope/PHPStanNodeScopeResolver.php‎

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Rector\NodeTypeResolver\PHPStan\Scope;
66

7-
use Error;
87
use PhpParser\Node;
98
use PhpParser\Node\ArrayItem;
109
use PhpParser\Node\Expr;
@@ -76,7 +75,6 @@
7675
use PHPStan\Node\FunctionCallableNode;
7776
use PHPStan\Node\InstantiationCallableNode;
7877
use PHPStan\Node\MethodCallableNode;
79-
use PHPStan\Node\Printer\Printer;
8078
use PHPStan\Node\StaticMethodCallableNode;
8179
use PHPStan\Node\UnreachableStatementNode;
8280
use PHPStan\Node\VirtualNode;
@@ -335,18 +333,7 @@ private function fillScope(array $stmts, MutatingScope $scope): void
335333
}
336334
};
337335

338-
try {
339-
$this->nodeScopeResolverProcessNodes($stmts, $scope, $nodeCallback);
340-
} catch (Error $error) {
341-
if (! str_starts_with($error->getMessage(), 'Call to undefined method ' . Printer::class . '::pPHPStan_')) {
342-
throw $error;
343-
}
344-
345-
// nothing we can do more precise here as error printing from deep internal PHPStan Printer service with service injection we cannot reset
346-
// in the middle of process
347-
// fallback to fill by found scope
348-
RectorNodeScopeResolver::processNodes($stmts, $scope);
349-
}
336+
$this->nodeScopeResolverProcessNodes($stmts, $scope, $nodeCallback);
350337
}
351338

352339
private function processYield(Yield_ $yield, MutatingScope $mutatingScope): void

0 commit comments

Comments
 (0)