Changeset 1309

Show
Ignore:
Timestamp:
01/29/08 11:35:27 (9 months ago)
Author:
richi
Message:

coding standards: fixed coding standards issues in Sniffs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassDeclarationSniff.php

    r1286 r1309  
    11<?php 
    22/** 
    3  * Class/Interface Declaration Test. 
     3 * Checks whitespace at the declaration of a class/interface  
    44 * 
    5  * @package   Classes 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Classes 
    77 */ 
    88 
     
    1313 
    1414/** 
    15  * Checks the declaration of the class and its inheritance is correct. 
     15 * Checks whitespace at the declaration of a class/interface 
    1616 * 
    1717 * Copied and adapted content from Squiz/Sniffs/Classes/ClassDeclarationSniff 
    1818 * because of no extending possibility (no methods/attributes to overwrite). 
    1919 * 
    20  * @package  Classes 
     20 * @package  Classes 
    2121 */ 
    2222class Stubbles_Sniffs_Classes_stubClassDeclarationSniff extends PEAR_Sniffs_Classes_ClassDeclarationSniff 
     
    2828     * exclude special classes 
    2929     * 
    30      * @var array<string> 
    31      */ 
    32     protected $excludedClasses = array('stubClassNotFoundException',  
     30     * @var array<string> 
     31     */ 
     32    protected $excludedClasses = array('stubClassNotFoundException', 
    3333                                       'stubClassLoader' 
    3434                                 ); 
    35      
     35 
    3636    /** 
    3737     * Returns an array of tokens this test wants to listen for. 
    3838     * 
    39      * @return array 
     39     * @return array 
    4040     */ 
    4141    public function register() 
     
    5151     * Processes this test, when one of its tokens is encountered. 
    5252     * 
    53      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    54      * @param int                  $stackPtr  The position of the current token 
    55      *                                         in the stack passed in $tokens. 
    56      * 
    57      * @return void 
     53     * @param  PHP_CodeSniffer_File  $phpcsFile  The file being scanned. 
     54     * @param  int                   $stackPtr   The position of the current token 
     55     *                                           in the stack passed in $tokens. 
     56     * @return  void 
    5857     */ 
    5958    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassFileNameSniff.php

    r1286 r1309  
    11<?php 
    22/** 
    3  * This sniff checks for the camel case format and  
    4  * the (desired) prefix 'stub' in class names. 
     3 * Checks file and classname equality. 
    54 * 
    6  * @package   Classes 
    7  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Classes 
    87 */ 
    9  
     8require_once('stubClassExcluder.php'); 
    109/** 
    11  * This sniff checks for the camel case format and  
    12  * the (desired) prefix 'stub' in class names. 
     10 * Checks file and classname equality. 
    1311 * 
    1412 * Copied and adapted content from Squiz/Sniffs/Classes/ClassFileNameSniff 
    1513 * because of no extending possibility (no methods/attributes to overwrite). 
    16  *  
    17  * @package  Classes 
    18  */  
     14 * 
     15 * @package  Classes 
     16 */ 
    1917class Stubbles_Sniffs_Classes_stubClassFileNameSniff implements PHP_CodeSniffer_Sniff 
    2018{ 
    21     /* 
    22      * Stubbles 
    23      */ 
    24     /** 
    25      * exclude special classes 
    26      * 
    27      * @var array<string> 
    28      */ 
    29     protected $excludedClasses = array('stubClassLoader'); 
    30      
    3119    /** 
    3220     * Returns an array of tokens this test wants to listen for. 
    3321     * 
    34      * @return array 
     22     * @return array 
    3523     */ 
    3624    public function register() 
     
    4129               ); 
    4230    } 
    43      
     31 
    4432    /** 
    4533     * Processes this test, when one of its tokens is encountered. 
    4634     * 
    47      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    48      * @param int                  $stackPtr  The position of the current token in the 
    49      *                                        stack passed in $tokens. 
    50      * 
    51      * @return void 
     35     * @param  PHP_CodeSniffer_File  $phpcsFile  The file being scanned. 
     36     * @param  int                   $stackPtr   The position of the current token in the 
     37     *                                           stack passed in $tokens. 
     38     * @return  void 
    5239     */ 
    5340    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
    5441    { 
    55         $tokens   = $phpcsFile->getTokens(); 
    56         $decName  = $phpcsFile->findNext(T_STRING, $stackPtr); 
    57         $fullPath = basename($phpcsFile->getFilename()); 
    58         $fileName = substr($fullPath, 0, strrpos($fullPath, '.')); 
     42        $tokens    = $phpcsFile->getTokens(); 
     43        $decName   = $phpcsFile->findNext(T_STRING, $stackPtr); 
     44        $fullPath  = basename($phpcsFile->getFilename()); 
     45        $fileName  = substr($fullPath, 0, strrpos($fullPath, '.')); 
     46        $className = $tokens[$decName]['content']; 
    5947         
    60         if ($tokens[$decName]['content'] !== $fileName 
    61             && in_array($fileName, $this->excludedClasses) === false) { 
     48        if ($className !== $fileName 
     49            && stubClassExcluder::isExcluded($className) === false) { 
    6250            $error  = ucfirst($tokens[$stackPtr]['content']); 
    6351            $error .= ' name doesn\'t match filename. Expected '; 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubValidClassNameSniff.php

    r1144 r1309  
    11<?php 
    22/** 
    3  * This sniff checks for the camel case format and  
     3 * This sniff checks for the camel case format and 
    44 * the (desired) prefix 'stub' in class names. 
    55 * 
    6  * @package   Functions 
    7  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     7 * @package  Functions 
    88 */ 
    9  
     9require_once('stubClassExcluder.php'); 
    1010/** 
    11  * This sniff checks for the camel case format and  
     11 * This sniff checks for the camel case format and 
    1212 * the (desired) prefix 'stub' in class names. 
    1313 * 
     
    1515 * because of no extending possibility (no methods/attributes to overwrite). 
    1616 * 
    17  * @package  Functions 
     17 * @package  Functions 
    1818 */ 
    1919class Stubbles_Sniffs_Classes_stubValidClassNameSniff implements PHP_CodeSniffer_Sniff 
     
    2222     * Returns an array of tokens this test wants to listen for. 
    2323     * 
    24      * @return array 
     24     * @return array 
    2525     */ 
    2626    public function register() 
     
    3535     * Processes this test, when one of its tokens is encountered. 
    3636     * 
    37      * @param PHP_CodeSniffer_File $phpcsFile The current file being processed. 
    38      * @param int                  $stackPtr  The position of the current token in the 
    39      *                                        stack passed in $tokens. 
     37     * @param   PHP_CodeSniffer_File  $phpcsFile The current file being processed. 
     38     * @param   int                   $stackPtr   The position of the current token in the 
     39     *                                            stack passed in $tokens. 
    4040     * 
    41      * @return void 
     41     * @return void 
    4242     */ 
    4343    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    5252        $nameEnd   = $phpcsFile->findNext(T_WHITESPACE, $nameStart, $opener); 
    5353        $className = trim($phpcsFile->getTokensAsString($nameStart, ($nameEnd - $nameStart))); 
    54  
    55         /* 
    56          * Stubbles 
    57          */ 
    58         if ($className === 'Binford') { 
    59             // class name Binford is neither in camel caps nor 
    60             // prefixed with 'stub' but should be allowed. 
    61             return; 
    62         } 
     54        $camelCase = PHP_CodeSniffer::isCamelCaps($className, false, true, false); 
    6355         
    64         /* 
    65          * Stubbles 
    66          */ 
    67         // Check for 'stub' prefix in class name. 
    68         $stubPrefix = (substr($className,0,4) === 'stub')? true : false; 
    69         $vfsPrefix  = (substr($className,0,3) === 'vfs')? true : false; 
    70         if (false === $stubPrefix && false === $vfsPrefix) { 
     56        if ($camelCase === false 
     57            && stubClassExcluder::isExcluded($className) === false) { 
    7158            $type  = ucfirst($tokens[$stackPtr]['content']); 
    72             $error = "$type \"$className\" is not prefixed with \"stub\""; 
    73             $phpcsFile->addError($error, $stackPtr); 
    74         } 
    75          
    76         // Check for camel caps format. 
    77         $camelCase = PHP_CodeSniffer::isCamelCaps($className, false, true, false); 
    78         if ($camelCase === false) { 
    79             $type  = ucfirst($tokens[$stackPtr]['content']); 
    80             $error = "$type class name \"$className\" is not in camel caps format"; 
     59            $error = "$type \"$className\" is not in camel caps format"; 
    8160            $phpcsFile->addError($error, $stackPtr); 
    8261        } 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubClassCommentSniff.php

    r1264 r1309  
    33 * This sniff checks for class docblocks 
    44 * 
    5  * @author      Richard Sternagel <richard.sternagel@1und1.de> 
    6  * @package     Commenting 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Commenting 
    77 */ 
    88 
     
    3434 * because of no extending possibility (no methods/attributes to overwrite). 
    3535 * 
    36  * @package     Commenting 
     36 * @package  Commenting 
    3737 */ 
    3838 
     
    4242     * Returns an array of tokens this test wants to listen for. 
    4343     * 
    44      * @return array 
     44     * @return array 
    4545     */ 
    4646    public function register() 
     
    5252     * Processes this test, when one of its tokens is encountered. 
    5353     * 
    54      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    55      * @param int                  $stackPtr  The position of the current token in the 
    56      *                                        stack passed in $tokens. 
     54     * @param PHP_CodeSniffer_File  $phpcsFile The file being scanned. 
     55     * @param int                   $stackPtr   The position of the current token in the 
     56     *                                           stack passed in $tokens. 
    5757     * 
    58      * @return void 
     58     * @return void 
    5959     */ 
    6060    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    173173    } 
    174174 
    175     /* 
     175   /* 
    176176    * Stubbles 
    177177    */ 
    178178    // omitted @version checks 
    179179    // protected function processVersion($errorPos) { ... } 
    180  
    181180} 
    182181?> 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileCommentSniff.php

    r1264 r1309  
    33 * This sniff checks for file docblocks 
    44 * 
    5  * @author      Richard Sternagel <richard.sternagel@1und1.de> 
    6  * @package     Commenting 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Commenting 
    77 */ 
    88 
     
    1212 
    1313/** 
    14  * This sniff checks for class docblocks 
     14 * This sniff checks for file docblocks 
    1515 * 
    1616 * Verifies that : 
     
    2828 * because of no extending possibility (no methods/attributes to overwrite). 
    2929 * 
    30  * @package     Commenting 
     30 * @package  Commenting 
    3131 */ 
    3232 
     
    3636     * The header comment parser for the current file. 
    3737     * 
    38      * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 
     38     * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 
    3939     */ 
    4040    protected $commentParser = null; 
     
    4242     * The current PHP_CodeSniffer_File object we are processing. 
    4343     * 
    44      * @var PHP_CodeSniffer_File 
     44     * @var PHP_CodeSniffer_File 
    4545     */ 
    4646    protected $currentFile = null; 
     
    4848     * Returns an array of tokens this test wants to listen for. 
    4949     * 
    50      * @return array 
     50     * @return array 
    5151     */ 
    5252    public function register() 
     
    5858     * Processes this test, when one of its tokens is encountered. 
    5959     * 
    60      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    61      * @param int                  $stackPtr  The position of the current token 
    62      *                                        in the stack passed in $tokens. 
    63      * 
    64      * @return void 
     60     * @param   PHP_CodeSniffer_File  $phpcsFile  The file being scanned. 
     61     * @param   int                   $stackPtr   The position of the current token 
     62     *                                            in the stack passed in $tokens. 
     63     * @return  void 
    6564     */ 
    6665    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    200199     * Processes each required or optional tag. 
    201200     * 
    202      * @param int   $commentStart The position in the stack where the comment started. 
    203      * @param int   $commentEnd   The position in the stack where the comment ended. 
    204      * @param array $omitTags  Subclasses can omitted tags. 
    205      * 
    206      * @return void 
     201     * @param   int    $commentStart  The position in the stack where the comment started. 
     202     * @param   int    $commentEnd    The position in the stack where the comment ended. 
     203     * @param   array  $omitTags      Subclasses can omitted tags. 
     204     * @return  void 
    207205     */ 
    208206    protected function processTags($commentStart, $commentEnd, $omitTags = null) 
     
    247245         * Stubbles 
    248246         */ 
    249        if($omitTags !== null) { 
     247        if($omitTags !== null) { 
    250248            foreach ($omitTags as $tag) { 
    251                if(array_key_exists($tag, $tags)) { 
    252                    unset($tags[$tag]); 
    253                
    254             } 
    255        } 
     249                if(array_key_exists($tag, $tags)) { 
     250                    unset($tags[$tag]); 
     251               
     252            } 
     253        } 
    256254 
    257255 
     
    389387     * Get the indentation information of each tag. 
    390388     * 
    391      * @param string                                   $tagName    The name of the doc comment element. 
    392      * @param PHP_CodeSniffer_CommentParser_DocElement $tagElement The doc comment element. 
    393      * 
    394      * @return void 
     389     * @param string                                    $tagName     The name of the doc comment element. 
     390     * @param PHP_CodeSniffer_CommentParser_DocElement  $tagElement The doc comment element. 
     391     * 
     392     * @return void 
    395393     */ 
    396394    protected function getIndentation($tagName, $tagElement) 
     
    412410     * Process the package tag. 
    413411     * 
    414      * @param int $errorPos The line number where the error occurs. 
    415      * 
    416      * @return void 
     412     * @param   int   $errorPos  The line number where the error occurs. 
     413     * @return  void 
    417414     */ 
    418415    protected function processPackage($errorPos) 
     
    436433     * Process the subpackage tag. 
    437434     * 
    438      * @param int $errorPos The line number where the error occurs. 
    439      * 
    440      * @return void 
     435     * @param   int   $errorPos  The line number where the error occurs. 
     436     * 
     437     * @return void 
    441438     */ 
    442439    protected function processSubpackage($errorPos) 
     
    464461     * the errorPos for each element separately 
    465462     * 
    466      * @param int $commentStart The position in the stack where 
    467      *                          the comment started. 
    468      * 
    469      * @return void 
     463     * @param   int  $commentStart  The position in the stack where 
     464     *                              the comment started. 
     465     * @return  void 
    470466     */ 
    471467    protected function processAuthors($commentStart) 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileEqualsClassCommentSniff.php

    r1292 r1309  
    33 * This sniff checks the equality of file and class doc block. 
    44 * 
    5  * @package   Commenting 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Commenting 
    77 */ 
    88 
    99/** 
    1010 * This sniff checks the equality of file and class doc block. 
    11  *  
    12  * @package  Commenting 
    13  */  
     11 * 
     12 * @package  Commenting 
     13 */ 
    1414class Stubbles_Sniffs_Commenting_stubFileEqualsClassCommentSniff implements PHP_CodeSniffer_Sniff 
    1515{ 
     
    1717     * tags which are only used in file doc blocks. 
    1818     * 
    19      * @var array<strings> 
     19     * @var array<strings> 
    2020     */ 
    2121    protected $excludedFileTags = array('@author'); 
    22      
     22 
    2323    /** 
    2424     * Returns an array of tokens this test wants to listen for. 
    2525     * 
    26      * @return array 
     26     * @return array 
    2727     */ 
    2828    public function register() 
     
    3030        return array(T_CLASS); 
    3131    } 
    32      
     32 
    3333    /** 
    3434     * Processes this test, when one of its tokens is encountered. 
    3535     * 
    36      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    37      * @param int                  $stackPtr  The position of the current token in the 
    38      *                                        stack passed in $tokens. 
     36     * @param  PHP_CodeSniffer_File  $phpcsFile  The file being scanned. 
     37     * @param  int                   $stackPtr   The position of the current token in the 
    3938     * 
    40      * @return void 
     39     * @return void 
    4140     */ 
    4241    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    4645            return; 
    4746        } 
    48          
     47 
    4948        $tokens = $phpcsFile->getTokens(); 
    5049        $fileComments  = array(); 
    5150        $classComments = array(); 
    52          
     51 
    5352        for($i = 0; $i < $stackPtr; $i++) { 
    5453            if ($tokens[$i]['type'] === 'T_DOC_COMMENT') { 
    5554                $length = count($fileComments); 
    5655                $line   = trim($tokens[$i]['content']); 
    57                  
     56 
    5857                foreach ($this->excludedFileTags as $tag) { 
    5958                    if (preg_match('/^' .$tag .'.*/', substr($line, 2)) === 1) { 
     
    6261                    } 
    6362                } 
    64                  
     63 
    6564                if($i === 1 || $fileComments[$length-1] !== '*/') { 
    66                    $fileComments[] = $line; 
     65                    $fileComments[] = $line; 
    6766                } else { 
    68                    $classComments[] = $line; 
     67                    $classComments[] = $line; 
    6968                } 
    7069            } 
    7170        } 
    72             
     71 
    7372        // diffs only in one direction: file -> class 
    7473        $diff = array_diff($fileComments, $classComments); 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFunctionCommentSniff.php

    r1300 r1309  
    33 * Parses and verifies the doc comments for functions. 
    44 * 
    5  * @package   Commenting 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Commenting 
    77 */ 
    88 
     
    3232 * because of no extending possibility (no methods/attributes to overwrite). 
    3333 * 
    34  * @package  Commenting 
     34 * @package  Commenting 
    3535 */ 
    3636class Stubbles_Sniffs_Commenting_stubFunctionCommentSniff implements PHP_CodeSniffer_Sniff 
     
    3939     * The name of the method that we are currently processing. 
    4040     * 
    41      * @var string 
     41     * @var string 
    4242     */ 
    4343    private $_methodName = ''; 
     
    4545     * The position in the stack where the fucntion token was found. 
    4646     * 
    47      * @var int 
     47     * @var int 
    4848     */ 
    4949    private $_functionToken = null; 
     
    5151     * The position in the stack where the class token was found. 
    5252     * 
    53      * @var int 
     53     * @var int 
    5454     */ 
    5555    private $_classToken = null; 
     
    5757     * The function comment parser for the current method. 
    5858     * 
    59      * @var PHP_CodeSniffer_Comment_Parser_FunctionCommentParser 
     59     * @var PHP_CodeSniffer_Comment_Parser_FunctionCommentParser 
    6060     */ 
    6161    protected $commentParser = null; 
     
    6363     * The current PHP_CodeSniffer_File object we are processing. 
    6464     * 
    65      * @var PHP_CodeSniffer_File 
     65     * @var PHP_CodeSniffer_File 
    6666     */ 
    6767    protected $currentFile = null; 
     
    7070     * Returns an array of tokens this test wants to listen for. 
    7171     * 
    72      * @return array 
     72     * @return array 
    7373     */ 
    7474    public function register() 
     
    8080     * Processes this test, when one of its tokens is encountered. 
    8181     * 
    82      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    83      * @param int                  $stackPtr  The position of the current token 
    84      *                                        in the stack passed in $tokens. 
    85      * 
    86      * @return void 
     82     * @param   PHP_CodeSniffer_File  $phpcsFile The file being scanned. 
     83     * @param   int                   $stackPtr   The position of the current token 
     84     *                                            in the stack passed in $tokens. 
     85     * 
     86     * @return void 
    8787     */ 
    8888    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    244244     * Process any throw tags that this function comment has. 
    245245     * 
    246      * @param int $commentStart The position in the stack where the 
    247      *                          comment started. 
    248      * 
    249      * @return void 
     246     * @param   int  $commentStart  The position in the stack where the 
     247     *                              comment started. 
     248     * @return  void 
    250249     */ 
    251250    protected function processThrows($commentStart) 
     
    286285     * Process the return comment of this function comment. 
    287286     * 
    288      * @param int       $commentStart The position in the stack where the comment started. 
    289      * @param int       $commentEnd   The position in the stack where the comment ended. 
    290      * @param int|false $return       The file tokens 
    291      * 
    292      * @return void 
     287     * @param   int        $commentStart The position in the stack where the comment started. 
     288     * @param   int        $commentEnd    The position in the stack where the comment ended. 
     289     * @param   int|false  $return        The file tokens 
     290     * 
     291     * @return void 
    293292     */ 
    294293    protected function processReturn($commentStart, $commentEnd, $return) 
     
    344343     * Process the function parameter comments. 
    345344     * 
    346      * @param int $commentStart The position in the stack where 
    347      *                          the comment started. 
    348      * 
     345     * @param   int  $commentStart  The position in the stack where 
     346     *                              the comment started. 
    349347     * @return  void 
    350348     */ 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubVariableCommentSniff.php

    r1295 r1309  
    33 * Parses and verifies the variable doc comment. 
    44 * 
    5  * @package  Commenting 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @package  Commenting 
     6 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
    77 */ 
    88 
     
    2828 * Copied and adapted content from Squiz/Sniffs/Commenting/VariableCommentSniff 
    2929 * because of no extending possibility (no methods/attributes to overwrite). 
    30  *  
    31  * @package  Commenting 
     30 * 
     31 * @package  Commenting 
    3232 */ 
    3333 
     
    3737     * The header comment parser for the current file. 
    3838     * 
    39      * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 
     39     * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 
    4040     */ 
    4141    protected $commentParser = null; 
     
    4444     * Called to process class member vars. 
    4545     * 
    46      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    47      * @param int                  $stackPtr  The position of the current token 
    48      *                                        in the stack passed in $tokens. 
    49      * 
    50      * @return void 
     46     * @param   PHP_CodeSniffer_File  $phpcsFile  The file being scanned. 
     47     * @param   int                   $stackPtr   The position of the current token 
     48     *                                            in the stack passed in $tokens. 
     49     * @return  void 
    5150     */ 
    5251    public function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    188187        // Check each tag. 
    189188        $this->processVar($commentStart, $commentEnd); 
    190          
     189 
    191190        /* 
    192191         * Stubbles 
     
    199198     * Process the var tag. 
    200199     * 
    201      * @param int $commentStart The position in the stack where the comment started. 
    202      * @param int $commentEnd   The position in the stack where the comment ended. 
    203      * 
    204      * @return void 
     200     * @param   int  $commentStart The position in the stack where the comment started. 
     201     * @param   int  $commentEnd    The position in the stack where the comment ended. 
     202     * 
     203     * @return void 
    205204     */ 
    206205    protected function processVar($commentStart, $commentEnd) 
     
    268267     * Not required for this sniff. 
    269268     * 
    270      * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this token was found. 
    271      * @param int                  $stackPtr  The position where the double quoted 
    272      *                                        string was found. 
    273      * 
    274      * @return void 
     269     * @param   PHP_CodeSniffer_File  $phpcsFile  The PHP_CodeSniffer file where this token was found. 
     270     * @param   int                   $stackPtr   The position where the double quoted 
     271     *                                             string was found. 
     272     * @return  void 
    275273     */ 
    276274    protected function processVariable(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    284282     * Not required for this sniff. 
    285283     * 
    286      * @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this token was found. 
    287      * @param int                  $stackPtr  The position where the double quoted 
    288      *                                        string was found. 
    289      * 
    290      * @return void 
     284     * @param   PHP_CodeSniffer_File  $phpcsFile  The PHP_CodeSniffer file where this token was found. 
     285     * @param   int                   $stackPtr   The position where the double quoted 
     286     *                                            string was found. 
     287     * @return  void 
    291288     */ 
    292289    protected function processVariableInString(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/ControlStructures/stubSwitchDeclarationSniff.php

    r1292 r1309  
    33 * This sniff checks for switch structures and 
    44 * validates them against a Stubbles specific 
    5  * switch structure Coding Standard 
     5 * switch structure Coding Standard. 
    66 * 
    7  * @author      Richard Sternagel <richard.sternagel@1und1.de> 
    8  * @package     ControlStructures 
     7 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     8 * @package  ControlStructures 
    99 */ 
    1010 
    1111/** 
    1212 * This sniff checks for switch structures and 
    13  * validates them against an Stubbles specific 
    14  * switch structure Coding Standard 
     13 * validates them against a Stubbles specific 
     14 * switch structure Coding Standard. 
    1515 * 
    1616 * Copied and adapted content from Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff 
    1717 * because of no extending possibility (no methods/attributes to overwrite). 
    1818 * 
    19  * @package     ControlStructures 
     19 * @package  ControlStructures 
    2020 */ 
    2121class Stubbles_Sniffs_ControlStructures_stubSwitchDeclarationSniff implements PHP_CodeSniffer_Sniff 
     
    2424     * Returns an array of tokens this test wants to listen for. 
    2525     * 
    26      * @return array 
     26     * @return array 
    2727     */ 
    2828    public function register() 
     
    3434     * Processes this test, when one of its tokens is encountered. 
    3535     * 
    36      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    37      * @param int                  $stackPtr  The position of the current token in the 
    38      *                                        stack passed in $tokens. 
     36     * @param PHP_CodeSniffer_File  $phpcsFile The file being scanned. 
     37     * @param int                   $stackPtr   The position of the current token in the 
     38     *                                           stack passed in $tokens. 
    3939     * 
    40      * @return void 
     40     * @return void 
    4141     */ 
    4242    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
     
    4747        $nextCase      = $stackPtr; 
    4848        $caseAlignment = ($switch['column'] + 4); 
    49          
     49 
    5050        /* 
    5151         * Stubbles (no CASE statement at all should produce an error) 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Formatting/stubSpaceAfterCastSniff.php

    r1131 r1309  
    33 * This sniff ensures that there is a space after cast tokens. 
    44 * 
    5  * @package   Formatting 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Formatting 
    77 */ 
    88 
     
    1010 * This sniff ensures that there is a space after cast tokens. 
    1111 * 
    12  * @package  Formatting 
     12 * @package  Formatting 
    1313 */ 
    1414class Stubbles_Sniffs_Formatting_stubSpaceAfterCastSniff implements PHP_CodeSniffer_Sniff 
     
    1717     * Returns an array of tokens this test wants to listen for. 
    1818     * 
    19      * @return array 
     19     * @return array 
    2020     */ 
    2121    public function register() 
    2222    { 
    2323        return PHP_CodeSniffer_Tokens::$castTokens; 
    24  
    2524    } 
    2625 
     
    2827     * Processes this test, when one of its tokens is encountered. 
    2928     * 
    30      * @param PHP_CodeSniffer_File $phpcsFile The file being scanned. 
    31      * @param int                  $stackPtr  The position of the current token in 
    32      *                                        the stack passed in $tokens. 
    33      * 
    34      * @return void 
     29     * @param   PHP_CodeSniffer_File   $phpcsFile  The file being scanned. 
     30     * @param   int                    $stackPtr   The position of the current token in 
     31     *                                             the stack passed in $tokens. 
     32     * @return  void 
    3533     */ 
    3634    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 
  • trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Functions/stubFunctionCallSignatureSniff.php

    r1286 r1309  
    33 * This sniff checks for whitespace in functions calls: 
    44 * 
    5  * @package   Functions 
    6  * @author    Richard Sternagel <richard.sternagel@1und1.de> 
     5 * @author   Richard Sternagel <richard.sternagel@1und1.de> 
     6 * @package  Functions 
    77 */ 
    88 
     
    1515 *  <li>my_function(...)[*]</li> 
    1616 * </ul> 
    17  *  
     17 * 
    1818 * Multiline Methods should close on the same column: 
    1919 * So this is allowed: 
     
    3232 * Copied and adapted content from PEAR/Sniffs/Functions/FunctionCallSignatureSniff 
    3333 * because of no extending possibility (no methods/attributes to overwrite). 
    34  *  
    35  * @package  Functions 
     34 * 
     35 * @package  Functions 
    3636 */ 
    3737class Stubbles_Sniffs_Functions_stubFunctionCallSignatureSniff implements PHP_CodeSniffer_Sniff 
     
    4040     * Returns an array of tokens this test wants to listen for. 
    4141     * 
    42      * @return array 
     42