Skip to content
Browse files

Merge branch 'multilingual-comment' of https://github.com/index0h/PHP…

  • Loading branch information...
2 parents 3b05c2c + 900b1c0 commit df7391c48383fff878621c2db2c95412c6a23b2f @gsherwood gsherwood committed Feb 1, 2013
View
2 CodeSniffer/Standards/Squiz/Sniffs/Commenting/BlockCommentSniff.php
@@ -153,7 +153,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$phpcsFile->addError($error, $commentLines[1], 'FirstLineIndent', $data);
}
- if (preg_match('|[A-Z]|', $commentText[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $commentText[0]) === 0) {
$error = 'Block comments must start with a capital letter';
$phpcsFile->addError($error, $commentLines[1], 'NoCapital');
}
View
5 CodeSniffer/Standards/Squiz/Sniffs/Commenting/ClassCommentSniff.php
@@ -188,7 +188,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$newlineCount += $newlineBetween;
$testLong = trim($long);
- if (preg_match('|[A-Z]|', $testLong[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testLong[0]) === 0) {
$error = 'Class comment long description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + $newlineCount), 'LongNotCapital');
}
@@ -216,8 +216,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$error = 'Class comment short description must be on a single line';
$phpcsFile->addError($error, ($commentStart + 1), 'ShortSingleLine');
}
-
- if (preg_match('|[A-Z]|', $testShort[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testShort[0]) === 0) {
$error = 'Class comment short description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + 1), 'ShortNotCapital');
}
View
4 CodeSniffer/Standards/Squiz/Sniffs/Commenting/FileCommentSniff.php
@@ -222,7 +222,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$newlineCount += $newlineBetween;
$testLong = trim($long);
- if (preg_match('|[A-Z]|', $testLong[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testLong[0]) === 0) {
$error = 'File comment long description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + $newlineCount), 'LongNotCapital');
}
@@ -255,7 +255,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$phpcsFile->addError($error, ($commentStart + 1), 'ShortSingleLine');
}
- if (preg_match('|[A-Z]|', $testShort[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testShort[0]) === 0) {
$error = 'File comment short description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + 1), 'ShortNotCapital');
}
View
6 CodeSniffer/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php
@@ -249,7 +249,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$newlineCount += $newlineBetween;
$testLong = trim($long);
- if (preg_match('|[A-Z]|', $testLong[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testLong[0]) === 0) {
$error = 'Function comment long description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + $newlineCount), 'LongNotCapital');
}
@@ -278,7 +278,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$phpcsFile->addError($error, ($commentStart + 1), 'ShortSingleLine');
}
- if (preg_match('|[A-Z]|', $testShort[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testShort[0]) === 0) {
$error = 'Function comment short description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + 1), 'ShortNotCapital');
}
@@ -735,7 +735,7 @@ protected function processParams($commentStart, $commentEnd)
// Param comments must start with a capital letter and
// end with the full stop.
$firstChar = $paramComment{0};
- if (preg_match('|[A-Z]|', $firstChar) === 0) {
+ if (preg_match('|\p{Lu}|u', $firstChar) === 0) {
$error = 'Param comment must start with a capital letter';
$this->currentFile->addError($error, $errorPos, 'ParamCommentNotCapital');
}
View
2 CodeSniffer/Standards/Squiz/Sniffs/Commenting/InlineCommentSniff.php
@@ -224,7 +224,7 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
return;
}
- if (preg_match('|[A-Z]|', $commentText[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $commentText[0]) === 0) {
$error = 'Inline comments must start with a capital letter';
$phpcsFile->addError($error, $topComment, 'NotCapital');
}
View
4 CodeSniffer/Standards/Squiz/Sniffs/Commenting/VariableCommentSniff.php
@@ -148,7 +148,7 @@ public function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$newlineCount += $newlineBetween;
$testLong = trim($long);
- if (preg_match('|[A-Z]|', $testLong[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testLong[0]) === 0) {
$error = 'Variable comment long description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + $newlineCount), 'LongNotCapital');
}
@@ -162,7 +162,7 @@ public function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
$phpcsFile->addError($error, ($commentStart + 1), 'ShortSingleLine');
}
- if (preg_match('|[A-Z]|', $testShort[0]) === 0) {
+ if (preg_match('|\p{Lu}|u', $testShort[0]) === 0) {
$error = 'Variable comment short description must start with a capital letter';
$phpcsFile->addError($error, ($commentStart + 1), 'ShortNotCapital');
}

0 comments on commit df7391c

Please sign in to comment.
Something went wrong with that request. Please try again.