GeneratorClassesResolver extends NodeVisitorAbstract
Create a fully qualified class name object from first argument of GeneralUtility::makeInstance('My\\Package\\Class\\Name') if given as string and not as My\Package\Class\Name::class language construct.
This resolver is to be called after generic NameResolver::class, but before other search and find visitors that implement CodeScannerInterface::class
This class is only meant to be used within EXT:install and is not part of the TYPO3 Core API.
Table of Contents
Properties
- $builderFactory : BuilderFactory
Methods
- __construct() : mixed
- enterNode() : mixed
- Called by PhpParser.
- duplicateNodeAttributes() : void
- Duplicates node positions in source file, based on the assumption that only lines are relevant. In case this shall be used for code-migration, real offset positions would be required.
- substituteClassString() : ClassConstFetch|null
- Substitutes class-string values with their corresponding class constant representation (`'Vendor\\ClassName'` -> `\Vendor\ClassName::class`).
- substituteMakeInstance() : New_|null
- Substitutes `makeInstance` invocations with proper `new` invocations.
Properties
$builderFactory
protected
BuilderFactory
$builderFactory
Methods
__construct()
public
__construct([BuilderFactory|null $builderFactory = null ]) : mixed
Parameters
- $builderFactory : BuilderFactory|null = null
enterNode()
Called by PhpParser.
public
enterNode(Node $node) : mixed
Create an fqdn object from first makeInstance argument if it is a String
Parameters
- $node : Node
-
Incoming node
duplicateNodeAttributes()
Duplicates node positions in source file, based on the assumption that only lines are relevant. In case this shall be used for code-migration, real offset positions would be required.
protected
duplicateNodeAttributes(Node $source, Node ...$targets) : void
Parameters
- $source : Node
- $targets : Node
substituteClassString()
Substitutes class-string values with their corresponding class constant representation (`'Vendor\\ClassName'` -> `\Vendor\ClassName::class`).
protected
substituteClassString(Expr $argValue) : ClassConstFetch|null
Parameters
- $argValue : Expr
Return values
ClassConstFetch|nullsubstituteMakeInstance()
Substitutes `makeInstance` invocations with proper `new` invocations.
protected
substituteMakeInstance(StaticCall $node, Expr $argValue) : New_|null
GeneralUtility(\Vendor\ClassName::class, 'a', 'b')
-> new \Vendor\ClassName('a', 'b')
Parameters
- $node : StaticCall
- $argValue : Expr