diff options
author | Michal Čihař <mcihar@suse.cz> | 2012-04-26 17:38:57 +0400 |
---|---|---|
committer | Michal Čihař <mcihar@suse.cz> | 2012-04-26 17:38:57 +0400 |
commit | 749f66de3942373bb9232ff32cd45e459bfb1493 (patch) | |
tree | ceaf6f252ff0ef7f3bdb0b53418597c047a1bbd0 /PMAStandard | |
parent | 35711845494c6b02d1549488a99ff4ef937cd5bd (diff) |
Adjust PEAR coding standard to our use
- do not require some phpdoc tags
- do not require PHP version to be specified
Diffstat (limited to 'PMAStandard')
4 files changed, 12 insertions, 35 deletions
diff --git a/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php b/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php index 0a6249b70e..51481c60b5 100644 --- a/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php +++ b/PMAStandard/Sniffs/Commenting/ClassCommentSniff.php @@ -18,8 +18,8 @@ if (class_exists('PHP_CodeSniffer_CommentParser_ClassCommentParser', true) === f throw new PHP_CodeSniffer_Exception($error); } -if (class_exists('PEAR_Sniffs_Commenting_FileCommentSniff', true) === false) { - $error = 'Class PEAR_Sniffs_Commenting_FileCommentSniff not found'; +if (class_exists('PMAStandard_Sniffs_Commenting_FileCommentSniff', true) === false) { + $error = 'Class PMAStandard_Sniffs_Commenting_FileCommentSniff not found'; throw new PHP_CodeSniffer_Exception($error); } @@ -46,7 +46,7 @@ if (class_exists('PEAR_Sniffs_Commenting_FileCommentSniff', true) === false) { * @version Release: 1.3.3 * @link http://pear.php.net/package/PHP_CodeSniffer */ -class PEAR_Sniffs_Commenting_ClassCommentSniff extends PEAR_Sniffs_Commenting_FileCommentSniff +class PMAStandard_Sniffs_Commenting_ClassCommentSniff extends PMAStandard_Sniffs_Commenting_FileCommentSniff { diff --git a/PMAStandard/Sniffs/Commenting/FileCommentSniff.php b/PMAStandard/Sniffs/Commenting/FileCommentSniff.php index fbef7f3e60..2fbfd4e5c7 100644 --- a/PMAStandard/Sniffs/Commenting/FileCommentSniff.php +++ b/PMAStandard/Sniffs/Commenting/FileCommentSniff.php @@ -26,7 +26,6 @@ if (class_exists('PHP_CodeSniffer_CommentParser_ClassCommentParser', true) === f * <li>There is a blank newline after the short description.</li> * <li>There is a blank newline between the long and short description.</li> * <li>There is a blank newline between the long description and tags.</li> - * <li>A PHP version is specified.</li> * <li>Check the order of the tags.</li> * <li>Check the indentation of each tag.</li> * <li>Check required and optional tags and the format of their content.</li> @@ -42,7 +41,7 @@ if (class_exists('PHP_CodeSniffer_CommentParser_ClassCommentParser', true) === f * @link http://pear.php.net/package/PHP_CodeSniffer */ -class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff +class PMAStandard_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff { /** @@ -66,7 +65,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff */ protected $tags = array( 'category' => array( - 'required' => true, + 'required' => false, 'allow_multiple' => false, 'order_text' => 'precedes @package', ), @@ -81,7 +80,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff 'order_text' => 'follows @package', ), 'author' => array( - 'required' => true, + 'required' => false, 'allow_multiple' => true, 'order_text' => 'follows @subpackage (if used) or @package', ), @@ -91,7 +90,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff 'order_text' => 'follows @author', ), 'license' => array( - 'required' => true, + 'required' => false, 'allow_multiple' => false, 'order_text' => 'follows @copyright (if used) or @author', ), @@ -101,7 +100,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff 'order_text' => 'follows @license', ), 'link' => array( - 'required' => true, + 'required' => false, 'allow_multiple' => true, 'order_text' => 'follows @version', ), @@ -311,9 +310,6 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff } } - // Check the PHP Version. - $this->processPHPVersion($commentStart, $commentEnd, $long); - // Check each tag. $this->processTags($commentStart, $commentEnd); }//end if @@ -322,25 +318,6 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff /** - * Check that the PHP version is specified. - * - * @param int $commentStart Position in the stack where the comment started. - * @param int $commentEnd Position in the stack where the comment ended. - * @param string $commentText The text of the function comment. - * - * @return void - */ - protected function processPHPVersion($commentStart, $commentEnd, $commentText) - { - if (strstr(strtolower($commentText), 'php version') === false) { - $error = 'PHP version not specified'; - $this->currentFile->addWarning($error, $commentEnd, 'MissingVersion'); - } - - }//end processPHPVersion() - - - /** * Processes each required or optional tag. * * @param int $commentStart Position in the stack where the comment started. @@ -350,7 +327,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff */ protected function processTags($commentStart, $commentEnd) { - $docBlock = (get_class($this) === 'PEAR_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class'; + $docBlock = (get_class($this) === 'PMAStandard_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class'; $foundTags = $this->commentParser->getTagOrders(); $orderIndex = 0; $indentation = array(); @@ -683,7 +660,7 @@ class PEAR_Sniffs_Commenting_FileCommentSniff implements PHP_CodeSniffer_Sniff } } else { $error = 'Content missing for @author tag in %s comment'; - $docBlock = (get_class($this) === 'PEAR_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class'; + $docBlock = (get_class($this) === 'PMAStandard_Sniffs_Commenting_FileCommentSniff') ? 'file' : 'class'; $data = array($docBlock); $this->currentFile->addError($error, $errorPos, 'EmptyAuthors', $data); } diff --git a/PMAStandard/Sniffs/Commenting/FunctionCommentSniff.php b/PMAStandard/Sniffs/Commenting/FunctionCommentSniff.php index 081c05d32b..8852c7700b 100644 --- a/PMAStandard/Sniffs/Commenting/FunctionCommentSniff.php +++ b/PMAStandard/Sniffs/Commenting/FunctionCommentSniff.php @@ -44,7 +44,7 @@ if (class_exists('PHP_CodeSniffer_CommentParser_FunctionCommentParser', true) == * @version Release: 1.3.3 * @link http://pear.php.net/package/PHP_CodeSniffer */ -class PEAR_Sniffs_Commenting_FunctionCommentSniff implements PHP_CodeSniffer_Sniff +class PMAStandard_Sniffs_Commenting_FunctionCommentSniff implements PHP_CodeSniffer_Sniff { /** diff --git a/PMAStandard/Sniffs/Commenting/InlineCommentSniff.php b/PMAStandard/Sniffs/Commenting/InlineCommentSniff.php index 3499be80d2..30ad0e0c15 100644 --- a/PMAStandard/Sniffs/Commenting/InlineCommentSniff.php +++ b/PMAStandard/Sniffs/Commenting/InlineCommentSniff.php @@ -27,7 +27,7 @@ * @version Release: 1.3.3 * @link http://pear.php.net/package/PHP_CodeSniffer */ -class PEAR_Sniffs_Commenting_InlineCommentSniff implements PHP_CodeSniffer_Sniff +class PMAStandard_Sniffs_Commenting_InlineCommentSniff implements PHP_CodeSniffer_Sniff { |