Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
adding checks for the expression language
  • Loading branch information
weaverryan committed Nov 24, 2017
commit 3502020834a401416c2c5d35e6ac6026d39fae72
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
break;
case 'expression':
if (!class_exists(Expression::class)) {
throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
}

$arguments[$key] = new Expression($arg->nodeValue);
break;
case 'collection':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ private function resolveServices($value, $file, $isParameter = false)
$value[$k] = $this->resolveServices($v, $file, $isParameter);
}
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
if (!class_exists(Expression::class)) {
throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
}

return new Expression(substr($value, 2));
} elseif (is_string($value) && 0 === strpos($value, '@')) {
if (0 === strpos($value, '@@')) {
Expand Down