-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Do not hide unnecessary escape characters #4199
Conversation
I don't think the integration test failure is related to this PR. |
this needs some changelog entry |
CHANGELOG
Outdated
@@ -7,6 +7,7 @@ | |||
* Change the compilation of `for` loops to throw an exception when a `loop.*` variable is not defined | |||
* Make `Environment::getGlobals()` private | |||
* Drop support for PHP < 8.2 | |||
* Unnecessary escape characters are no longer ignored |
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.
I'm not sure I understand the meaning. Can you clarify?
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.
I don't know how to explain it better.
Doing App\Test
tries to escape T which is unnecessary. In v3 this escape \
is ignored and reported as deprecation. In v4 it's no longer ignored, and results in a literal \
. That means that App\Test
will show up as App\Test
as you expect.
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.
Maybe something like this, as it will be hard to explain simply with a short sentence ?
* Change tokenisation of escape sequence in strings
Before::
// ...
{# foo equals "FooBar" #}
After:
//
{# foo equals "Foo\Bar" #}
As example I would probably use a function call (instead of a print expression for instance), to support the idea it's a lexer thing and thus is not related to how context vars are printed.. wdyt ?
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.
Or maybe just "Escape characters are no longer ignored".
CHANGELOG
Outdated
@@ -7,6 +7,7 @@ | |||
* Change the compilation of `for` loops to throw an exception when a `loop.*` variable is not defined | |||
* Make `Environment::getGlobals()` private | |||
* Drop support for PHP < 8.2 | |||
* Unnecessary escape characters are no longer ignored |
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.
Or maybe just "Escape characters are no longer ignored".
This PR was merged into the 3.x branch. Discussion ---------- Improve deprecation message See #4199 (comment) /cc `@stof` `@fabpot` Commits ------- 9010792 Improve deprecation message
Thank you @ruudk. |
Follow up of #4176, #4123 and #2712.
Now that we have deprecated unnecessary escape in v3, we can change the behavior in v4.
With this change, unnecessary will no longer be ignored, but handled like any other character.
This allows for writing fully qualified class names like this:
Instead of having to escape the
\
in v3:/cc @fabpot @stof