Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6d9f61a

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [ExpressionLanguage] Mention parsing and linting add missing return statement
2 parents961d477 +50e5a0d commit6d9f61a

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

‎components/expression_language.rst‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,26 @@ can chain multiple coalescing operators.
9292
* ``foo[3] ?? 'no'``
9393
* ``foo.baz ?? foo['baz'] ?? 'no'``
9494

95+
Parsing and Linting Expressions
96+
...............................
97+
98+
The ExpressionLanguage component provides a way to parse and lint expressions.
99+
The:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::parse`
100+
method returns a:class:`Symfony\\Component\\ExpressionLanguage\\ParsedExpression`
101+
instance that can be used to inspect and manipulate the expression. The
102+
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionLanguage::lint`, on the
103+
other hand, returns a boolean indicating if the expression is valid or not::
104+
105+
use Symfony\Component\ExpressionLanguage\ExpressionLanguage;
106+
107+
$expressionLanguage = new ExpressionLanguage();
108+
109+
var_dump($expressionLanguage->parse('1 + 2'));
110+
// displays the AST nodes of the expression which can be
111+
// inspected and manipulated
112+
113+
var_dump($expressionLanguage->lint('1 + 2')); // displays true
114+
95115
Passing in Variables
96116
--------------------
97117

‎components/var_dumper.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ like this::
509509
$cloner = new VarCloner();
510510
$dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
511511

512-
$dumper->dump($cloner->cloneVar($var));
512+
return$dumper->dump($cloner->cloneVar($var));
513513
});
514514

515515
Cloners

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp