Project

General

Profile

Actions

Bug #101927

closed

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

Added by Gabriel Kaufmann / Typoworx NewMedia 8 months ago. Updated 8 months 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 3 (2 open1 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 exceptionsNew2023-09-15

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

Actions
Actions #1

Updated by Georg Ringer 8 months ago

  • Status changed from New to Rejected

thanks for creating the issue! your issue is about 2 things which shouldn't be mixed.

1st: I agree that the VH shouldnt fail if the image does not exist, please open a separate issue for that

regarding the final statement, this won't be changed and has been already announced with 11.5, see https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/11.5/Important-95298-FluidViewhelpersWillBeDeclaredFinalInV12.html however feel free to start a discussion about that on https://decisions.typo3.org/ or on slack

feel to also talk to me/core team on slack

Actions #2

Updated by Georg Ringer 8 months ago

  • Related to Task #95298: ViewHelpers will be declared final in v12 added
Actions #3

Updated by Gabriel Kaufmann / Typoworx NewMedia 8 months ago

  • Related to Bug #101929: ViewHelperInvoker should catch Exceptions allow the Site-Developer to handle or supress exceptions added
Actions #4

Updated by Ralf Hettinger 3 months ago

Actions

Also available in: Atom PDF