Skip to content

Commit 6e5b8f0

Browse files
authored
Merge pull request #160 from photodude/patch-5
Fixed bug introduced by preg_match change from php/php-src#1303
2 parents 1677fa2 + d1987d2 commit 6e5b8f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Joomla/Sniffs/Commenting/FileCommentSniff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,15 +530,15 @@ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, array $tags
530530
if (preg_match('/^.*?([0-9]{4})((.{1})([0-9]{4}))? (.+)$/', $content, $matches) !== 0)
531531
{
532532
// Check earliest-latest year order.
533-
if ($matches[3] !== '')
533+
if ($matches[3] !== '' && $matches[3] !== null)
534534
{
535535
if ($matches[3] !== '-')
536536
{
537537
$error = 'A hyphen must be used between the earliest and latest year';
538538
$phpcsFile->addError($error, $tag, 'CopyrightHyphen');
539539
}
540540

541-
if ($matches[4] !== '' && $matches[4] < $matches[1])
541+
if ($matches[4] !== '' && $matches[4] !== null && $matches[4] < $matches[1])
542542
{
543543
$error = "Invalid year span \"$matches[1]$matches[3]$matches[4]\" found; consider \"$matches[4]-$matches[1]\" instead";
544544
$phpcsFile->addWarning($error, $tag, 'InvalidCopyright');

0 commit comments

Comments
 (0)