Skip to content

Commit f6338c8

Browse files
committed
WIP SanitizationHelperTrait: update for PHPCS 4.0
Need to check if this way is the best way to fix the problem and improve it (document, make more readable). It seems the failing tests are failing because of is_in_function_call().
1 parent ed8a673 commit f6338c8

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

WordPress/Helpers/ArrayWalkingFunctionsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function get_functions() {
7171
* @return bool
7272
*/
7373
public static function is_array_walking_function( $functionName ) {
74-
return isset( self::$arrayWalkingFunctions[ strtolower( $functionName ) ] );
74+
return isset( self::$arrayWalkingFunctions[ strtolower( ltrim( $functionName, '\\' ) ) ] );
7575
}
7676

7777
/**

WordPress/Helpers/SanitizationHelperTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ final public function get_sanitizing_and_unslashing_functions() {
239239
* @return bool
240240
*/
241241
final public function is_sanitizing_function( $functionName ) {
242-
return isset( $this->get_sanitizing_functions()[ strtolower( $functionName ) ] );
242+
return isset( $this->get_sanitizing_functions()[ strtolower( ltrim( $functionName, '\\' ) ) ] );
243243
}
244244

245245
/**
@@ -252,7 +252,7 @@ final public function is_sanitizing_function( $functionName ) {
252252
* @return bool
253253
*/
254254
final public function is_sanitizing_and_unslashing_function( $functionName ) {
255-
return isset( $this->get_sanitizing_and_unslashing_functions()[ strtolower( $functionName ) ] );
255+
return isset( $this->get_sanitizing_and_unslashing_functions()[ strtolower( ltrim( $functionName, '\\' ) ) ] );
256256
}
257257

258258
/**

WordPress/Helpers/UnslashingFunctionsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ public static function get_functions() {
5454
* @return bool
5555
*/
5656
public static function is_unslashing_function( $functionName ) {
57-
return isset( self::$unslashingFunctions[ strtolower( $functionName ) ] );
57+
return isset( self::$unslashingFunctions[ strtolower( ltrim( $functionName, '\\' ) ) ] );
5858
}
5959
}

0 commit comments

Comments
 (0)