89890[FEATURE] Make validation attributes usable for method parameters
Commit message
Review
-
Code review CR +2 Done
- Christian Kuhn +2
- Stefan Bürk +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Christian Kuhn +2
- Stefan Bürk +1
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 21
- typo3/sysext/core/Documentation/Changelog/14.0/Deprecation-108227-UsageOfIgnoreValidationAndValidateAttributesForParametersAtMethodLevel.rstnew+145 −0
- typo3/sysext/core/Documentation/Changelog/14.0/Feature-108227-AllowIgnoreValidationAndValidateAttributesAtControllerActionMethodParameters.rstnew+59 −0
- typo3/sysext/extbase/Classes/Attribute/IgnoreValidation.php7+12 −3
- typo3/sysext/extbase/Classes/Attribute/Validate.php+15 −4
- typo3/sysext/extbase/Classes/Reflection/ClassSchema.php+46 −37
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/action_controller_argument_test/Classes/Controller/ArgumentTestController.php+8 −6
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/action_controller_test/Classes/Controller/TestController.php+8 −6
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Controller/BlogController.php+1 −5
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/blog_example/Classes/Controller/BlogPostEditingController.php+1 −2
- typo3/sysext/extbase/Tests/Functional/Fixtures/Extensions/extbase_upload/Classes/Controller/SingleFileUploadController.php+1 −2
- typo3/sysext/extbase/Tests/Unit/Attribute/IgnoreValidationTest.php+12 −0
- typo3/sysext/extbase/Tests/Unit/Attribute/ValidateTest.php+12 −0
- typo3/sysext/extbase/Tests/Unit/Reflection/ClassSchema/MethodParameterTest.php+61 −3
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyClassWithIgnoreValidationAttribute.php+6 −3
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyController.php+7 −5
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithIgnoreValidationAttributesAtMethodScope.phprenamed+4 −4
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithIgnoreValidationAttributesAtParameterScope.phpcopied+8 −5
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithValidateAttributesAtMethodScope.phpnew+31 −0
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithValidateAttributesAtParameterScope.phpnew+34 −0
- typo3/sysext/extbase/Tests/Unit/Reflection/Fixture/DummyControllerWithValidateAttributeWithoutParamTypeHint.php+4 −2
Show 1 more file
Review log 2736
Show 711 earlier messages
-
Elias Häußler uploaded patch set 1 06/25/25, 16:54
-
core-ci voted on patch set 1 V -1 06/25/25, 17:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/80885
-
Elias Häußler wrote 08/21/25, 06:56
Topic set to extbase -
Elias Häußler uploaded patch set 2
V -110/14/25, 15:40 -
core-ci voted on patch set 2 V +1 10/14/25, 15:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/86650
-
Elias Häußler uploaded patch set 3
V +111/20/25, 15:33 -
core-ci voted on patch set 3 V -1 11/20/25, 15:43 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90304
-
Elias Häußler uploaded patch set 4
V -111/20/25, 18:34 -
core-ci voted on patch set 4 V +1 11/20/25, 18:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90349
-
Elias Häußler uploaded patch set 5
V +111/20/25, 20:48 -
Elias Häußler marked it ready for review 11/20/25, 20:48
-
core-ci voted on patch set 5 V +1 11/20/25, 20:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90372
-
Elias Häußler uploaded patch set 6
V +111/20/25, 21:04 -
Elias Häußler uploaded patch set 7 11/20/25, 21:06
-
core-ci voted on patch set 7 V +1 11/20/25, 21:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90384
-
Simon Schaufelberger uploaded patch set 8
V +111/20/25, 23:02 -
core-ci voted on patch set 8 V +1 11/20/25, 23:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90413
-
Simon Schaufelberger commented on patch set 8 11/20/25, 23:20
I'm not really happy with the deprecation message: Passing an argument name to an #[IgnoreValidation] attribute is deprecated and will be removed in TYPO3 v15.0. Place the attribute on the method parameter instead. in /home/simon/Code/typo3-core/typo3/sysext/extbase/Classes/Attribute/IgnoreValidation.php line 52 This does not help at all where the deprecated attribute is used. Can we add more info about controller or method or at least extension? -
Simon Schaufelberger commented on patch set 8 V +1 11/20/25, 23:33
Tested with a custom extension and couldn't find any problems. -
Elias Häußler commented on patch set 8 11/21/25, 06:20
Reply
I assume this is not possible, because the attribute does not know its context when being created. If you have a suggestion for a better naming, feel free to adapt it as you wish. -
Elias Häußler rebased onto patch set 9
V +111/21/25, 11:59 -
Oliver Klee commented on patch set 9 11/21/25, 12:06
IgnoreValidation.php:30Would it work to add the `@deprecated` annotation to this line instead of the `@todo` in line 33? -
core-ci voted on patch set 9 V +1 11/21/25, 12:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90494
-
Simon Schaufelberger commented on patch set 9 11/21/25, 20:06
IgnoreValidation.php:57```suggestion if ($this->argumentName !== null) { $detectedLocation = 'unknown location'; $trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 4); if ( isset($trace[2]['object']) && $trace[2]['object'] instanceof ClassSchema && isset($trace[2]['args'][0]) && $trace[2]['args'][0] instanceof \ReflectionClass ) { /** @var \ReflectionClass $targetClass */ $targetClass = $trace[2]['args'][0]; $className = $targetClass->getName(); $methodName = 'unknownMethod'; foreach ($targetClass->getMethods() as $method) { $attributes = $method->getAttributes(self::class); foreach ($attributes as $attribute) { $args = $attribute->getArguments(); $argCheck = $args['argumentName'] ?? $args[0] ?? null; if ($argCheck === $this->argumentName) { $methodName = $method->getName(); break 2; } } } $detectedLocation = sprintf('%s::%s', $className, $methodName); } trigger_error( 'Passing an argument name to an #[IgnoreValidation] attribute is deprecated. ' . 'Found in: ' . $detectedLocation . '. ' . 'Place the attribute on the parameter named "$' . $this->argumentName . '" instead.', E_USER_DEPRECATED, ); } ``` -
Simon Schaufelberger commented on patch set 9 11/21/25, 20:07
IgnoreValidation.php:57Replyby that it would be possible to output some meaningful deprecation message. What do you think? -
Simon Schaufelberger commented on patch set 9 11/21/25, 20:09
IgnoreValidation.php:57Reply"and will be removed in TYPO3 v15.0" got lost on the way... -
Elias Häußler commented on patch set 9 11/22/25, 16:17
IgnoreValidation.php:57ReplyI think we should not do this. Here are the reasons: 1) It massively bloats up the attribute class with IMO less impact. Developers reading their deprecation log should be able to search for usages of the attribute in their project. 2) When upgrading an application which raises these deprecation warnings, developers must update their validation attributes anyway, because of the recent changes in this area. 3) We never do this in TYPO3 core. I could at least not find any places where we use `debug_backtrace` to fetch this kind of information. We haven't done this in #97559 as well. I hope this is fine for you. -
Simon Schaufelberger commented on patch set 9 CR +1 V +1 11/22/25, 17:44
IgnoreValidation.php:57ReplyIt's only for the people not using rector and support 2 versions. I'll give my best to create a Rector rule for that. -
Simon Schaufelberger commented on patch set 9 11/22/25, 17:45
Reply
Done -
Christian Kuhn commented on patch set 9 11/22/25, 21:00
IgnoreValidation.php:30Replyi think its fine turning the two @todo into @deprecated - afaik ide's are quite fine with these positions. i'm not used to '@param @deprecated', but it feels odd to me and we can't leave out @param i suppose. i looked at the change for a while and played around now. i hope it is ok to resolve for now in order to reach a merge: this is the last part of the extbase attribute works and i'd love to see this being done with 14.0 let's sort out such a detail with a dedicated change if really needed. -
Christian Kuhn uploaded patch set 10
CR +1V +111/22/25, 21:02 -
Christian Kuhn voted on patch set 10 CR +2 V +2 11/22/25, 21:04
-
Simon Schaufelberger voted on patch set 10 CR +1 V +1 11/22/25, 21:05
-
Stefan Bürk voted on patch set 10 CR +1 V +1 11/22/25, 21:08
-
core-ci voted on patch set 10 V +1 11/22/25, 21:15 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/90691
-
Christian Kuhn merged patch set 11 11/22/25, 21:17