Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[PropertyAccess] Add nullsafe operator support#34497
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
[PropertyAccess] Add nullsafe operator support#34497
Uh oh!
There was an error while loading.Please reload this page.
Conversation
908618f to66f5307CompareUh oh!
There was an error while loading.Please reload this page.
b22389d tobd0de68Compareoliverde8 commentedNov 24, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I have updated the the Pull Requests; the unit tests are updated as well. I can update the documentation but before that I would like to know if the feature will be kept. Regards, Edit: There are errors with the ci's but other Pull Request seems to have the same issue with "already" existing table errors. |
src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
bd0de68 to30a80a3Compare30a80a3 to79b2fa1Compare
nicolas-grekas left a comment
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 "nullable" is a better wording for this? or "nullsafe"?
I had to open the RFC to get what "optional" was about.
| * | ||
| * @throws Exception\OutOfBoundsException If the offset is invalid | ||
| */ | ||
| publicfunctionisOptional(int$index); |
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.
Missing return type.
Note that adding a new method on an existing interface is a BC break.
We use@method annotations in similar cases. See branch 4.4 for examples.
oliverde8Sep 16, 2020 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
Did it,
just when I am using it shouldn't I trigger a deprecation if the method is not set?
I found this example in the 4.4 branch and it's not present:https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php#L120
fabpot commentedAug 11, 2020
@oliverde8 Still interested in finishing this PR? |
oliverde8 commentedAug 11, 2020
I missed nicolas-grekas last comment, I will do the changes this weekend. sorry about that. |
src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
5236eb4 to759432cCompare759432c to4996cd3Compare…nal-property-access# Conflicts:#src/Symfony/Component/PropertyAccess/PropertyAccessor.php
8ec7c15 tof1630f0Compare| if (method_exists($propertyPath,'isNullSafe')) { | ||
| // To be removed in symfony 6 once we are sure isNullSafe is always implemented. | ||
| $isNullSafe =$propertyPath->isNullSafe($i); | ||
| } |
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 think we need to add anelse clause here to raise a deprecation notice to help people with upgrading their code.
fabpot commentedOct 7, 2020
We've just moved away from |
…s (fsoedjede)This PR was merged into the 6.2 branch.Discussion----------[Form][PropertyAccess] Allow optional property accesses| Q | A| ------------- | ---| Branch? | 6.2| Bug fix? | no| New feature? | yes <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets |Fix#34483 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->| License | MIT| Doc PR |symfony/symfony-docs#17288 <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix.This will help reviewers and should be a good start for the documentation.Additionally (seehttps://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should followhttps://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (seehttps://symfony.com/bc).-->This PR is basically a copy of#34497 with some minor changes.I needed it and I have some time now to help advance in implementing it.**TODO**- [x] Add nullsafe operator usage- [x] Update unit test- [x] Update documentationRegardsCommits-------6455feb feature#34483 - Allow optional property accesses
Uh oh!
There was an error while loading.Please reload this page.
TODO: