getrector-com icon indicating copy to clipboard operation
getrector-com copied to clipboard

/ast page should not use FullyQualified on return true

Open samsonasik opened this issue 1 year ago • 3 comments

The true value is not FullyQualified, a Name should be used if as input is not backslashed.

https://getrector.com/ast/d50f4d493f7061f3c419397a744a49e92409c3ce?nodeId=7

samsonasik avatar Jan 27 '25 23:01 samsonasik

It seems only happen on non-namespaced file https://getrector.com/ast/d50f4d493f7061f3c419397a744a49e92409c3ce?nodeId=7

when has namespace, it not fully qualified https://getrector.com/ast/fbf1401fbd04dfd5e9a0858f4936a39ed66cc4dd?nodeId=9

samsonasik avatar Jan 28 '25 00:01 samsonasik

It seems bug on nikic/php-parser on NameContext

https://github.com/nikic/PHP-Parser/blob/fa02db3f30ecdee4142bed51b860e1e3ca20bb5a/lib/PhpParser/NameContext.php#L124-L127

The getNamespaceRelativeName() should be called first.

samsonasik avatar Jan 28 '25 08:01 samsonasik

I created PR on php-parser side:

  • https://github.com/nikic/PHP-Parser/pull/1067

samsonasik avatar Jan 28 '25 08:01 samsonasik

Closing as this is way php-parser works, and FQN is not really relevant here. AST form works well and provides all values correctly.

If it get's changed in php-parser, good for the slash, but I don't think it's work it.

TomasVotruba avatar May 04 '25 20:05 TomasVotruba