Closed (duplicate)
Project:
Coder
Version:
8.3.x-dev
Component:
Coder Sniffer
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Jun 2022 at 23:21 UTC
Updated:
18 Apr 2023 at 12:19 UTC
Jump to comment: Most recent
Comments
Comment #2
andypostComment #3
andypostComment #4
andypostRelated issue is https://github.com/squizlabs/PHP_CodeSniffer/issues/3489
Comment #5
andypostThis is phpstan issue (
Comment #8
andypostThank you! It looks promising to allow checking core attributes
Comment #9
twodWow, you're fast hehe! I was just previewing the comment below:
I'm reopening this because it seems we can work around it in the sniffs.
Phpstan accepts this just fine so not sure why that was mentioned in #5.
I tested this with
squizlabs/php_codesniffer3.7.1 and now it correctly ignores attributes.(including multi-line attribute containers).
Whitespace errors are reported and fixable for newlines both before and after the attribute(s).
Comment #10
andypostNow it needs a sniff to warn about
#[\AllowDynamicProperties]attribute (we have in core for 5 classes atm) to catch itComment #11
andypostSince 3.6.3 phpcs works properly with attributes
https://github.com/squizlabs/PHP_CodeSniffer/issues/3448#event-5446855243
Comment #12
twodI could perhaps take a stab at adding that if it's not already in progress somewhere else, but would that not be a separate issue?
Comment #13
klausiThanks, updating PHPCS is a good idea, we can also set a new minimum version in our composer.json for the next release.
Please create a pull request against https://github.com/pfrenssen/coder so that we see our test cases run. Please also add a test case in ClassCommentUnitTest.inc so that we verify the fix.
Comment #15
klausiThis was already fixed at #3322615: `Drupal.Commenting.ClassComment.Missing` Appears when Using PHP 8 Class Attributes, closing as duplicate.