diff --git a/WordPress/Sniffs/WP/CronIntervalSniff.php b/WordPress/Sniffs/WP/CronIntervalSniff.php index a93315daa9..886eee073f 100644 --- a/WordPress/Sniffs/WP/CronIntervalSniff.php +++ b/WordPress/Sniffs/WP/CronIntervalSniff.php @@ -291,7 +291,7 @@ private function find_function_by_name( $functionName ) { for ( $ptr = 0; $ptr < $this->phpcsFile->numTokens; $ptr++ ) { if ( \T_FUNCTION === $this->tokens[ $ptr ]['code'] ) { $foundName = FunctionDeclarations::getName( $this->phpcsFile, $ptr ); - if ( $foundName === $functionName ) { + if ( strcasecmp( $foundName, $functionName ) === 0 ) { $functionPtr = $ptr; break; } elseif ( isset( $this->tokens[ $ptr ]['scope_closer'] ) ) { diff --git a/WordPress/Tests/WP/CronIntervalUnitTest.inc b/WordPress/Tests/WP/CronIntervalUnitTest.inc index 5ebc161d4c..c2bf29b939 100644 --- a/WordPress/Tests/WP/CronIntervalUnitTest.inc +++ b/WordPress/Tests/WP/CronIntervalUnitTest.inc @@ -164,7 +164,7 @@ add_filter( 'cron_schedules', function ( $schedules ) { // Correctly handle fully qualified WP time constants. class FQNConstants { public function add_schedules() { - add_filter( 'cron_schedules', array( $this, 'add_weekly_schedule' ) ); // Ok: > 15 min. + add_filter( 'cron_schedules', array( $this, 'ADD_WEEKLY_SCHEDULE' ) ); // Ok: > 15 min. \add_filter( 'cron_schedules', array( $this, 'add_eight_minute_schedule' ) ); // Warning: 8 min. ADD_FILTER( 'cron_schedules', array( $this, 'add_hundred_minute_schedule' ) ); // Warning: time undetermined. \Add_Filter( 'cron_schedules', array( $this, 'sneaky_fake_wp_constant_schedule' ) ); // Warning: time undetermined. @@ -284,7 +284,7 @@ class FirstClassCallables { public function add_schedules() { add_filter( 'cron_schedules', $this->cron_weekly_schedule(...) ); // Ok: > 15 min. add_filter( 'cron_schedules', $this->cron_eight_minute_schedule(...) ); // Warning: 8 min. - add_filter( 'cron_schedules', self::cron_weekly_schedule(...) ); // Ok: > 15 min. + add_filter( 'cron_schedules', self::Cron_Weekly_Schedule(...) ); // Ok: > 15 min. add_filter( 'cron_schedules', static::cron_eight_minute_schedule(...) ); // Warning: 8 min. add_filter( 'cron_schedules', [$this, 'cron_weekly_schedule'](...) ); // Ok: > 15 min. add_filter( 'cron_schedules', array($this, 'cron_eight_minute_schedule')(...) ); // Warning: 8 min. @@ -328,6 +328,7 @@ function first_class_six_min_schedule( $schedules ) { add_filter( 'cron_schedules', first_class_six_min_schedule(...)); // Warning: 6 min. add_filter( 'cron_schedules', 'first_class_six_min_schedule'(...)); // Warning: 6 min. add_filter( 'cron_schedules', \first_class_six_min_schedule(...)); // Warning: 6 min. +add_filter( 'cron_schedules', \FIRST_CLASS_SIX_MIN_SCHEDULE(...)); // Warning: 6 min. add_filter( 'cron_schedules', namespace\first_class_six_min_schedule(...)); // Warning: 6 min. /* diff --git a/WordPress/Tests/WP/CronIntervalUnitTest.php b/WordPress/Tests/WP/CronIntervalUnitTest.php index 2417abaf41..4bd6add5b3 100644 --- a/WordPress/Tests/WP/CronIntervalUnitTest.php +++ b/WordPress/Tests/WP/CronIntervalUnitTest.php @@ -69,9 +69,10 @@ public function getWarningList() { 329 => 1, 330 => 1, 331 => 1, - 351 => 1, + 332 => 1, 352 => 1, 353 => 1, + 354 => 1, ); } }