Skip to content

Commit

Permalink
Merge pull request #1772 from WordPress/feature/php-7.4-compatibility
Browse files Browse the repository at this point in the history
PHP 7.4 compatibility / defensive coding
  • Loading branch information
dingo-d committed Jul 25, 2019
2 parents 89c2154 + 5fe9561 commit 6aab357
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions WordPress/Sniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -1339,6 +1339,10 @@ protected function is_test_class( $stackPtr ) {

// Does the class/trait extend one of the whitelisted test classes ?
$extendedClassName = $this->phpcsFile->findExtendedClassName( $stackPtr );
if ( false === $extendedClassName ) {
return false;
}

if ( '\\' === $extendedClassName[0] ) {
if ( isset( $whitelist[ substr( $extendedClassName, 1 ) ] ) ) {
return true;
Expand Down Expand Up @@ -1481,8 +1485,8 @@ protected function has_nonce_check( $stackPtr ) {
// Check if we've looked here before.
$filename = $this->phpcsFile->getFilename();

if (
$filename === $last['file']
if ( is_array( $last )
&& $filename === $last['file']
&& $start === $last['start']
) {

Expand Down

0 comments on commit 6aab357

Please sign in to comment.