-
Notifications
You must be signed in to change notification settings - Fork 504
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
Repair PhpParser\Node\Stmt\Class_::isAnonymous() #3343
Conversation
5c723eb
to
b8a841b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should work, but I'm slightly concerned regarding backward compatibility of node attributes.
@@ -27,10 +27,20 @@ public function enterNode(Node $node): ?Node | |||
return null; | |||
} | |||
|
|||
$node->setAttribute(self::ATTRIBUTE_ANONYMOUS_CLASS, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory this isn't covered by the backward compatibility promise, right?
Even so, the removal of this would cause some breakages (see e.g. mglaman/phpstan-drupal#195)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the attribute but don't use it ourselves anywhere anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I opted against keeping the constant since it's not meant to be reused.
@@ -27,10 +27,20 @@ public function enterNode(Node $node): ?Node | |||
return null; | |||
} | |||
|
|||
$node->setAttribute(self::ATTRIBUTE_ANONYMOUS_CLASS, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep the attribute but don't use it ourselves anywhere anymore.
Thank you! Btw I wouldn't bother PHP-Parser with this, it's a niche edge case we've already solved, no need to change the underlying library. |
As proposed here: #3328 (comment)