Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 086885b

Browse filesBrowse files
committed
Applied comments
1 parent ef4ca42 commit 086885b
Copy full SHA for 086885b

File tree

Expand file treeCollapse file tree

2 files changed

+16
-9
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-9
lines changed

‎components/expression_language/extending.rst

Copy file name to clipboardExpand all lines: components/expression_language/extending.rst
+12-5Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ an ``arguments`` variable as their first argument, which is equal to the
5151
second argument to ``evaluate()`` or ``compile()`` (e.g. the "values" when
5252
evaluating or the "names" if compiling).
5353

54+
.. _components-expression-language-provider:
55+
5456
Using Expression Providers
5557
--------------------------
5658

@@ -63,9 +65,10 @@ creating a class that implements
6365
:class:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface`.
6466

6567
This interface requires one method:
66-
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface::getFunctions`.
67-
This method returns an array of expression functions (instances of
68-
:class:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction`) to register.
68+
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface::getFunctions`,
69+
which returns an array of expression functions (instances of
70+
:class:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction`) to
71+
register.
6972

7073
.. code-block:: php
7174
@@ -94,8 +97,12 @@ or by using the second argument of the constructor::
9497
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
9598

9699
// using the constructor
97-
$language = new ExpressionLanguage(null, array(...));
100+
$language = new ExpressionLanguage(null, array(
101+
new StringExpressionLanguageProvider(),
102+
// ...
103+
));
98104

105+
// using registerProvider()
99106
$language->registerProvider(new StringExpressionLanguageProvider());
100107

101108
.. tip::
@@ -111,7 +118,7 @@ or by using the second argument of the constructor::
111118
public function __construct(ParserCacheInterface $parser = null, array $providers = array())
112119
{
113120
// prepend the default provider to let users override it easily
114-
array_unshift($providers, new MyExpressionLanguageProvider());
121+
array_unshift($providers, new StringExpressionLanguageProvider());
115122

116123
parent::__construct($parser, $providers);
117124
}

‎reference/dic_tags.rst

Copy file name to clipboardExpand all lines: reference/dic_tags.rst
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,10 +893,10 @@ routing.expression_language_provider
893893
894894
**Purpose**: Register a provider for expression language functions in routing
895895
896-
This tag is used to automatically register :ref:`expression function providers
897-
<components-expression-language-provider>` for the routing expression
898-
component. Using these providers, you can add custom functions to the routing
899-
expression language.
896+
This tag is used to automatically register
897+
:ref:`expression function providers <components-expression-language-provider>`
898+
for the routing expression component. Using these providers, you can add custom
899+
functions to the routing expression language.
900900
901901
security.expression_language_provider
902902
-------------------------------------

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.