Skip to content

Commit 6d9af37

Browse files
committed
Add fromPhp tip
1 parent 89cba1e commit 6d9af37

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

components/expression_language/extending.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ register.
9090
}
9191
}
9292
93+
.. tip::
94+
95+
You can create an expression expression from a PHP function with the
96+
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction::fromPhp` static method::
97+
98+
ExpressionFunction::fromPhp('strtoupper');
99+
100+
It allows namespaced PHP function where second parameter must be set to name expression::
101+
102+
ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper');
103+
93104
You can register providers using
94105
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::registerProvider`
95106
or by using the second argument of the constructor::

0 commit comments

Comments
 (0)