WPTT / WPThemeReview

PHP_CodeSniffer rules (sniffs) to enforce WordPress theme review coding conventions
MIT License
207 stars 38 forks source link

PrefixAllGlobals: update method signature for compatibility with WPCS 2.2.0 #232

Closed jrfnl closed 4 years ago

jrfnl commented 4 years ago

WPCS 2.2.0 changes the method signature of the PrefixAllGlobalsSniff::process_variable_assignment() method, adding a new $in_list parameter.

This means that the method signature for the method as overloaded in WPTRTCS needs to be updated to prevent the following PHP warning Declaration of WPThemeReview\Sniffs\CoreFunctionality\PrefixAllGlobalsSniff::process_variable_assignment($stackPtr) should be compatible with WordPressCS\WordPress\Sniffs\NamingConventions\PrefixAllGlobalsSniff::process_variable_assignment($stackPtr, $in_list = false).

It it safe to add this new parameter to WPThemeReview already, even though WPCS 2.2.0 hasn't been released yet, as passing too many parameters to a function and/or adding an additional parameter to an overloaded method in a child class does not cause issues in PHP, while having too few parameters will, as the above warning demonstrates.

Refs:

jrfnl commented 4 years ago

Note: when it is known what the next version will be, 0.2.1 or 0.3.0, the function @since documentation will need to be updated (currently 0.x.x).

dingo-d commented 4 years ago

Yeah, I noticed that :) Once I get some more time I'll get to planning and working on the issues. Kinda swamped with work so I didn't find time to work on it.