[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:TYPO3com <noreply@typo3.com> Tested-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Tested-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Andreas Fernandez <a.fernandez@scripting-base.de> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com>
Showing
- typo3/sysext/install/Classes/Controller/UpgradeController.php 13 additions, 2 deletions...3/sysext/install/Classes/Controller/UpgradeController.php
- typo3/sysext/install/Classes/ExtensionScanner/Php/GeneratorClassesResolver.php 30 additions, 4 deletions...Classes/ExtensionScanner/Php/GeneratorClassesResolver.php
- typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/AbstractCoreMatcher.php 28 additions, 21 deletions...sses/ExtensionScanner/Php/Matcher/AbstractCoreMatcher.php
- typo3/sysext/install/Classes/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcher.php 241 additions, 0 deletions...tensionScanner/Php/Matcher/ConstructorArgumentMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/ConstructorArgumentMatcher.php 38 additions, 0 deletions...ation/ExtensionScanner/Php/ConstructorArgumentMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodArgumentDroppedMatcher.php 0 additions, 6 deletions...ion/ExtensionScanner/Php/MethodArgumentDroppedMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodArgumentRequiredMatcher.php 0 additions, 8 deletions...on/ExtensionScanner/Php/MethodArgumentRequiredMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodArgumentUnusedMatcher.php 0 additions, 7 deletions...tion/ExtensionScanner/Php/MethodArgumentUnusedMatcher.php
- typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php 0 additions, 8 deletions.../Configuration/ExtensionScanner/Php/MethodCallMatcher.php
- typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php 105 additions, 0 deletions...ionScanner/Php/Matcher/ConstructorArgumentMatcherTest.php
- typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/ConstructorArgumentMatcherFixture.php 43 additions, 0 deletions...hp/Matcher/Fixtures/ConstructorArgumentMatcherFixture.php
- typo3/sysext/install/Tests/Unit/ExtensionScanner/Php/Matcher/Fixtures/Subject.php 26 additions, 0 deletions...ts/Unit/ExtensionScanner/Php/Matcher/Fixtures/Subject.php
Please register or sign in to comment