Skip to content
Snippets Groups Projects
Commit d6ad3ad1 authored by Oliver Hader's avatar Oliver Hader Committed by Oliver Hader
Browse files

[BUGFIX] Handle constructor arguments in extension scanner correctly

Handling constructor arguments in extension scanner did not work since
constructors are not directly called like a method would be called.
Constructors are invoked instead using the `new` statement. Besides
that `GeneratorClassResolver` only supported string class names (like
`'Example\\MyClass'`) when being invoked using
`GeneralUtility::makeInstance`.

Scanner configurations related to `__construct` invocation (in terms
of creating a new class instance) are now handled in a dedicated new
`ConstructorArgumentMatcher`. Besides that, `GeneratorClassResolver` now
supports `GeneralUtility::makeInstance(Example\MyClass::class, 123)`
as well.

`NameResolver` and `GeneratorClassesResolver` are executed in two
consecutive `NodeTraverser` instances - otherwise class names cannot
be resolved in a reliable way.

Resolves: #90722
Releases: master, 9.5
Change-Id: I0154b04674d2637fda817d39a1136c2c8fa389d8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63676


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
parent e787cedc
Branches
Tags
No related merge requests found
Showing
with 524 additions and 56 deletions
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment