Bug #101927
closedTYPO3 Fluid Core ViewHelpers should not be declared "final class"
0%
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.