Skip to content

Commit 667d590

Browse files
committed
[symfony#3241] Minor tweaks to new expression language functions
1 parent 240df84 commit 667d590

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

components/expression_language/extending.rst

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ Extending the ExpressionLanguage
55
================================
66

77
The ExpressionLanguage can be extended by adding custom functions. For
8-
instance, in the framework, the security has custom functions to check the
9-
user's role.
8+
instance, in the Symfony Framework, the security has custom functions to check
9+
the user's role.
1010

1111
.. note::
1212

1313
If you want to learn how to use functions in an expression, read
1414
":ref:`component-expression-functions`".
1515

16-
Register Functions
17-
------------------
16+
Registering Functions
17+
---------------------
1818

19-
Functions will be registered on the current ``ExpressionLanguage`` instance.
19+
Functions are registered on each specific ``ExpressionLanguage`` instance.
2020
That means the functions can be used in any expression executed by that
2121
instance.
2222

@@ -52,13 +52,12 @@ This method has 3 arguments:
5252
5353
This will print ``hello``.
5454

55-
Creating a new ExpressionLanguage class
55+
Creating a new ExpressionLanguage Class
5656
---------------------------------------
5757

5858
When you use the ``ExpressionLanguage`` class in your library, it's recommend
5959
to create a new ``ExpressionLanguage`` class and register the functions there.
60-
The class will execute ``registerFunctions`` to register the default
61-
functions, you can override this to also add your own functions::
60+
Override ``registerFunctions`` to add your own functions::
6261

6362
namespace Acme\AwesomeLib\ExpressionLanguage;
6463

components/expression_language/syntax.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Working with Functions
8888

8989
You can also use registered functions in the expression by using the same
9090
syntax as PHP and JavaScript. The ExpressionLanguage component comes with one
91-
function by default: ``constant()`` Which will return the value of the PHP
91+
function by default: ``constant()``, which will return the value of the PHP
9292
constant::
9393

9494
define('DB_USER', 'root');
@@ -101,7 +101,7 @@ This will print ``root``.
101101

102102
.. tip::
103103

104-
To read how to register your own function to use in an expression, see
104+
To read how to register your own functions to use in an expression, see
105105
":doc:`/components/expression_language/extending`".
106106

107107
.. _component-expression-arrays:
@@ -285,7 +285,7 @@ For example::
285285
);
286286

287287
This will evaluate to ``true``, because ``user.age`` is in the range from
288-
``18`` till ``45``
288+
``18`` to ``45``.
289289

290290
Ternary Operators
291291
~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)