Skip to content

Commit b9a320e

Browse files
committed
PrintingFunctionsTrait::is_printing_function(): update for PHPCS 4.0
Use `ltrim()` to strip the leading backslash from fully qualified function names, ensuring they are correctly recognized when tokenized as `T_NAME_FULLY_QUALIFIED` in PHPCS 4.0.
1 parent b6e6b55 commit b9a320e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

WordPress/Helpers/PrintingFunctionsTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,6 @@ final public function get_printing_functions() {
117117
* @return bool
118118
*/
119119
final public function is_printing_function( $functionName ) {
120-
return isset( $this->get_printing_functions()[ strtolower( $functionName ) ] );
120+
return isset( $this->get_printing_functions()[ strtolower( ltrim( $functionName, '\\' ) ) ] );
121121
}
122122
}

WordPress/Helpers/WPHookHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public static function get_functions( $include_deprecated = true ) {
9999
* for the format of the returned (single-dimensional) array.
100100
*/
101101
public static function get_hook_name_param( $function_name, array $parameters ) {
102-
$function_lc = strtolower( $function_name );
102+
$function_lc = strtolower( ltrim( $function_name, '\\' ) );
103103
if ( isset( self::$hookInvokeFunctions[ $function_lc ] ) === false ) {
104104
return false;
105105
}

0 commit comments

Comments
 (0)