Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WordPress/Sniffs/WP/CronIntervalSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) ) {
Expand Down
5 changes: 3 additions & 2 deletions WordPress/Tests/WP/CronIntervalUnitTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.

/*
Expand Down
3 changes: 2 additions & 1 deletion WordPress/Tests/WP/CronIntervalUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ public function getWarningList() {
329 => 1,
330 => 1,
331 => 1,
351 => 1,
332 => 1,
352 => 1,
353 => 1,
354 => 1,
);
}
}
Loading