Skip to content

Commit

Permalink
Fixed bug introduced by preg_match change from php/php-src#1303
Browse files Browse the repository at this point in the history
  • Loading branch information
photodude committed Mar 7, 2017
1 parent 34a0abf commit fe78ae1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Joomla/Sniffs/Commenting/FileCommentSniff.php
Expand Up @@ -530,15 +530,15 @@ protected function processCopyright(PHP_CodeSniffer_File $phpcsFile, array $tags
if (preg_match('/^.*?([0-9]{4})((.{1})([0-9]{4}))? (.+)$/', $content, $matches) !== 0)
{
// Check earliest-latest year order.
if ($matches[3] !== '')
if ($matches[3] !== '' && $matches[3] !== null)
{
if ($matches[3] !== '-')
{
$error = 'A hyphen must be used between the earliest and latest year';
$phpcsFile->addError($error, $tag, 'CopyrightHyphen');
}

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

0 comments on commit fe78ae1

Please sign in to comment.