Skip to content

Commit

Permalink
minor #33196 [ExpressionLanguage] Add more parameter types (derrabus)
Browse files Browse the repository at this point in the history
This PR was merged into the 5.0-dev branch.

Discussion
----------

[ExpressionLanguage] Add more parameter types

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32179
| License       | MIT
| Doc PR        | N/A

Commits
-------

e378a7a [ExpressionLanguage] Add more parameter types.
  • Loading branch information
nicolas-grekas committed Aug 16, 2019
2 parents 90e3da4 + e378a7a commit 63b27f6
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Symfony/Component/ExpressionLanguage/Compiler.php
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
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
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
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
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
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
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
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
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
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
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 comments on commit 63b27f6

Please sign in to comment.