phpcs-variable-analysis
phpcs-variable-analysis copied to clipboard
Sniff for detecting single-use variables?
Trying to avoid this example BAD (due to refactoring, or simple human error):
$has_free_tag = has_tag( 'free' );
if ( $has_free_tag ) {
...
}
BETTER:
if ( has_tag( 'free' ) ) {
...
}
That would be pretty cool! And not too hard, I think.