-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Yaml] added ability for substitute aliases when mapping is on single line #25043
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
Q | A |
---|---|
Branch? | 2.7 |
Bug fix? | yes |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #11569 |
License | MIT |
Doc PR |
// But overwriting is allowed when a merge node is used in current block. | ||
if ('<<' === $key) { | ||
$output += $value; | ||
} elseif ($allowOverwrite || !isset($output[$key])) { |
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.
These conditions are a bit hard to understand because above you have this: if ('<<' === $key) { $allowOverwrite = true; }
. So, if('<<' === $key)
and if($allowOverwrite)
are interchangeable and this if ... elseif
is a bit confusing.
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.
This part is executed several times (for each entry in the mapping). So $allowOverwrite
can be true
in a subsequent iteration where $key
is different from <<
.
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.
@javiereguiluz Is there still anything you would like to see changed?
Thank you @xabbuh. |
…s on single line (Michał Strzelecki, xabbuh) This PR was merged into the 2.7 branch. Discussion ---------- [Yaml] added ability for substitute aliases when mapping is on single line | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #11569 | License | MIT | Doc PR | Commits ------- dd26c80 substitute aliases in inline mappings 675a3fe added ability for substitute aliases when mapping in YAML is on single line