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

Skip to content

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

Merged
merged 1 commit into from
Nov 24, 2017

Conversation

weaverryan
Copy link
Member

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 :)

@nicolas-grekas
Copy link
Member

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".'));
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.)

@weaverryan weaverryan changed the base branch from 4.0 to 3.4 November 24, 2017 00:53
@weaverryan
Copy link
Member Author

Target branch changed!

@chalasr chalasr added this to the 3.4 milestone Nov 24, 2017
@@ -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".'));
Copy link
Member

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".

Copy link
Member

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 ;) )

@weaverryan
Copy link
Member Author

Changes made!

@fabpot
Copy link
Member

fabpot commented Nov 24, 2017

@weaverryan Can you rebase?

@weaverryan
Copy link
Member Author

Rebased. Sorry - I rebased locally... and did a bad job. Looks better now

@fabpot
Copy link
Member

fabpot commented Nov 24, 2017

Thank you @weaverryan.

@fabpot fabpot merged commit 3502020 into symfony:3.4 Nov 24, 2017
fabpot added a commit that referenced this pull request Nov 24, 2017
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
@weaverryan weaverryan deleted the expression-check branch November 24, 2017 18:59
This was referenced Nov 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants