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

Skip to content

Commit e17232d

Browse files
committed
adding checks for the expression language
1 parent 5b7dc49 commit e17232d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase =
488488
$arguments[$key] = new Reference($arg->getAttribute('id'), $invalidBehavior);
489489
break;
490490
case 'expression':
491+
if (!class_exists(Expression::class)) {
492+
throw new \LogicException(sprintf('The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
493+
}
494+
491495
$arguments[$key] = new Expression($arg->nodeValue);
492496
break;
493497
case 'collection':

src/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,10 @@ private function resolveServices($value, $file, $isParameter = false)
727727
$value[$k] = $this->resolveServices($v, $file, $isParameter);
728728
}
729729
} elseif (is_string($value) && 0 === strpos($value, '@=')) {
730+
if (!class_exists(Expression::class)) {
731+
throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".'));
732+
}
733+
730734
return new Expression(substr($value, 2));
731735
} elseif (is_string($value) && 0 === strpos($value, '@')) {
732736
if (0 === strpos($value, '@@')) {

0 commit comments

Comments
 (0)