Skip to content

WordPress-Extra: remove the Generic.Functions.CallTimePassByReference sniff#2536

Merged
GaryJones merged 1 commit intoWordPress:developfrom
rodrigoprimo:remove-call-time-pass-by-reference-sniff
Jun 24, 2025
Merged

WordPress-Extra: remove the Generic.Functions.CallTimePassByReference sniff#2536
GaryJones merged 1 commit intoWordPress:developfrom
rodrigoprimo:remove-call-time-pass-by-reference-sniff

Conversation

@rodrigoprimo
Copy link
Copy Markdown
Contributor

@rodrigoprimo rodrigoprimo commented Jun 23, 2025

The Generic.Functions.CallTimePassByReference sniff was deprecated in PHPCS 3.13.0, and will be removed in PHPCS 4.0.

In this PR, I suggested that we remove it from WPCS. Removing this sniff from WordPress-Extra will be necessary anyway when preparing this repository for PHPCS 4.0, and I believe it is something that can be done now as call-time pass-by-reference was deprecated in PHP 5.3 and removed in PHP 5.4.

PHP 5.4 was released in 2012, with the last security release in 2015. So it is unlikely users are still relying on it, and even if they are, there is a PHPCompatibility sniff to check for the use of call-time pass-by-reference: PHPCompatibility.Syntax.ForbiddenCallTimePassByReference.

This sniff was added to WordPress-Extra via #382 back in 2015.

Closes #2528

…e` sniff

The `Generic.Functions.CallTimePassByReference` sniff was deprecated in PHPCS 3.13.0 and will be removed in PHPCS 4.0 (PHPCSStandards/PHP_CodeSniffer#921).

Removing this sniff from WordPress-Extra will be necessary anyway when preparing this repository for PHPCS 4.0, and I believe it is something that can be done now as call-time pass-by-reference was deprecated in PHP 5.3 (https://web.archive.org/web/20150920055013/http://us1.php.net/manual/en/migration53.deprecated.php) and removed in PHP 5.4 (https://web.archive.org/web/20140815142840/http://us2.php.net/manual/en/migration54.incompatible.php). PHP 5.4 was released in 2012, with the last security release in 2015. So it is unlikely users are still relying on it, and even if they are, there is a PHPCompatibility sniff to check for the use of call-time pass-by-reference: PHPCompatibility.Syntax.ForbiddenCallTimePassByReference (https://github.com/PHPCompatibility/PHPCompatibility/blob/9013cd039fe5740953f9fdeebd19d901b80e26f2/PHPCompatibility/Sniffs/Syntax/ForbiddenCallTimePassByReferenceSniff.php#L128).

This sniff was added to WordPress-Extra via WordPress#382 back in 2015.
Copy link
Copy Markdown
Member

@jrfnl jrfnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @rodrigoprimo !

Regarding whether this can go in a minor or MUST go into a major: I consider this a ruleset update, not a (code) "Removal" which MUST go into a major per SemVer, so I think we should be okay to include this change in a minor release.

@GaryJones GaryJones merged commit 2004209 into WordPress:develop Jun 24, 2025
40 checks passed
@rodrigoprimo rodrigoprimo deleted the remove-call-time-pass-by-reference-sniff branch July 22, 2025 16:32
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.

Generic.Functions.CallTimePassByReference deprecation notice with PHP_CodeSniffer 3.13.0

4 participants