Skip to content

Commit

Permalink
PEAR/FileComment: remove the TLD character limit
Browse files Browse the repository at this point in the history
What with new TLDs being accepted all the time and lots of them being longer then 7 characters, the character limit seems out of date.

Includes unit test.

Fixes 2566
  • Loading branch information
jrfnl committed Jul 24, 2019
1 parent 886c162 commit c7b090a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Standards/PEAR/Sniffs/Commenting/FileCommentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ protected function processAuthor($phpcsFile, array $tags)
$local = '\da-zA-Z-_+';
// Dot character cannot be the first or last character in the local-part.
$localMiddle = $local.'.\w';
if (preg_match('/^([^<]*)\s+<(['.$local.'](['.$localMiddle.']*['.$local.'])*@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,7})>$/', $content) === 0) {
if (preg_match('/^([^<]*)\s+<(['.$local.'](['.$localMiddle.']*['.$local.'])*@[\da-zA-Z][-.\w]*[\da-zA-Z]\.[a-zA-Z]{2,})>$/', $content) === 0) {
$error = 'Content of the @author tag must be in the form "Display Name <username@example.com>"';
$phpcsFile->addError($error, $tag, 'InvalidAuthors');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ declare(encoding='utf-8');
* @summary An unknown summary tag
* @package ''
* @subpackage !!
* @author Code AUthor <author@gmail.consulting>
*/
require_once '/some/path.php';
?>
Expand Down
4 changes: 2 additions & 2 deletions src/Standards/PEAR/Tests/Commenting/FileCommentUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getErrorList()
35 => 1,
40 => 2,
41 => 2,
42 => 1,
43 => 1,
];

}//end getErrorList()
Expand All @@ -60,7 +60,7 @@ public function getWarningList()
29 => 1,
30 => 1,
34 => 1,
42 => 1,
43 => 1,
];

}//end getWarningList()
Expand Down

0 comments on commit c7b090a

Please sign in to comment.