You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Node visitors trigger "might add a native return type" deprecations of Symfony's DebugClassLoader #243
PhpParser\NodeVisitor declares the return types of its methods in docblocks only (@return null|Node[], @return null|int|Node|Node[]). Three visitors override them with neither a native return type nor their own @return (just {@inheritDoc}):
Symfony's DebugClassLoader (debug mode of every Symfony application) reports a deprecation when such a class loads, e.g.:
Method "PhpParser\NodeVisitor::beforeTraverse()" might add "?array" as a native return type declaration in the future.
Do the same in implementation "Go\ParserReflection\NodeVisitor\RootNamespaceNormalizer" now to avoid errors or add an
explicit @return annotation to suppress this message.
This shows up in goaop/goaop-symfony-bundle whenever weaving runs under the DebugClassLoader (found while working on goaop/goaop-symfony-bundle#23).
What silences it
Checked with Symfony 8.1 DebugClassLoader and PHP-Parser 5.9 against a NodeVisitorAbstract subclass:
Variant of beforeTraverse(array $nodes)
Deprecation
{@inheritdoc} docblock, no return type (current)
yes
no docblock
yes
#[\ReturnTypeWillChange]
yes
explicit @return null|\PhpParser\Node[] docblock
no
native : ?array
no
DebugClassLoader reports the method when it has no native return type and no @return tag of its own. {@inheritdoc} carries no @return, and #[\ReturnTypeWillChange] only applies to PHP's own tentative types of internal classes.
Decision
Explicit @return docblocks, no native return types: PHP-Parser owns these signatures and may declare native types itself in a future version, so this library shouldn't commit to them. Fix on 4.x; it flows into master through the cascade merge.
Fixed by #245, merged into 4.x and carried into master by the cascade PR #250. GitHub didn't close this automatically because #245 targeted 4.x, not the default branch.
Activity
lisachenko commentedon Nov 2, 2026
Fixed by #245, merged into
4.xand carried intomasterby the cascade PR #250. GitHub didn't close this automatically because #245 targeted4.x, not the default branch.Generated by Claude Code