-
Notifications
You must be signed in to change notification settings - Fork 189
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
Property and method modifier order #108
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention the readonly
keyword (PHP 8.1 properties) and property type declarations (PHP 7.4) somewhere in this section ? Or leave it for now until there is sight of a WP minimum PHP version bump ?
Or maybe we should split this into two paragraphs ?
- Properties (visibility, static, readonly, type)
- Methods (abstract/final, visibility, static)
If we add So we'd have:
@jrfnl @GaryJones any thoughts on this? |
I think this needs rebasing to be easier to review. |
d4cce1b
to
fbb5370
Compare
@GaryJones I've rebased it, should be easier to review now 🙂 |
We just discussed this and I agree, I think having a separate paragraph for each would be good. Though IMO that would mean four paragraphs:
|
5119442
to
cce5363
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed. I hope I caught everything.
Not sure we'd want to have the PHP #.#+
markings inline with the actual order rules, but there were some "if available"s, so either do it with all or don't do it with any of them and just let it be noted in the PHP info block.
I'd leave out the PHP comments in the brackets and just have the |
4381914
to
5bccf26
Compare
Co-authored-by: Juliette <[email protected]>
5bccf26
to
7f6c1c1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this could all be simplified down as per https://www.php-fig.org/psr/psr-12/#46-abstract-final-and-static, which says:
When present, the
abstract
andfinal
declarations MUST precede the visibility declaration.When present, the
static
declaration MUST come after the visibility declaration.
We'd need to add in readonly
, and types, but it seems that it could then be covered in just one or two code snippets.
I'm fine with having one code example covering all the things, we opted for splitting it into several paragraphs for easier maintenance. |
Leave only one code example, add bullet points for the info block.
@GaryJones I've made some changes based on the discussion I've had with Juliette:
Does this seem a bit more manageable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one small comment, other than that: LGTM!
Co-authored-by: Juliette <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
This PR depends on #107. Once that is merged, this PR should be rebased to the master branch.
The PR adds rules about the order of property and method modifiers and is the continuation of the additions of 'modern' PHP code in the WordPress PHP Coding Standards handbook based on the make post by Juliette Reinders Folmer.