WordPress-Coding-Standards icon indicating copy to clipboard operation
WordPress-Coding-Standards copied to clipboard

Generic.Functions.CallTimePassByReference deprecation notice with PHP_CodeSniffer 3.13.0

Open mikemanger opened this issue 8 months ago • 2 comments

Using PHP_CodeSniffer 3.13.0 gives this warning:

-  Generic.Functions.CallTimePassByReference
   This sniff has been deprecated since v3.12.1 and will be removed in v4.0.0.

It looks like the functionality could be moved over to PHPCompatibility/PHPCompatibilityWP by using PHPCompatibility.Syntax.ForbiddenCallTimePassByReference.

More info here https://github.com/PHPCSStandards/PHP_CodeSniffer/issues/921

mikemanger avatar May 13 '25 13:05 mikemanger

@mikemanger Thanks for reporting this. We are aware of this, but to be honest, this is nothing to be concerned about.

Deprecation notices are advance notices of upcoming changes and in the mean time, everything will still work as expected.

In this case, the notice announces that the sniff will be removed in PHPCS 4.0, so that means that when WordPressCS is being made compatible with PHPCS 4.0, the sniff will need to be removed from the WordPressCS ruleset.

Until that time, this notice is nothing to be concerned about. If it annoys you, you can run PHPCS with the -q ("quiet") flag to not see it.

jrfnl avatar May 13 '25 13:05 jrfnl

@mikemanger It is possible to exclude the sniff from WordPress rules in your own phpcs.xml file. The warning will not be shown. But, of course, the sniff will be removed from the validation.

<rule ref="WordPress">
    <exclude name="Generic.Functions.CallTimePassByReference" />
</rule>

edpittol avatar May 15 '25 18:05 edpittol