While it is not exactly a code style concern, the use of undefined variables and creating variables without using them is nearly always a bug.
The following typo is a trivial example, but it is the kind of thing that can easily make it into production code because a particular code path has not been adequately tested.
function update_my_post( $post_data ) {
wp_insert_post( $post_info );
}
While it's possible to argue that this is the responsibility of testing, I'd make the case that WordPress and its plugins are of sufficient complexity that it's difficult to test all code paths adequately. Perhaps more importantly, WordPress is a vehicle for new developers to learn coding and therefore this project is in a unique position to help those developers avoid introducing new bugs into their own code.
PHPCS can easily detect these instances and prevent a whole class of bugs from appearing. Here is a set of PHPCS sniffs which does just that: https://github.com/sirbrillig/VariableAnalysis
If there's interest, I can work on integrating these sniffs into this ruleset.
While it is not exactly a code style concern, the use of undefined variables and creating variables without using them is nearly always a bug.
The following typo is a trivial example, but it is the kind of thing that can easily make it into production code because a particular code path has not been adequately tested.
While it's possible to argue that this is the responsibility of testing, I'd make the case that WordPress and its plugins are of sufficient complexity that it's difficult to test all code paths adequately. Perhaps more importantly, WordPress is a vehicle for new developers to learn coding and therefore this project is in a unique position to help those developers avoid introducing new bugs into their own code.
PHPCS can easily detect these instances and prevent a whole class of bugs from appearing. Here is a set of PHPCS sniffs which does just that: https://github.com/sirbrillig/VariableAnalysis
If there's interest, I can work on integrating these sniffs into this ruleset.