-
-
Notifications
You must be signed in to change notification settings - Fork 521
WP/GetMetaSingle: simplify code using two class constants #2631
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
base: develop
Are you sure you want to change the base?
WP/GetMetaSingle: simplify code using two class constants #2631
Conversation
00496d4
to
2d204ca
Compare
Now that support for PHP < 7.2 has been dropped in PR 2614, we can simplify the sniff code by defining the two different function signature formats as class constants. This was not possible before as PHP < 5.6 did not support defining class constants as arrays.
2d204ca
to
e331fe6
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.
Just left one comment about the since tag.
* These functions use 'key' as the parameter name at position 2 and | ||
* 'single' as the parameter name at position 3. | ||
* | ||
* @since 3.2.0 |
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.
Is the since tag correct? 3.2.0 has been released already.
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.
Thanks for the review, @dingo-d!
Is the since tag correct? 3.2.0 has been released already.
Ops, my bad. It is fixed now.
2f9ae1b
to
a09975d
Compare
*/ | ||
const METRIC_NAME = 'get_*meta() function called with $single parameter'; | ||
|
||
/** |
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.
Can the order of these constants please be reversed ?
To me, the logical order would be to go from generic to more specific.
And even if that would be too arbitrary, we could use alphabetical order and that would still result in the same: the GENERIC_META_FUNCTIONS_FORMAT
first, the SPECIFIC_META_FUNCTIONS_FORMAT
constant second.
Description
Now that support for PHP < 7.2 has been dropped in PR #2614, we can simplify the sniff code by defining the two different function signature formats as class constants. This was not possible before, as PHP < 5.6 did not support defining class constants as arrays.
Suggested changelog entry
N/A