Skip to content

[FEATURE] Annotations API (#1314)#1329

Merged
s2b merged 1 commit into4.6from
backport46
Feb 26, 2026
Merged

[FEATURE] Annotations API (#1314)#1329
s2b merged 1 commit into4.6from
backport46

Conversation

@s2b
Copy link
Copy Markdown
Contributor

@s2b s2b commented Feb 24, 2026

This patch introduces new data structures that represent annotations
for ViewHelpers/Components or their individual arguments. The purpose
is to be able to attach arbitrary information to definitions of
ViewHelpers/Components or arguments, either to pass them along as-is
or to react to them within Fluid. There are places within Fluid where
something like this already exists (e. g. XSD schema), and there are
multiple additional use cases for this, both by Fluid itself and by
third-party libraries that extend Fluid, for example:

  • Marking ViewHelpers/Components or individual arguments as deprecated
  • Collecting information for documentation from PhpDoc comments
  • Attaching additional validations/constraints to component arguments

In this first step, only the low-level API is provided, which
consists of interfaces and a generic implementation. Since this concept
is new to Fluid, the API is still classified as internal and might
change with future revisions.

Since the ArgumentDefinition needs to be written to Fluid's template
cache files, each annotation needs to implement the compile()
method, which returns the PHP code that re-creates the annotation object
when a template is read from cache.

This patch introduces new data structures that represent annotations
for ViewHelpers/Components or their individual arguments. The purpose
is to be able to attach arbitrary information to definitions of
ViewHelpers/Components or arguments, either to pass them along as-is
or to react to them within Fluid. There are places within Fluid where
something like this already exists (e. g. XSD schema), and there are
multiple additional use cases for this, both by Fluid itself and by
third-party libraries that extend Fluid, for example:

* Marking ViewHelpers/Components or individual arguments as deprecated
* Collecting information for documentation from PhpDoc comments
* Attaching additional validations/constraints to component arguments

In this first step, only the low-level API is provided, which
consists of interfaces and a generic implementation. Since this concept
is new to Fluid, the API is still classified as internal and might
change with future revisions.

Since the `ArgumentDefinition` needs to be written to Fluid's template
cache files, each annotation needs to implement the `compile()`
method, which returns the PHP code that re-creates the annotation object
when a template is read from cache.
@s2b s2b merged commit cbe01dc into 4.6 Feb 26, 2026
10 checks passed
@s2b s2b deleted the backport46 branch February 26, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants