8000 [ExpressionLanguage] Add more parameter types by derrabus · Pull Request #33196 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[ExpressionLanguage] Add more parameter types #33196

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Symfony/Component/ExpressionLanguage/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(array $functions)
$this->functions = $functions;
}

public function getFunction($name)
public function getFunction(string $name)
{
return $this->functions[$name];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function compile(Compiler $compiler)
$compiler->raw(']');
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
$result = [];
foreach ($this->getKeyValuePairs() as $pair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function compile(Compiler $compiler)
;
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
$operator = $this->attributes['operator'];
$left = $this->nodes['left']->evaluate($functions, $values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function compile(Compiler $compiler)
;
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
if ($this->nodes['expr1']->evaluate($functions, $values)) {
return $this->nodes['expr2']->evaluate($functions, $values);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function compile(Compiler $compiler)
$compiler->repr($this->attributes['value']);
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
return $this->attributes['value'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function compile(Compiler $compiler)
$compiler->raw($function['compiler'](...$arguments));
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
$arguments = [$values];
foreach ($this->nodes['arguments']->nodes as $node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function compile(Compiler $compiler)
}
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
switch ($this->attributes['type']) {
case self::PROPERTY_CALL:
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/ExpressionLanguage/Node/NameNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function compile(Compiler $compiler)
$compiler->raw('$'.$this->attributes['name']);
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
return $values[$this->attributes['name']];
}
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/ExpressionLanguage/Node/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function compile(Compiler $compiler)
}
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
$results = [];
foreach ($this->nodes as $node) {
Expand All @@ -90,7 +90,7 @@ public function dump()
return $dump;
}

protected function dumpString($value)
protected function dumpString(string $value)
{
return sprintf('"%s"', addcslashes($value, "\0\t\"\\"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function compile(Compiler $compiler)
;
}

public function evaluate($functions, $values)
public function evaluate(array $functions, array $values)
{
$value = $this->nodes['node']->evaluate($functions, $values);
switch ($this->attributes['operator']) {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/ExpressionLanguage/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function getPrimary()
return $this->parsePrimaryExpression();
}

protected function parseConditionalExpression($expr)
protected function parseConditionalExpression(Node\Node $expr)
{
while ($this->stream->current->test(Token::PUNCTUATION_TYPE, '?')) {
$this->stream->next();
Expand Down Expand Up @@ -299,7 +299,7 @@ public function parseHashExpression()
return $node;
}

public function parsePostfixExpression($node)
public function parsePostfixExpression(Node\Node $node)
{
$token = $this->stream->current;
while (Token::PUNCTUATION_TYPE == $token->type) {
Expand Down
0