Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[ExpressionLanguage] Fix null-safe chaining#46454

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:6.1fromHypeMC:expression-nullsafe-chaining
May 27, 2022

Conversation

@HypeMC
Copy link
Member

@HypeMCHypeMC commentedMay 25, 2022
edited
Loading

QA
Branch?6.1
Bug fix?yes
New feature?no
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

Currently the null-safe operator in the expression language doesn't behave the same as in PHP. According to theRFC:

When the evaluation of one element in the chain fails the execution of the entire chain is aborted and the entire chain evaluates to null.

For example, in PHP the following expressions willreturnnull:

$foo =null;$foo?->bar['baz'];$foo?->bar['baz']['qux'];$foo?->bar['baz']['qux']->quux;$foo?->bar['baz']['qux']->quux();

This, however, is not the case with the null-safe operator in the expression language where the evaluation for such cases fails.

Not sure if this qualifies as a bug fix or a feature, so please let me know.

Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

definitely a bugfix to me

OskarStark reacted with thumbs up emoji
@HypeMCHypeMCforce-pushed theexpression-nullsafe-chaining branch fromb958c52 toe8479f9CompareMay 25, 2022 08:17
@HypeMC
Copy link
MemberAuthor

Made one minor change, I think it makes te code more readableee94071

@fabpot
Copy link
Member

Thank you@HypeMC.

@fabpotfabpotforce-pushed theexpression-nullsafe-chaining branch fromd2f24e0 toa39c25cCompareMay 27, 2022 06:38
@fabpotfabpot merged commit1b0cb41 intosymfony:6.1May 27, 2022
@HypeMCHypeMC deleted the expression-nullsafe-chaining branchMay 27, 2022 07:07
@fabpotfabpot mentioned this pull requestMay 27, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas approved these changes

+1 more reviewer

@HeahDudeHeahDudeHeahDude left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

6.1

Development

Successfully merging this pull request may close these issues.

5 participants

@HypeMC@fabpot@nicolas-grekas@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp