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

[PropertyAccess] Added isReadable() and isWritable()#10570

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 6 commits intosymfony:masterfromwebmozart:issue8659
Mar 31, 2014

Conversation

@webmozart
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?yes
Deprecations?no
Tests pass?yes
Fixed tickets#8659
LicenseMIT
Doc PRsymfony/symfony-docs#3729

This PR introduces BC breaks that are described in detail in the UPGRADE file. The BC breaks conform to our policy. They shouldn't affect many people, so I think we can safely do them.

Copy link
Member

Choose a reason for hiding this comment

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

missing[BC Break] prefix

Copy link
Member

Choose a reason for hiding this comment

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

hmm, sorry, no. This file documents only BC breaks, so not needed

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

We never have this prefix in the UPGRADE file.

@webmozart
Copy link
ContributorAuthor

TODO before merging this, I'll see whether the$value argument can be removed fromisWritable() for forward compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Imho UnexpectedTypeException is not semantically correct because its defined as RuntimeException but here it is clearly a LogicException. UnexpectedTypeException is correctly used for checks whether value in path is array or object. But we should destringuish these two cases.
So for this case here, we should instead throw a InvalidPropertyPathException and it should extend LogicException instead.
Currently all methods in AccessorInterface are missing phpdoc forInvalidPropertyPathException anyway which can be raised bynew PropertyPath($propertyPath).

Copy link
Contributor

Choose a reason for hiding this comment

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

Currently isReadable and isWriteable phpdoc are missing UnexpectedTypeException and InvalidPropertyPathException. With my suggestion above, only InvalidPropertyPathException could be raised.

To keep isWritable() and setValue() consistent, the exception thrown when onlyan adder was present, but no remover (or vice versa), was removed.
@webmozart
Copy link
ContributorAuthor

I removed the$value argument now. AnInvalidArgumentException is thrown when an invalid property path is given.

@Tobion
Copy link
Contributor

InvalidPropertyPathException should extend InvalidArgumentException (which is a tiny bc break). But otherwise we would need to add InvalidPropertyPathException too all phpdoc because InvalidPropertyPathException would not be convered since it extends a RuntimeException.

Copy link
Contributor

Choose a reason for hiding this comment

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

phpdocs of these methods are missing NoSuchIndexException. I would simply document the parent class of both: AccessException

@webmozart
Copy link
ContributorAuthor

But otherwise we would need to add InvalidPropertyPathException too all phpdoc because InvalidPropertyPathException would not be convered since it extends a RuntimeException.

Since strings can be constructed at runtime, it is indeed a RuntimeException. As such, I think it's fine not to document it.

This should be ready to merge now.

@Tobion
Copy link
Contributor

Huh, why not document it?
Everything could be constructed at runtime. The point is, that property path have a well-defined grammar, and errors could theoretically be detected at compile time. This is why I would say it's a logic exception.

@webmozart
Copy link
ContributorAuthor

You're right, but

errors could theoretically be detected at compile time

is not true:

new PropertyPath('path.'.$someDynamicValue);

The caller can't enforce that a property path (string) is correct (except by passing a PropertyPath instance), so this case is different than, for example, type errors, that can be prevented by using type checks or casting.

@Tobion
Copy link
Contributor

One can see it both ways. But it still needs to be documented.

fabpot added a commit that referenced this pull requestMar 31, 2014
…webmozart)This PR was merged into the 2.5-dev branch.Discussion----------[PropertyAccess] Added isReadable() and isWritable()| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | yes| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#8659| License       | MIT| Doc PR        |symfony/symfony-docs#3729This PR introduces BC breaks that are described in detail in the UPGRADE file. The BC breaks conform to our policy. They shouldn't affect many people, so I think we can safely do them.Commits-------f7fb855 [PropertyAccess] Added missing exceptions to phpdoc9aee2ad [PropertyAccess] Removed the argument $value from isWritable()4262707 [PropertyAccess] Fixed CS and added missing documentation6d2af21 [PropertyAccess] Added isReadable() and isWritable()20e6bf8 [PropertyAccess] Refactored PropertyAccessorCollectionTest0488389 [PropertyAccess] Refactored PropertyAccessorTest
@fabpotfabpot merged commitf7fb855 intosymfony:masterMar 31, 2014
Copy link
Member

Choose a reason for hiding this comment

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

this looks like a dead assignment

@webmozartwebmozart deleted the issue8659 branchApril 2, 2014 13:51
weaverryan added a commit to symfony/symfony-docs that referenced this pull requestApr 12, 2014
…dable() and isWritable() methods (webmozart)This PR was merged into the master branch.Discussion----------Added documentation for the new PropertyAccessor::isReadable() and isWritable() methods| Q             | A| ------------- | ---| Doc fix?      | no| New docs?     | yes (symfony/symfony#10570)| Applies to    | 2.5+| Fixed tickets | -Commits-------bb8e3ed Added documentation for the new PropertyAccessor::isReadable() and isWritable() methods
weaverryan added a commit to symfony/symfony-docs that referenced this pull requestMay 6, 2014
This PR was merged into the master branch.Discussion----------Property access tweaks| Q             | A| ------------- | ---| Doc fix?      | yes| New docs?     | no| Applies to    | 2.5+| Fixed tickets |#3729Hi guys!This follows after#3729 - it includes several small suggestions made by@wouterj and@xabbuh.Additionally, this removes the 3rd argument to `isWritable`, which was removed in the orignal PR (symfony/symfony#10570) and didn't make it into the final feature.Thanks!Commits-------fb9fe99 [#3729] Removing 3rd argument to isWritable - this doesn't exist in the final merged item319bf29 [#3729] Making minor changes thansk to@wouterj and@xabbuh.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@webmozart@Tobion@stof@fabpot

[8]ページ先頭

©2009-2025 Movatter.jp