Project

General

Profile

Actions

Bug #101927

closed

TYPO3 Fluid Core ViewHelpers should not be declared "final class"

Added by Gabriel Kaufmann / Typoworx NewMedia about 1 year ago. Updated about 1 year ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2023-09-15
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I've noticed TYPO3 Fluid Core ViewHelpers are now declared "final class". Of course this can make sense in some cases, but I don't think this is useful for a CMS such as TYPO3 where other developers may require to extend some core-functionality.

I also have a simple usecase:
It's really "stupid", that f:image will throw an exception when the image/fal-object fails. It's just an image and such behaviour should not break a complete website. Instead there could be a user-friendly output, fallback-image or use of Event/Signals to delegate such "issues" and let the site-developer decide what then should happen.

I've simply extended \TYPO3\CMS\Fluid\ViewHelpers\ImageViewHelper to archive that wrapping my try/catch when invoking parent::render() to the parent-class. But this isn't possible now anymore, because the given core-class is now declared final.

I think there are only few useful cases where final really makes sense! I don't think the Core- and Fluid developers are unfailable. So until this isn't the case they should not use "final" in classes that may need to be extended by other developers.

The only way to work-around would make a 1:1 copy of the original class. But this isn't the best-practice as future updates of TYPO3-Core won't apply then to this custom-code anymore (whereas this mostly works by invoking parent::render( ) in my example given).

The only compromise that would make sense is to move the code-implementation into a Trait-Class which then is used in the final class ViewHelper. Then other developers could use that trait too and this would archive the same goal being able to use final class and also to give developers the might to extend such code to their own needs.


Related issues 4 (1 open3 closed)

Related to TYPO3 Core - Task #95298: ViewHelpers will be declared final in v12Closed2021-09-21

Actions
Related to TYPO3 Core - Bug #101929: ViewHelperInvoker should catch Exceptions allow the Site-Developer to handle or supress exceptionsClosed2023-09-15

Actions
Related to TYPO3 Core - Task #101698: Remove "final" keywordClosed2023-08-16

Actions
Related to TYPO3 Core - Bug #104118: Avoid hard dependency on final validation viewhelperNeeds Feedback2024-06-15

Actions
Actions

Also available in: Atom PDF