Skip to content

Commit 9dee12b

Browse files
committed
Addressing PHPCS feedback
1 parent fde9c00 commit 9dee12b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

WordPressVIPMinimum/Sniffs/VIP/ProperEscapingFunctionSniff.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818
*/
1919
class ProperEscapingFunctionSniff implements \PHP_CodeSniffer_Sniff {
2020

21+
/**
22+
* List of escaping functions which are being tested.
23+
*
24+
* @var array
25+
*/
2126
public $escaping_functions = array(
2227
'esc_url',
2328
'esc_attr',
@@ -66,7 +71,6 @@ public function process( File $phpcsFile, $stackPtr ) {
6671
if ( T_INLINE_HTML !== $tokens[ $html ]['code'] ) {
6772
return;
6873
}
69-
7074
} elseif ( T_STRING_CONCAT === $tokens[ $echo_or_string_concat ]['code'] ) {
7175
// Very likely string concatenation mixing strings and functions/variables.
7276
$html = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $echo_or_string_concat - 1 ), null, true );
@@ -93,7 +97,7 @@ public function process( File $phpcsFile, $stackPtr ) {
9397
/**
9498
* Tests whether provided string ends with open src or href attribute.
9599
*
96-
* @param $content Haystak in which we look for an open src or href attribute.
100+
* @param string $content Haystack in which we look for an open src or href attribute.
97101
*
98102
* @return bool True if string ends with open src or href attribute.
99103
*/
@@ -147,6 +151,6 @@ public function is_html_attr( $content ) {
147151
* @return bool True if haystack ends with needle.
148152
*/
149153
public function endswith( $haystack, $needle ) {
150-
return $needle === substr( $haystack, -strlen( $needle ) );
154+
return substr( $haystack, -strlen( $needle ) ) === $needle;
151155
}
152156
}

0 commit comments

Comments
 (0)