diff --git a/Classes/Renderer/Helper/BlockHelper.php b/Classes/Renderer/Helper/BlockHelper.php index 09655919..b3a56798 100644 --- a/Classes/Renderer/Helper/BlockHelper.php +++ b/Classes/Renderer/Helper/BlockHelper.php @@ -23,6 +23,7 @@ namespace Fr\Typo3Handlebars\Renderer\Helper; +use Fr\Typo3Handlebars\Attribute; use Fr\Typo3Handlebars\Exception; use Fr\Typo3Handlebars\Renderer; @@ -33,12 +34,13 @@ * @license GPL-2.0-or-later * @see https://github.com/shannonmoeller/handlebars-layouts#block-name */ -class BlockHelper implements HelperInterface +final readonly class BlockHelper implements HelperInterface { /** * @param array $options * @throws Exception\UnsupportedTypeException */ + #[Attribute\AsHelper('block')] public function evaluate(string $name, array $options): string { $data = $options['_this']; diff --git a/Classes/Renderer/Helper/ContentHelper.php b/Classes/Renderer/Helper/ContentHelper.php index 9aef4a8e..971bea46 100644 --- a/Classes/Renderer/Helper/ContentHelper.php +++ b/Classes/Renderer/Helper/ContentHelper.php @@ -23,6 +23,7 @@ namespace Fr\Typo3Handlebars\Renderer\Helper; +use Fr\Typo3Handlebars\Attribute; use Fr\Typo3Handlebars\Renderer; use Psr\Log; @@ -33,16 +34,17 @@ * @license GPL-2.0-or-later * @see https://github.com/shannonmoeller/handlebars-layouts#content-name-modeappendprependreplace */ -class ContentHelper implements HelperInterface +final readonly class ContentHelper implements HelperInterface { public function __construct( - protected readonly Log\LoggerInterface $logger, + private Log\LoggerInterface $logger, ) {} /** * @param array $options * @return string|bool */ + #[Attribute\AsHelper('content')] public function evaluate(string $name, array $options) { $data = $options['_this']; diff --git a/Classes/Renderer/Helper/ExtendHelper.php b/Classes/Renderer/Helper/ExtendHelper.php index 5d869885..0b9de3e0 100644 --- a/Classes/Renderer/Helper/ExtendHelper.php +++ b/Classes/Renderer/Helper/ExtendHelper.php @@ -23,6 +23,7 @@ namespace Fr\Typo3Handlebars\Renderer\Helper; +use Fr\Typo3Handlebars\Attribute; use Fr\Typo3Handlebars\Renderer; /** @@ -32,12 +33,13 @@ * @license GPL-2.0-or-later * @see https://github.com/shannonmoeller/handlebars-layouts#extend-partial-context-keyvalue- */ -class ExtendHelper implements HelperInterface +final readonly class ExtendHelper implements HelperInterface { public function __construct( - protected readonly Renderer\RendererInterface $renderer, + private Renderer\RendererInterface $renderer, ) {} + #[Attribute\AsHelper('extend')] public function evaluate(string $name): string { // Get helper options diff --git a/Classes/Renderer/Helper/RenderHelper.php b/Classes/Renderer/Helper/RenderHelper.php index 1ebfccd4..d4d5c164 100644 --- a/Classes/Renderer/Helper/RenderHelper.php +++ b/Classes/Renderer/Helper/RenderHelper.php @@ -23,6 +23,7 @@ namespace Fr\Typo3Handlebars\Renderer\Helper; +use Fr\Typo3Handlebars\Attribute; use Fr\Typo3Handlebars\DataProcessing; use Fr\Typo3Handlebars\Exception; use Fr\Typo3Handlebars\Renderer; @@ -37,17 +38,18 @@ * @license GPL-2.0-or-later * @see https://github.com/frctl/fractal/blob/main/packages/handlebars/src/helpers/render.js */ -class RenderHelper implements HelperInterface +final readonly class RenderHelper implements HelperInterface { public function __construct( - protected readonly Renderer\RendererInterface $renderer, - protected readonly Core\TypoScript\TypoScriptService $typoScriptService, - protected readonly Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer, + private Renderer\RendererInterface $renderer, + private Core\TypoScript\TypoScriptService $typoScriptService, + private Frontend\ContentObject\ContentObjectRenderer $contentObjectRenderer, ) {} /** * @throws Exception\InvalidConfigurationException */ + #[Attribute\AsHelper('render')] public function evaluate(string $name): SafeString { // Get helper options diff --git a/Classes/Renderer/Helper/VarDumpHelper.php b/Classes/Renderer/Helper/VarDumpHelper.php index 44011c77..abd60f41 100644 --- a/Classes/Renderer/Helper/VarDumpHelper.php +++ b/Classes/Renderer/Helper/VarDumpHelper.php @@ -23,8 +23,8 @@ namespace Fr\Typo3Handlebars\Renderer\Helper; -use Fr\Typo3Handlebars\Attribute\AsHelper; -use TYPO3\CMS\Core\Utility\DebugUtility; +use Fr\Typo3Handlebars\Attribute; +use TYPO3\CMS\Core; /** * VarDumpHelper @@ -32,17 +32,17 @@ * @author Elias Häußler * @license GPL-2.0-or-later */ -class VarDumpHelper implements HelperInterface +final readonly class VarDumpHelper implements HelperInterface { /** * @param array $context */ - #[AsHelper('varDump')] + #[Attribute\AsHelper('varDump')] public static function evaluate(array $context): string { \ob_start(); - DebugUtility::debug($context['_this']); + Core\Utility\DebugUtility::debug($context['_this']); return (string)\ob_get_clean(); }