-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Adding checks for the expression language #25137
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
Conversation
3.4? |
@@ -488,6 +488,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('type="expression" cannot be used without the expression component. Try running "composer require symfony/expression-language".')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The symfony/
part is always optional when using Flex. Could we use composer require expression-language
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is inside a component, it feels too presumptive to put the Flex alias.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about:
The type="expression" attribute cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".
(we already use that ExpressionLanguage
name in other similar exceptions.)
0f13584
to
d6214f9
Compare
Target branch changed! |
@@ -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 expression component. Try running "composer require symfony/expression-language".')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(reminder: strings in double quotes are in bold in profiler panels ;) )
d6214f9
to
e17232d
Compare
Changes made! |
@weaverryan Can you rebase? |
e17232d
to
3502020
Compare
Rebased. Sorry - I rebased locally... and did a bad job. Looks better now |
Thank you @weaverryan. |
This PR was merged into the 3.4 branch. Discussion ---------- Adding checks for the expression language | Q | A | ------------- | --- | Branch? | 4.0 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | none | License | MIT | Doc PR | not needed If you try to use the expression syntax in DI, this will drastically improve the error message :) Commits ------- 3502020 adding checks for the expression language
If you try to use the expression syntax in DI, this will drastically improve the error message :)