Skip to content

Conversation

rodrigoprimo
Copy link
Collaborator

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

@rodrigoprimo rodrigoprimo force-pushed the update-get-meta-single branch from 00496d4 to 2d204ca Compare October 16, 2025 13:13
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.
Copy link
Member

@dingo-d dingo-d left a 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
Copy link
Member

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.

Copy link
Collaborator Author

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.

@rodrigoprimo rodrigoprimo force-pushed the update-get-meta-single branch from 2f9ae1b to a09975d Compare October 17, 2025 11:29
*/
const METRIC_NAME = 'get_*meta() function called with $single parameter';

/**
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants