For cases (specially cache or logging related) where the name of a class is suffixed using .variant notation, the getTypeFromInjectorVariable fails as it doesn't understand the node which is Expr\BinaryOp\Concat.
Example code use: Injector::inst()->get(CacheInterface::class . '.myCache');
I tried several different way of building the construct back up to a string to make it work the same way the Injector uses it (fallback to the class without the dot suffix) but no luck.
Perhaps some sort of visitor class extending NodeVisitorAbstract would need to be created to reconstruct the AST into something meaningful as the level of nesting of the Concat node can be more than one or two levels, it can also have nested function call nodes, so it's not just String_ or nested Concats in fact.
I looked for ways and the NodeVisitor approach seems to be the preferred way how to transform nodes into something else or replace code in the AST.
Open to suggestions which way I should keep digging (if there are some).
For cases (specially cache or logging related) where the name of a class is suffixed using
.variant
notation, thegetTypeFromInjectorVariable
fails as it doesn't understand the node which isExpr\BinaryOp\Concat
.Example code use:
Injector::inst()->get(CacheInterface::class . '.myCache');
I tried several different way of building the construct back up to a string to make it work the same way the Injector uses it (fallback to the class without the dot suffix) but no luck.
Perhaps some sort of visitor class extending NodeVisitorAbstract would need to be created to reconstruct the AST into something meaningful as the level of nesting of the Concat node can be more than one or two levels, it can also have nested function call nodes, so it's not just String_ or nested Concats in fact.
I looked for ways and the NodeVisitor approach seems to be the preferred way how to transform nodes into something else or replace code in the AST.
Open to suggestions which way I should keep digging (if there are some).