Skip to content

Commit

Permalink
[TASK] Deprecate CompileWithRenderStatic and renderStatic() (#990)
Browse files Browse the repository at this point in the history
Both the trait `CompileWithRenderStatic` and ViewHelpers implementing
`renderStatic()` without using one of the deprecated traits will be deprecated
with Fluid v4 and will no longer work with v5.

ViewHelpers should use `render()` as their primary rendering method.

Related: #983
  • Loading branch information
s2b authored Aug 25, 2024
1 parent 8dcb96a commit dd6201e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
7 changes: 7 additions & 0 deletions Documentation/Changelog/2.x.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@ Changelog 2.x
2.15
----

* Deprecation: Trait :php:`TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic`
has been marked as deprecated. It will log a deprecation level error message when called in
Fluid v4. It will be removed in Fluid v5.
* Deprecation: Trait :php:`TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic`
has been marked as deprecated. It will log a deprecation level error message when called in
Fluid v4. It will be removed in Fluid v5.
* Deprecation: Static method :php:`renderStatic()` on ViewHelpers that don't use :php:`TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic`
or :php:`TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic`
have been marked as deprecated. They will log a deprecation level error message when called in
Fluid v4. `renderStatic()` will no longer be called in Fluid v5.
* Deprecation: Variable names `true`, `false` and `null` will log a deprecation level error message because these
identifiers will become a Fluid language feature with v4.

Expand Down
4 changes: 4 additions & 0 deletions src/Core/ViewHelper/AbstractViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,10 @@ public function compile($argumentsName, $closureName, &$initializationPhpCode, V
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
* @deprecated renderStatic() on ViewHelpers will still be called in v4, but will log a
* deprecation level error message. It will no longer be called in v5.
* This concrete fallback implementation in AbstractViewHelper will be removed
* with v4.
*/
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
* argument is specified and not empty.
*
* @deprecated Will be removed in v5. No longer necessary since getContentArgumentName() has been
* integrated into AbstractViewHelper with v2.15. Name has to be specified explicitly by overriding the
* method, implicit definition (= first optional argument) is no longer supported.
* integrated into AbstractViewHelper with v2.15. Name has to be specified explicitly
* by overriding the method, implicit definition (= first optional argument) is no
* longer supported.
*/
trait CompileWithContentArgumentAndRenderStatic
{
Expand Down
3 changes: 3 additions & 0 deletions src/Core/ViewHelper/Traits/CompileWithRenderStatic.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* Provides default methods for rendering and compiling
* any ViewHelper that conforms to the `renderStatic`
* method pattern.
*
* @deprecated Will be removed in v5. The non-static render() method
* should be used instead
*/
trait CompileWithRenderStatic
{
Expand Down

0 comments on commit dd6201e

Please sign in to comment.