TYPO3 / Fluid

Fluid template rendering engine - Standalone version
GNU Lesser General Public License v3.0
153 stars 93 forks source link

[TASK] Add more type hints #939

Closed s2b closed 1 month ago

s2b commented 1 month ago

This patch adds more type hints to selected classes. For classes that are probably extended by Fluid integrations, we don't implement all return type hints to prevent hard-breaking existing functionality. In addition to careful consideration when adding the types, this is verified by running the changes against TYPO3 Core CI to catch any unwanted breaking changes. Some @todo lines have been added to interfaces that are user-facing functionality and thus will get return types with Fluid v5.

This patch also clarifies return types of ViewHelpers and functions that pass along those values. In some areas, the existing PHPDOC annotations were incorrect here because they didn't properly account for the fact that a ViewHelper can return any type, not just a string, as long as its either stringable or will be directly used by another ViewHelper that can take that type as an input value.