Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Printer] Try extends PHPStan Printer #6518

Closed
wants to merge 1 commit into from

Conversation

samsonasik
Copy link
Member

@@ -295,7 +294,6 @@ public function processNodes(
$this->nodeScopeResolverProcessNodes($stmts, $scope, $nodeCallback);

$nodeTraverser = new NodeTraverser();
$nodeTraverser->addVisitor(new WrappedNodeRestoringNodeVisitor());
Copy link
Member Author

@samsonasik samsonasik Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ondrejmirtes I tried remove this unwrap, and it somehow cause invalid print:

Failed on fixture file "mirror_assign_comment.php.inc"
Failed asserting that string matches format description.
--- Expected
+++ Actual
@@ @@
 {
     public static function run()
     {
-        $response = match ($_SERVER['REQUEST_METHOD']) {
+        $response = match (__phpstanRembered($_SERVER['REQUEST_METHOD'])) {

see "__phpstanRembered" printered above, and cause error:

2) Rector\Tests\CodeQuality\Rector\ClassMethod\OptionalParametersAfterRequiredRector\OptionalParametersAfterRequiredRectorTest::test with data set #7 ('/Users/samsonasik/www/rector-...hp.inc')
assert($subStartPos >= 0 && $subEndPos >= 0)

/home/runner/work/rector-src/rector-src/vendor/nikic/php-parser/lib/PhpParser/PrettyPrinterAbstract.php:688
/home/runner/work/rector-src/rector-src/src/PhpParser/Printer/BetterStandardPrinter.php:116

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ondrejmirtes
Copy link
Contributor

Alright, I get it. Please forget what I said, you need to unwrap the expression by yourself and the PHPStan Printer class isn't usable for your use-case.

@samsonasik
Copy link
Member Author

Ok, let's close then ;)

@samsonasik samsonasik closed this Nov 27, 2024
@samsonasik samsonasik deleted the try-remove-always-remembered branch November 27, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants