Update AnnotationReader's metadata parser to use list of known ignored annotation #235
Update AnnotationReader's metadata parser to use list of known ignored annotation #235lcobucci merged 1 commit intodoctrine:masterfrom
Conversation
Ocramius
left a comment
There was a problem hiding this comment.
Requires test case additions, backing the OP claims.
Also needed:
- reword issue title to match changes
- reword commit message to contain detailed reasoning of changes
|
No problem, I'll add a test later. Meanwhile I'm open to suggestions about exact wording. |
|
@Ocramius please see if it is better now. |
Ocramius
left a comment
There was a problem hiding this comment.
Looking good. @doctrine/doctrinecore can you please also check?
| self::assertEmpty($reader->getPropertyAnnotations($class->getProperty('foo'))); | ||
| } | ||
|
|
||
| public function testGloballyIgnoredAnnotationNotIgnored() |
There was a problem hiding this comment.
I'm not sure how's that going in line with all other code in this file. Isn't it better to put these things aside? Like there's #177 which is supposed to do exactly what you're asking, but all over all code.
There was a problem hiding this comment.
@sanmai I understand your frustration here, these are cosmetic things and don't have much impact on the behaviour of the code. However we have an agreement among maintainers to try as much as possible to make sure our CS is applied everywhere, even when the project isn't following it properly (that's why we have automated incremental checks on ORM and DBAL, for example).
We haven't had the chance of applying the incremental checks here and modifying the entire code base is a bit too much (as explained in #177), hence my comments.
I'm sorry for the confusion and will completely understand if you decide to not apply the suggestions in the comments, I'm just trying to ensure that we (Doctrine team) follow our agreements. A maintainer is able to edit your commit on your fork (if you hadn't changed the option while creating the PR).
I hope you'll understand the motivation and I thank you for your contribution.
There was a problem hiding this comment.
Well, that's just me that spend a good amount of time to make sure that my code looks just like every other code, but if there's a consensus to write newer code in a more appropriate style, I'm good with that too. I'd change on my part but I'd like if these new guidelines would be somewhere, at least. Then anyone else wouldn't need to spend the time so useless as I did. Otherwise put, this discussion shouldn't have happen in the first place. Are we on the same page with this?
Also, all other folks now would need to review the thing again. Bummer.
There was a problem hiding this comment.
I'd change on my part but I'd like if these new guidelines would be somewhere, at least.
I believe that one is documented here: https://www.doctrine-project.org/projects/doctrine-coding-standard/en/latest/reference/index.html#project-level-ruleset ("Always add native types where possible")
There was a problem hiding this comment.
Well, that's not exactly obvious, what do you think? How am I supposed to find it?..
A link to these guidelines from the README.md, or even from CONTRIBUTING.md, would be best. Nevertheless, I will know better now, thanks.
There was a problem hiding this comment.
I think you're right! I might make PRs to change that if you do not beat me to it.
3eed959
…d annotation A parser used to collect parsing metadata basically ignores a known list of globally ignored annotation names, goes through loops checking annotations that do not need any checking. Let's fix that by communicating the list during initialization.
|
@sanmai @Ocramius @Majkl578 @greg0ire I've found an interesting thing while backporting this to Also interesting to mention it fails for Shall we mark it as an fix to v2.0 only? |
Relevant discussion: doctrine#235 (comment)
|
Actually I had this issue on a released version. Let me check what it was... |
Relevant discussion: doctrine#235 (comment)
A parser used to collect parsing metadata basically ignores a known list of globally ignored annotation names, goes through loops checking annotations that do not need any checking. Let's fix that by communicating the list during initialization.
E.g. these checks should not be evaluated for known ignored annotations:
annotations/lib/Doctrine/Annotations/DocParser.php
Lines 682 to 690 in 386d3bb
Please let me know if this change needs a test. One way to test is to rig an additional autoloader that would fail on attempt to load a class named as one of the commonly-ignored annotations like
@see.