From 6d9af3764a0bb652d19cda24f78f8e02395a8f9f Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 21 Feb 2017 11:11:34 +0100 Subject: [PATCH 1/6] Add fromPhp tip --- components/expression_language/extending.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index eeb9963c6c6..54360aa3adb 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -90,6 +90,17 @@ register. } } +.. tip:: + + You can create an expression expression from a PHP function with the + :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction::fromPhp` static method:: + + ExpressionFunction::fromPhp('strtoupper'); + + It allows namespaced PHP function where second parameter must be set to name expression:: + + ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'); + You can register providers using :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::registerProvider` or by using the second argument of the constructor:: From c70ea7fcffeb6f8a47327d764926d4ba86e33b63 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 21 Feb 2017 11:16:19 +0100 Subject: [PATCH 2/6] Fix typo --- components/expression_language/extending.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index 54360aa3adb..95cda35bc6f 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -92,12 +92,12 @@ register. .. tip:: - You can create an expression expression from a PHP function with the + You can create an expression function from a PHP function with the :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction::fromPhp` static method:: ExpressionFunction::fromPhp('strtoupper'); - It allows namespaced PHP function where second parameter must be set to name expression:: + It allows namespaced PHP function where second parameter must be defined to name expression:: ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'); From 6c9e09d36ee83c478915ac78a5bcb1bd3037b9d0 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 21 Feb 2017 17:20:54 +0100 Subject: [PATCH 3/6] Fix typo --- components/expression_language/extending.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index 95cda35bc6f..d4db5b699c0 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -97,7 +97,7 @@ register. ExpressionFunction::fromPhp('strtoupper'); - It allows namespaced PHP function where second parameter must be defined to name expression:: + It allows namespaced PHP function where the second parameter must be defined to name expression:: ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'); From 059155f187be179540d679fc22cfb641e3bd0c1d Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 21 Feb 2017 18:45:59 +0100 Subject: [PATCH 4/6] Add versionadded --- components/expression_language/extending.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index d4db5b699c0..01923141ecd 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -101,6 +101,9 @@ register. ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'); + .. versionadded:: 3.3 + The ``ExpressionFunction::fromPhp()`` method was introduced in Symfony 3.3. + You can register providers using :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::registerProvider` or by using the second argument of the constructor:: From 478400a2f8b7b60e20c54f559e74a8b0a9ebe43a Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 22 Feb 2017 10:02:17 +0100 Subject: [PATCH 5/6] Minor reword --- components/expression_language/extending.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index 01923141ecd..6ff6c3dd355 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -97,7 +97,8 @@ register. ExpressionFunction::fromPhp('strtoupper'); - It allows namespaced PHP function where the second parameter must be defined to name expression:: + Namespaced functions are supported, but they require a second argument to + define the name of the expression:: ExpressionFunction::fromPhp('My\strtoupper', 'my_strtoupper'); From 415c4ec70ca34c5d23d2e46b3ff2c36e1dc14245 Mon Sep 17 00:00:00 2001 From: Dany Maillard Date: Tue, 28 Feb 2017 07:59:18 +0100 Subject: [PATCH 6/6] Update extending.rst --- components/expression_language/extending.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index 6ff6c3dd355..20a6aa9e188 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -92,7 +92,7 @@ register. .. tip:: - You can create an expression function from a PHP function with the + To create an expression function from a PHP function with the :method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction::fromPhp` static method:: ExpressionFunction::fromPhp('strtoupper');