90239[TASK] Add return type hints to ViewHelper classes
Commit message
Review
-
Code review CR +2 Done
- Simon Praetorius +2
- Oliver Klee +1
- Garvin Hicking +1
- Simon Schaufelberger +1
-
Verified V +2 Done
- Simon Praetorius +2
- Oliver Klee +1
- Garvin Hicking +1
- Simon Schaufelberger +1
- core-ci +1 CI
Issues 1
Files 9
- Build/phpstan/phpstan-baseline.neon+0 −6
- typo3/sysext/extensionmanager/Classes/ViewHelpers/ReloadSqlDataViewHelper.php+1 −1
- typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuViewHelper.php+2 −2
- typo3/sysext/fluid/Classes/ViewHelpers/Form/ValidationResultsViewHelper.php+2 −5
- typo3/sysext/fluid/Classes/ViewHelpers/Format/HtmlentitiesDecodeViewHelper.php+1 −2
- typo3/sysext/fluid/Classes/ViewHelpers/Format/HtmlentitiesViewHelper.php+1 −2
- typo3/sysext/fluid/Classes/ViewHelpers/FlashMessagesViewHelper.php+2 −4
- typo3/sysext/fluid/Tests/Functional/Fixtures/Libraries/viewhelper_library/src/ViewHelpers/TestViewHelper.php+1 −1
- typo3/sysext/form/Classes/ViewHelpers/TranslateElementPropertyViewHelper.php+2 −4
Review log 911
-
Simon Praetorius uploaded patch set 1 08/04/25, 15:07
-
core-ci voted on patch set 1 V -1 08/04/25, 15:14 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82763
-
Simon Praetorius uploaded patch set 2
V -108/04/25, 15:20 -
core-ci voted on patch set 2 V +1 08/04/25, 15:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/82764
-
Simon Schaufelberger voted on patch set 2 CR +1 V +1 08/04/25, 16:34
-
Garvin Hicking voted on patch set 2 CR +1 V +1 08/04/25, 16:51
-
Oliver Klee voted on patch set 2 CR +1 V +1 08/04/25, 17:02
-
Simon Praetorius voted on patch set 2 CR +2 V +2 08/05/25, 06:54
-
Simon Praetorius merged patch set 3 08/05/25, 06:54
-
Benjamin Franzke commented on patch set 3 08/05/25, 15:52
Is there a reason why this change is not backported to 13.4? We usually try to simplify backports by keeping main and 13.4 in sync when talking about simple code changes.I'd love more context in commit messages like these regarding upcoming fluid changes. In this particular example I do not understand what is becoming stricter in the base class. It is stated that `render()` will require certain return types, but given that `Format/HtmlentitiesDecodeViewHelper` is changed and allowed to return `mixed` it seems like return type declarations (btw not "hints", it's a declaration, as they are enforced with strict_types=1!) for `render()` will not change at all, so I do not understand this justification. Maybe return types be reflected in future? -
Simon Praetorius commented on patch set 3 08/05/25, 16:08
Reply Unresolved
Backport is fine by me. Just wasn't aware that changes like these should be backported.Reply Unresolved
I'd like to introduce both parameter and return types (e. g. `void` for `initializeArguments()` or `string` for `compile()` to `ViewHelperInterface` and the abstract ViewHelper classes with Fluid v5. Specifying `render()` as `mixed` in the abstract class isn't strictly necessary I guess. All of these would be breaking changes because they would need to be applied to child classes as well, which is why they are not added with Fluid v4. This patch applies all changes that are merely "cleanup" changes and can be applied independently of the interface and base class changes, which are mainly return types. Once the changes are applied to the base classes and Fluid v5 is released, there will be another patch that applies the breaking changes. There's already a Rector rule that covers the most common cases (like `protected ?bool $escapeOutput = false`).