-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Use render() as primary ViewHelper method (#983)
Until now it was best practice to differentiate between object-based ViewHelpers, using the object method `render()` as their primary render method, and static ViewHelpers, using the static method `renderStatic()`. This distinction has been introduced to Fluid mainly for performance reasons: With earlier PHP versions it was quite expensive performance-wise to create a new ViewHelper object for each ViewHelper call. However, PHP's performance characteristics for objects have changed quite a bit with newer versions, which questions the usefulness of this performance optimization nowadays. Our performance tests have shown that the performance gains are still existent today if you compare `renderStatic()` to `render()` ViewHelpers, especially if no further optimizations are applied to Fluid's core implementation. However, the impact is quite small and almost not measurable in real-world scenarios. In contrast to that, we see meaningful opportunities for the further development and optimization for Fluid if we streamline and simplify Fluid's APIs. It improves the developer experience if there's only one correct way to implement ViewHelpers and if all ViewHelpers use the same API. For Fluid internally, this opens up new opportunities of optimization and refactoring, which are currently not feasible to tackle. Ultimately, we have taken the decision to deprecate `renderStatic()` with Fluid v4. ViewHelpers should use `render()` as their primary render method from now on. This patch deprecates both the trait `CompileWithRenderStatic` and the usage of `renderStatic()` without any trait applied to the ViewHelper (which is probably only an edge case). Instead, the `ViewHelperInvoker` is called both for uncached and cached templates to initiate and perform each ViewHelper call. We will backport the `@deprecated` annotation on `CompileWithRenderStatic` to Fluid v2.15 to let users know in advance of this change. `AbstractConditionViewHelper` will be adjusted to this change in a follow-up patch. There will probably also be further code optimization patches that are made possible because of this decision, either still in Fluid v4 or later in Fluid v5, when `renderStatic()` will be removed completely.
- Loading branch information
Showing
9 changed files
with
57 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters