Skip to content

Commit 4aa8bb5

Browse files
committed
DateTime/CurrentTimeTimestamp: update for PHPCS 4.0
Correctly handle changing fully qualified `\current_time()` function name.
1 parent dc704dd commit 4aa8bb5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

WordPress/Sniffs/DateTime/CurrentTimeTimestampSniff.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,13 @@ public function process_parameters( $stackPtr, $group_name, $matched_content, $p
161161
$this->phpcsFile->fixer->replaceToken( $i, '' );
162162
}
163163

164-
$this->phpcsFile->fixer->replaceToken( $stackPtr, 'time(' );
164+
$replacement_content = 'time(';
165+
166+
if ( \T_NAME_FULLY_QUALIFIED === $this->tokens[ $stackPtr ]['code'] ) {
167+
$replacement_content = '\time(';
168+
}
169+
170+
$this->phpcsFile->fixer->replaceToken( $stackPtr, $replacement_content );
165171
$this->phpcsFile->fixer->endChangeset();
166172
}
167173
}

0 commit comments

Comments
 (0)