-
-
Notifications
You must be signed in to change notification settings - Fork 492
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Attribute classes. #2486
Comments
Attribute classes are classes, so there is no reason to differentiate these. |
@jrfnl Thanks anyways, I guess you know better. |
Please check the WordPress PHP Coding Standards documentation about naming. |
Essentially, it's history. When the naming decision was made for WordPress, classes were used, but interfaces (added in PHP 5.0) were not. Likewise, since PHP supported (and supports) PHP < 8.1.0, then Enum's can't be used, so there's been no decision on file naming for them either. There have been some posts that attempt to modernise the documented standards so that, for those who have a higher level of minimum support PHP and can use new items, they know what the convention would be, but file naming of enums, interfaces, traits, etc. have not been agreed upon, so we can implement anything in WordPressCS for them. If your application does make heavy use of attribute classes, enums, interfaces, etc. then feel free to go ahead and ignore the WordPressCS in this area. Indeed, many use PSR-4 (which then gets away from the application logic being coupled to/ reflected in the file-naming structure), even if they follow the rest of WordPress Coding Standards. |
WordPress-Coding-Standards/WordPress/Sniffs/Files/FileNameSniff.php
Line 257 in 7f76630
Files name, with classes that are attributes, should start with
attribute-
instead ofclass-
.Or at least it shouldn't register an error when a file contains an attribute class, but the name doesn't start with
class-
.The text was updated successfully, but these errors were encountered: