Permalink
Browse files

Remove all commenting checks

  • Loading branch information...
1 parent ae1c7fa commit b9d7f565192dae1690b1e8859a4082c2eb890ebe @odolbeau committed May 15, 2012
Showing with 0 additions and 248 deletions.
  1. +0 −114 Sniffs/Commenting/ClassCommentSniff.php
  2. +0 −117 Sniffs/Commenting/FunctionCommentSniff.php
  3. +0 −17 ruleset.xml
@@ -1,114 +0,0 @@
-<?php
-/**
- * Parses and verifies the doc comments for classes.
- *
- * PHP version 5
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @author Greg Sherwood <gsherwood@squiz.net>
- * @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: ClassCommentSniff.php 301632 2010-07-28 01:57:56Z squiz $
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-
-if (class_exists('PHP_CodeSniffer_CommentParser_ClassCommentParser', true) === false) {
- $error = 'Class PHP_CodeSniffer_CommentParser_ClassCommentParser not found';
- throw new PHP_CodeSniffer_Exception($error);
-}
-
-if (class_exists('PEAR_Sniffs_Commenting_ClassCommentSniff', true) === false) {
- $error = 'Class PEAR_Sniffs_Commenting_ClassCommentSniff not found';
- throw new PHP_CodeSniffer_Exception($error);
-}
-
-/**
- * Parses and verifies the doc comments for classes.
- *
- * Verifies that :
- * <ul>
- * <li>A doc comment exists.</li>
- * <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>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>
- * </ul>
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @author Greg Sherwood <gsherwood@squiz.net>
- * @author Marc McIntyre <mmcintyre@squiz.net>
- * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0RC2
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-class Symfony2_Sniffs_Commenting_ClassCommentSniff extends PEAR_Sniffs_Commenting_ClassCommentSniff
-{
- /**
- * Tags in correct order and related info.
- *
- * @var array
- */
- protected $tags = array(
- 'category' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'precedes @package',
- ),
- 'package' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @category',
- ),
- 'subpackage' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @package',
- ),
- 'author' => array(
- 'required' => false,
- 'allow_multiple' => true,
- 'order_text' => 'follows @subpackage (if used) or @package',
- ),
- 'copyright' => array(
- 'required' => false,
- 'allow_multiple' => true,
- 'order_text' => 'follows @author',
- ),
- 'license' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @copyright (if used) or @author',
- ),
- 'version' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @license',
- ),
- 'link' => array(
- 'required' => false,
- 'allow_multiple' => true,
- 'order_text' => 'follows @version',
- ),
- 'see' => array(
- 'required' => false,
- 'allow_multiple' => true,
- 'order_text' => 'follows @link',
- ),
- 'since' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @see (if used) or @link',
- ),
- 'deprecated' => array(
- 'required' => false,
- 'allow_multiple' => false,
- 'order_text' => 'follows @since (if used) or @see (if used) or @link',
- ),
- );
-}
@@ -1,117 +0,0 @@
-<?php
-/**
- * This file is part of the Symfony2-coding-standard (phpcs standard)
- *
- * PHP version 5
- *
- * @category PHP
- * @package PHP_CodeSniffer-Symfony2
- * @author Symfony2-phpcs-authors <Symfony2-coding-standard@opensky.github.com>
- * @license http://spdx.org/licenses/MIT MIT License
- * @version GIT: master
- * @link https://github.com/opensky/Symfony2-coding-standard
- */
-
-if (class_exists('PEAR_Sniffs_Commenting_FunctionCommentSniff', true) === false) {
- $error = 'Class PEAR_Sniffs_Commenting_FunctionCommentSniff not found';
- throw new PHP_CodeSniffer_Exception($error);
-}
-
-/**
- * Symfony2 standard customization to PEARs FunctionCommentSniff.
- *
- * Verifies that :
- * <ul>
- * <li>There is a &#64;return tag if a return statement exists inside the method</li>
- * </ul>
- *
- * @category PHP
- * @package PHP_CodeSniffer
- * @author Felix Brandt <mail@felixbrandt.de>
- * @license http://spdx.org/licenses/BSD-3-Clause BSD 3-clause "New" or "Revised" License
- * @link http://pear.php.net/package/PHP_CodeSniffer
- */
-class Symfony2_Sniffs_Commenting_FunctionCommentSniff extends PEAR_Sniffs_Commenting_FunctionCommentSniff
-{
-
- /**
- * Process the return comment of this function comment.
- *
- * @param int $commentStart The position in the stack where the comment started.
- * @param int $commentEnd The position in the stack where the comment ended.
- *
- * @return void
- */
- protected function processReturn($commentStart, $commentEnd)
- {
- if ($this->isInheritDoc()) {
- return;
- }
-
- $tokens = $this->currentFile->getTokens();
- $funcPtr = $this->currentFile->findNext(T_FUNCTION, $commentEnd);
-
- // Only check for a return comment if a non-void return statement exists
- if (isset($tokens[$funcPtr]['scope_opener'])) {
- $start = $tokens[$funcPtr]['scope_opener'];
-
- // iterate over all return statements of this function,
- // run the check on the first which is not only 'return;'
- while ($returnToken = $this->currentFile->findNext(T_RETURN, $start, $tokens[$funcPtr]['scope_closer'])) {
- if ($this->isMatchingReturn($tokens, $returnToken)) {
- parent::processReturn($commentStart, $commentEnd);
- break;
- }
- $start = $returnToken + 1;
- }
- }
-
- } /* end processReturn() */
-
- /**
- * Is the comment an inheritdoc?
- *
- * @return boolean True if the comment is an inheritdoc
- */
- protected function isInheritDoc ()
- {
- $content = $this->commentParser->getComment()->getContent();
-
- return preg_match('#{@inheritdoc}#i', $content) === 1;
- } // end isInheritDoc()
-
- /**
- * Process the function parameter comments.
- *
- * @param int $commentStart The position in the stack where
- * the comment started.
- *
- * @return void
- */
- protected function processParams($commentStart)
- {
- if ($this->isInheritDoc()) {
- return;
- }
-
- parent::processParams($commentStart);
- } // end processParams()
-
- /**
- * Is the return statement matching?
- *
- * @param array $tokens Array of tokens
- * @param int $returnPos Stack position of the T_RETURN token to process
- *
- * @return boolean True if the return does not return anything
- */
- protected function isMatchingReturn ($tokens, $returnPos)
- {
- do {
- $returnPos++;
- } while ($tokens[$returnPos]['code'] === T_WHITESPACE);
-
- return $tokens[$returnPos]['code'] !== T_SEMICOLON;
- }
-
-}//end class
View
@@ -39,9 +39,6 @@
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.Scope.MemberVarScope"/>
- <!-- We provide our own subclass of PEAR's ClassComment and FunctionComment sniff, but these will do: -->
- <rule ref="PEAR.Commenting.InlineComment"/>
-
<!-- Import Zend coding standard (which in turn imports PEAR) -->
<rule ref="Zend">
<!-- but exclude their code analyzer -->
@@ -50,8 +47,6 @@
<!-- covered by Squiz ControlSignature, which enforces try/catch as well -->
<exclude name="PEAR.ControlStructures.ControlSignature"/>
- <exclude name="PEAR.Commenting.FunctionComment.SpacingBeforeTags"/>
-
<!-- do not check line length -->
<exclude name="Generic.Files.LineLength"/>
</rule>
@@ -73,16 +68,4 @@
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule>
-
- <rule ref="Symfony2.Commenting.FunctionComment.MissingParamComment">
- <severity>0</severity>
- </rule>
-
- <rule ref="Symfony2.Commenting.FunctionComment.SpacingBeforeTags">
- <severity>0</severity>
- </rule>
-
- <rule ref="Symfony2.Commenting.ClassComment.SpacingBeforeTags">
- <message>There should always be a description, followed by a blank line, before the tags of a class comment.</message>
- </rule>
</ruleset>

0 comments on commit b9d7f56

Please sign in to comment.