- Issue created by @godotislate
- Status changed to Needs review
9 months ago 3:48pm 12 March 2024 - Status changed to Needs work
9 months ago 7:53pm 12 March 2024 - π¨πSwitzerland berdir Switzerland
> 3427388-update-drupalcomponentannotationdoctrinestaticreflectionparserhasclassattribute-to
This might be the longest branch name I've ever seen, certainly the longest "word" in a branch name ever ;)
I usually just put the class name and not full namespace in issue titles, but I don't know if that's an official/common thing or just me ;)
I think the one thing I'd like to see is that this doesn't trigger a class not found error. I think we can test that if we add something like #NonExistingAttribute on one of the test classes, should just ignore that then. I'm not 100% sure I understand the docs around is_a() and when it does trigger the classloader and when not.
This might be the longest branch name I've ever seen, certainly the longest "word" in a branch name ever ;)
I usually just put the class name and not full namespace in issue titles, but I don't know if that's an official/common thing or just me ;)
I have a habit of being as specific as possible, though there is no other StaticReflectionParser, so I really didn't need to. I regretted it once I saw the generated branch name.
I think the one thing I'd like to see is that this doesn't trigger a class not found error. I think we can test that if we add something like #NonExistingAttribute on one of the test classes, should just ignore that then. I'm not 100% sure I understand the docs around is_a() and when it does trigger the classloader and when not.
OK, that's what you meant before, because I saw there were tests cases for nonexistent attribute names, but it went the other way. Added a test case and class for that and pushed a commit. We'll see if PHPStan yells.
- Status changed to Needs review
9 months ago 8:51pm 12 March 2024 PHPStan didn't like the nonexistent class, but I set it to ignore that line, and we're green again.
- Status changed to Needs work
9 months ago 10:09pm 12 March 2024 - π¨πSwitzerland berdir Switzerland
Sometimes we also ignore files through core/phpstan.neon.dist, I guess either works, also plenty of examples using a comment. All of those use a @phpstan-ignore-next-line though, with comment above as we don't do same-line comments, so I'd suggest to adjust that here as well. Also works as a class dockblock, per example in core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php.
- Status changed to RTBC
9 months ago 10:16pm 12 March 2024 - π¨πSwitzerland berdir Switzerland
I wrote basically the exact same changes while trying to get π Convert entity type discovery to PHP attributes Needs review working again, @alexpott also +1'd the changes in Slack, so I think this is ready and unblocks several issues.
- π¬π§United Kingdom alexpott πͺπΊπ
Committed and pushed 0356ea590c to 11.x and 0be35cacd6 to 10.3.x and cbbdff7008 to 10.2.x. Thanks!
Backported to 10.2.x as this is a bugfix - something works with annotations that doesn't with attributes. It'll help contrib the earlier this is works correctly.
Nice test coverage!
-
alexpott β
committed cbbdff70 on 10.2.x
Issue #3427388 by godotislate, Berdir: Update Drupal\Component\...
-
alexpott β
committed cbbdff70 on 10.2.x
-
alexpott β
committed 0be35cac on 10.3.x
Issue #3427388 by godotislate, Berdir: Update Drupal\Component\...
-
alexpott β
committed 0be35cac on 10.3.x
- Status changed to Fixed
9 months ago 11:20am 13 March 2024 -
alexpott β
committed 0356ea59 on 11.x
Issue #3427388 by godotislate, Berdir: Update Drupal\Component\...
-
alexpott β
committed 0356ea59 on 11.x
Automatically closed - issue fixed for 2 weeks with no activity.