Skip to content

Commit e5c6ecb

Browse files
committed
Sniff::is_validated(): implement is_class_object_call() and is_token_namespaced()
1 parent 7c1b6f8 commit e5c6ecb

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

WordPress/Sniff.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,22 +1907,14 @@ protected function is_validated( $stackPtr, $array_key = null, $in_condition_onl
19071907
continue 2;
19081908
}
19091909

1910-
$previous_non_empty = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $i - 1 ), null, true, null, true );
1911-
if ( false !== $previous_non_empty ) {
1912-
if ( \T_OBJECT_OPERATOR === $this->tokens[ $previous_non_empty ]['code']
1913-
|| \T_DOUBLE_COLON === $this->tokens[ $previous_non_empty ]['code']
1914-
) {
1915-
// Method call.
1916-
continue 2;
1917-
}
1910+
if ( $this->is_class_object_call( $i ) === true ) {
1911+
// Method call.
1912+
continue 2;
1913+
}
19181914

1919-
if ( \T_NS_SEPARATOR === $this->tokens[ $previous_non_empty ]['code'] ) {
1920-
$pprev = $this->phpcsFile->findPrevious( Tokens::$emptyTokens, ( $previous_non_empty - 1 ), null, true, null, true );
1921-
if ( false !== $pprev && \T_STRING === $this->tokens[ $pprev ]['code'] ) {
1922-
// Namespaced function call.
1923-
continue 2;
1924-
}
1925-
}
1915+
if ( $this->is_token_namespaced( $i ) === true ) {
1916+
// Namespaced function call.
1917+
continue 2;
19261918
}
19271919

19281920
$params = $this->get_function_call_parameters( $i );

0 commit comments

Comments
 (0)