Snippet:
<?php
if ( ! empty( $this->vars['video-id'] ) ) {
echo $this->vars['video-id'];
}
With a default configuration (phpcs --standard=VariableAnalysis -s phpcs-test.php), then "Variable $this is undefined. (VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable)" is reported for line 4 (the echo line), but not for the $this in the empty().
Likewise:
<?php
if ( empty( $this->vars['video-id'] ) ) {
return;
}
...doesn't give any violation at all.
If I remove the empty(), then the violation is reported.
<?php
if ( ! $this->vars['video-id'] ) {
return;
}
Tested in VA 2.11.0.