-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Document tree walker class strings #9553
Document tree walker class strings #9553
Conversation
* @param Query $query The parsed Query. | ||
* @param ParserResult $parserResult The result of the parsing process. | ||
* @psalm-param array<string, QueryComponent> $queryComponents The query components (symbol table). |
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.
Psalm seems to ignore @inheritDoc
on constructors. 🤷🏻♂️
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.
It is supposed to work though: vimeo/psalm#4504 (comment)
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.
But I think you'd need to add psalm-consistent-constructor
on the interface as well (or in fact, only there? not sure if it's necessary to have it in this class). Can you please try that?
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.
Doesn't really work. If I add this annotation to the interface, @inheritdoc
on SqlWalker
's constructor is still ignored. If I remove the attotation from SqlWalker
, @inheritdoc
works again, but this also brings back the UnsafeInstantiation
error for new $outputWalkerClass
. 😕
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.
Ok, I guess defining a constructor in an interface is quite the corner case.
@@ -220,7 +220,7 @@ class Parser | |||
/** | |||
* The custom last tree walker, if any, that is responsible for producing the output. | |||
* | |||
* @var class-string<TreeWalker> | |||
* @var class-string<SqlWalker>|null |
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.
As explained on #9551, output walkers cannot be arbitrary implementations of TreeWalker
, we do expect an SqlWalker
here.
Another backport from #9551