Skip to content

Commit c09eacc

Browse files
committed
minor #15172 [Validator] Add warning about closure not being cachable (Nyholm)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- [Validator] Add warning about closure not being cachable Follow up from symfony/symfony#40645 The annotation cache will not work with `Closure`. If I understand correctly, it is not possible to have external dependencies in your custom validator AND get your annotation cached. You have to chose one or the other. Commits ------- ebddb78 [Validator] Add warning about closure not being cachable
2 parents d5c349e + ebddb78 commit c09eacc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

reference/constraints/Callback.rst

+7
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ constructor of the Callback constraint::
251251
}
252252
}
253253

254+
.. warning::
255+
256+
Using a ``Closure`` together with annotation configuration will disable the
257+
annotation cache for that class/property/methods because ``Closure``s cannot
258+
be cached. For best performance, it is recommended to use a static callback
259+
method.
260+
254261
Options
255262
-------
256263

0 commit comments

Comments
 (0)