Skip to content

Conversation

@eric-therond
Copy link
Contributor

No description provided.

@nikic
Copy link
Collaborator

nikic commented Feb 22, 2022

Not sure I understand the motivation for this change. Currently it's printed in a way that makes the literal a valid string. In these particular examples it happens to not be strictly necessary, but it would be if the string were '\\' for example.

@eric-therond
Copy link
Contributor Author

eric-therond commented Feb 23, 2022

@nikic the problem I faced is that literal are printed with var_export, that keep escape chars, example:

    Stmt_Class
        name: LITERAL('NS\\NameOfClass')
        extends: LITERAL('X')
        implements[0]: LITERAL('NS\\Iface')
        stmts: Block#3

while function names are printed without var_export:

Function NS\NameOfClass::doSomething(): mixed
Block#1
    Terminal_Echo
        expr: LITERAL('Hello World')
    Terminal_Return

so there is an inconsistency in the class names (NS\NameOfClass and NS\\NameOfClass on other side).

Maybe this solution is more correct?
change line 25 to:

$name = var_export($func->getScopedName(), true);

@ircmaxell
Copy link
Owner

That second change seems more inline, it'll make the function name a string as well as escaping more consistently. +1 from me.

@eric-therond
Copy link
Contributor Author

looking good now on your side @nikic @ircmaxell ?

@ircmaxell ircmaxell merged commit 2c90d46 into ircmaxell:master Feb 28, 2022
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.

3 participants