Skip to content

Commit d0e14ef

Browse files
committed
Use PHPCSUtils BackCompat for find[Start|End]ofStatement()
1 parent 4b5b077 commit d0e14ef

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

WordPressVIPMinimum/Sniffs/Files/IncludingNonPHPFileSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use WordPressVIPMinimum\Sniffs\Sniff;
1111
use PHP_CodeSniffer\Util\Tokens;
12+
use PHPCSUtils\BackCompat\BCFile;
1213

1314
/**
1415
* Ensure that non-PHP files are included via `file_get_contents()` instead of using `include/require[_once]`.
@@ -59,7 +60,7 @@ public function register() {
5960
* @return void
6061
*/
6162
public function process_token( $stackPtr ) {
62-
$end_of_statement = $this->phpcsFile->findEndOfStatement( $stackPtr );
63+
$end_of_statement = BCFile::findEndOfStatement( $this->phpcsFile, $stackPtr );
6364
$curStackPtr = ( $end_of_statement + 1 );
6465

6566
do {

WordPressVIPMinimum/Sniffs/Security/ProperEscapingFunctionSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
namespace WordPressVIPMinimum\Sniffs\Security;
1010

1111
use PHP_CodeSniffer\Util\Tokens;
12+
use PHPCSUtils\BackCompat\BCFile;
1213
use PHPCSUtils\Utils\TextStrings;
1314
use WordPressVIPMinimum\Sniffs\Sniff;
1415

@@ -179,7 +180,7 @@ public function process_token( $stackPtr ) {
179180
if ( $this->in_short_echo !== false ) {
180181
$ignore[ T_COMMA ] = T_COMMA;
181182
} else {
182-
$start_of_statement = $this->phpcsFile->findStartOfStatement( $stackPtr, T_COMMA );
183+
$start_of_statement = BCFile::findStartOfStatement( $this->phpcsFile, $stackPtr, T_COMMA );
183184
if ( $this->tokens[ $start_of_statement ]['code'] === T_ECHO ) {
184185
$ignore[ T_COMMA ] = T_COMMA;
185186
}

0 commit comments

Comments
 (0)