Skip to content

Commit d397f87

Browse files
committed
Fixed bug introduced by preg_match change from php/php-src#1303
1 parent a025480 commit d397f87

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

CodeSniffer/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,15 +498,13 @@ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, array $tags
498498
$matches = array();
499499
if (preg_match('/^([0-9]{4})((.{1})([0-9]{4}))? (.+)$/', $content, $matches) !== 0) {
500500
// Check earliest-latest year order.
501-
if ($matches[3] !== '') {
501+
if ($matches[3] !== '' && $matches[3] !== NULL) {
502502
if ($matches[3] !== '-') {
503-
var_dump($content);
504-
var_dump($matches);
505503
$error = 'A hyphen must be used between the earliest and latest year';
506504
$phpcsFile->addError($error, $tag, 'CopyrightHyphen');
507505
}
508506

509-
if ($matches[4] !== '' && $matches[4] < $matches[1]) {
507+
if ($matches[4] !== '' && $matches[4] !== NULL && $matches[4] < $matches[1]) {
510508
$error = "Invalid year span \"$matches[1]$matches[3]$matches[4]\" found; consider \"$matches[4]-$matches[1]\" instead";
511509
$phpcsFile->addWarning($error, $tag, 'InvalidCopyright');
512510
}

0 commit comments

Comments
 (0)