Changeset 1309
- Timestamp:
- 01/29/08 11:35:27 (9 months ago)
- Files:
-
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassDeclarationSniff.php (modified) (4 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassExcluder.php (added)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassFileNameSniff.php (modified) (2 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubValidClassNameSniff.php (modified) (5 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubClassCommentSniff.php (modified) (5 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileCommentSniff.php (modified) (13 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileEqualsClassCommentSniff.php (modified) (5 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFunctionCommentSniff.php (modified) (12 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubVariableCommentSniff.php (modified) (8 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/ControlStructures/stubSwitchDeclarationSniff.php (modified) (4 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Formatting/stubSpaceAfterCastSniff.php (modified) (4 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Functions/stubFunctionCallSignatureSniff.php (modified) (11 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/WhiteSpace/stubDisallowTrailingWhitespaceSniff.php (modified) (5 diffs)
- trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/StubblesCodingStandard.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassDeclarationSniff.php
r1286 r1309 1 1 <?php 2 2 /** 3 * C lass/Interface Declaration Test.3 * Checks whitespace at the declaration of a class/interface 4 4 * 5 * @ package Classes6 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Classes 7 7 */ 8 8 … … 13 13 14 14 /** 15 * Checks the declaration of the class and its inheritance is correct.15 * Checks whitespace at the declaration of a class/interface 16 16 * 17 17 * Copied and adapted content from Squiz/Sniffs/Classes/ClassDeclarationSniff 18 18 * because of no extending possibility (no methods/attributes to overwrite). 19 19 * 20 * @package Classes20 * @package Classes 21 21 */ 22 22 class Stubbles_Sniffs_Classes_stubClassDeclarationSniff extends PEAR_Sniffs_Classes_ClassDeclarationSniff … … 28 28 * exclude special classes 29 29 * 30 * @var array<string>31 */ 32 protected $excludedClasses = array('stubClassNotFoundException', 30 * @var array<string> 31 */ 32 protected $excludedClasses = array('stubClassNotFoundException', 33 33 'stubClassLoader' 34 34 ); 35 35 36 36 /** 37 37 * Returns an array of tokens this test wants to listen for. 38 38 * 39 * @return array39 * @return array 40 40 */ 41 41 public function register() … … 51 51 * Processes this test, when one of its tokens is encountered. 52 52 * 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 58 57 */ 59 58 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubClassFileNameSniff.php
r1286 r1309 1 1 <?php 2 2 /** 3 * This sniff checks for the camel case format and 4 * the (desired) prefix 'stub' in class names. 3 * Checks file and classname equality. 5 4 * 6 * @ package Classes7 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Classes 8 7 */ 9 8 require_once('stubClassExcluder.php'); 10 9 /** 11 * This sniff checks for the camel case format and 12 * the (desired) prefix 'stub' in class names. 10 * Checks file and classname equality. 13 11 * 14 12 * Copied and adapted content from Squiz/Sniffs/Classes/ClassFileNameSniff 15 13 * because of no extending possibility (no methods/attributes to overwrite). 16 * 17 * @package Classes18 */ 14 * 15 * @package Classes 16 */ 19 17 class Stubbles_Sniffs_Classes_stubClassFileNameSniff implements PHP_CodeSniffer_Sniff 20 18 { 21 /*22 * Stubbles23 */24 /**25 * exclude special classes26 *27 * @var array<string>28 */29 protected $excludedClasses = array('stubClassLoader');30 31 19 /** 32 20 * Returns an array of tokens this test wants to listen for. 33 21 * 34 * @return array22 * @return array 35 23 */ 36 24 public function register() … … 41 29 ); 42 30 } 43 31 44 32 /** 45 33 * Processes this test, when one of its tokens is encountered. 46 34 * 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 52 39 */ 53 40 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) 54 41 { 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']; 59 47 60 if ($ tokens[$decName]['content']!== $fileName61 && in_array($fileName, $this->excludedClasses) === false) {48 if ($className !== $fileName 49 && stubClassExcluder::isExcluded($className) === false) { 62 50 $error = ucfirst($tokens[$stackPtr]['content']); 63 51 $error .= ' name doesn\'t match filename. Expected '; trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Classes/stubValidClassNameSniff.php
r1144 r1309 1 1 <?php 2 2 /** 3 * This sniff checks for the camel case format and 3 * This sniff checks for the camel case format and 4 4 * the (desired) prefix 'stub' in class names. 5 5 * 6 * @ package Functions7 * @ author Richard Sternagel <richard.sternagel@1und1.de>6 * @author Richard Sternagel <richard.sternagel@1und1.de> 7 * @package Functions 8 8 */ 9 9 require_once('stubClassExcluder.php'); 10 10 /** 11 * This sniff checks for the camel case format and 11 * This sniff checks for the camel case format and 12 12 * the (desired) prefix 'stub' in class names. 13 13 * … … 15 15 * because of no extending possibility (no methods/attributes to overwrite). 16 16 * 17 * @package Functions17 * @package Functions 18 18 */ 19 19 class Stubbles_Sniffs_Classes_stubValidClassNameSniff implements PHP_CodeSniffer_Sniff … … 22 22 * Returns an array of tokens this test wants to listen for. 23 23 * 24 * @return array24 * @return array 25 25 */ 26 26 public function register() … … 35 35 * Processes this test, when one of its tokens is encountered. 36 36 * 37 * @param PHP_CodeSniffer_File $phpcsFileThe current file being processed.38 * @param int $stackPtrThe position of the current token in the39 * 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. 40 40 * 41 * @return void41 * @return void 42 42 */ 43 43 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 52 52 $nameEnd = $phpcsFile->findNext(T_WHITESPACE, $nameStart, $opener); 53 53 $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); 63 55 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) { 71 58 $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"; 81 60 $phpcsFile->addError($error, $stackPtr); 82 61 } trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubClassCommentSniff.php
r1264 r1309 3 3 * This sniff checks for class docblocks 4 4 * 5 * @author Richard Sternagel <richard.sternagel@1und1.de>6 * @package Commenting5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Commenting 7 7 */ 8 8 … … 34 34 * because of no extending possibility (no methods/attributes to overwrite). 35 35 * 36 * @package Commenting36 * @package Commenting 37 37 */ 38 38 … … 42 42 * Returns an array of tokens this test wants to listen for. 43 43 * 44 * @return array44 * @return array 45 45 */ 46 46 public function register() … … 52 52 * Processes this test, when one of its tokens is encountered. 53 53 * 54 * @param PHP_CodeSniffer_File $phpcsFileThe file being scanned.55 * @param int $stackPtrThe position of the current token in the56 * 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. 57 57 * 58 * @return void58 * @return void 59 59 */ 60 60 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 173 173 } 174 174 175 /*175 /* 176 176 * Stubbles 177 177 */ 178 178 // omitted @version checks 179 179 // protected function processVersion($errorPos) { ... } 180 181 180 } 182 181 ?> trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileCommentSniff.php
r1264 r1309 3 3 * This sniff checks for file docblocks 4 4 * 5 * @author Richard Sternagel <richard.sternagel@1und1.de>6 * @package Commenting5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Commenting 7 7 */ 8 8 … … 12 12 13 13 /** 14 * This sniff checks for classdocblocks14 * This sniff checks for file docblocks 15 15 * 16 16 * Verifies that : … … 28 28 * because of no extending possibility (no methods/attributes to overwrite). 29 29 * 30 * @package Commenting30 * @package Commenting 31 31 */ 32 32 … … 36 36 * The header comment parser for the current file. 37 37 * 38 * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser38 * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 39 39 */ 40 40 protected $commentParser = null; … … 42 42 * The current PHP_CodeSniffer_File object we are processing. 43 43 * 44 * @var PHP_CodeSniffer_File44 * @var PHP_CodeSniffer_File 45 45 */ 46 46 protected $currentFile = null; … … 48 48 * Returns an array of tokens this test wants to listen for. 49 49 * 50 * @return array50 * @return array 51 51 */ 52 52 public function register() … … 58 58 * Processes this test, when one of its tokens is encountered. 59 59 * 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 65 64 */ 66 65 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 200 199 * Processes each required or optional tag. 201 200 * 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 207 205 */ 208 206 protected function processTags($commentStart, $commentEnd, $omitTags = null) … … 247 245 * Stubbles 248 246 */ 249 if($omitTags !== null) {247 if($omitTags !== null) { 250 248 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 } 256 254 257 255 … … 389 387 * Get the indentation information of each tag. 390 388 * 391 * @param string $tagNameThe name of the doc comment element.392 * @param PHP_CodeSniffer_CommentParser_DocElement $tagElementThe doc comment element.393 * 394 * @return void389 * @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 395 393 */ 396 394 protected function getIndentation($tagName, $tagElement) … … 412 410 * Process the package tag. 413 411 * 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 417 414 */ 418 415 protected function processPackage($errorPos) … … 436 433 * Process the subpackage tag. 437 434 * 438 * @param int $errorPosThe line number where the error occurs.439 * 440 * @return void435 * @param int $errorPos The line number where the error occurs. 436 * 437 * @return void 441 438 */ 442 439 protected function processSubpackage($errorPos) … … 464 461 * the errorPos for each element separately 465 462 * 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 470 466 */ 471 467 protected function processAuthors($commentStart) trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFileEqualsClassCommentSniff.php
r1292 r1309 3 3 * This sniff checks the equality of file and class doc block. 4 4 * 5 * @ package Commenting6 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Commenting 7 7 */ 8 8 9 9 /** 10 10 * This sniff checks the equality of file and class doc block. 11 * 12 * @package Commenting13 */ 11 * 12 * @package Commenting 13 */ 14 14 class Stubbles_Sniffs_Commenting_stubFileEqualsClassCommentSniff implements PHP_CodeSniffer_Sniff 15 15 { … … 17 17 * tags which are only used in file doc blocks. 18 18 * 19 * @var array<strings>19 * @var array<strings> 20 20 */ 21 21 protected $excludedFileTags = array('@author'); 22 22 23 23 /** 24 24 * Returns an array of tokens this test wants to listen for. 25 25 * 26 * @return array26 * @return array 27 27 */ 28 28 public function register() … … 30 30 return array(T_CLASS); 31 31 } 32 32 33 33 /** 34 34 * Processes this test, when one of its tokens is encountered. 35 35 * 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 39 38 * 40 * @return void39 * @return void 41 40 */ 42 41 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 46 45 return; 47 46 } 48 47 49 48 $tokens = $phpcsFile->getTokens(); 50 49 $fileComments = array(); 51 50 $classComments = array(); 52 51 53 52 for($i = 0; $i < $stackPtr; $i++) { 54 53 if ($tokens[$i]['type'] === 'T_DOC_COMMENT') { 55 54 $length = count($fileComments); 56 55 $line = trim($tokens[$i]['content']); 57 56 58 57 foreach ($this->excludedFileTags as $tag) { 59 58 if (preg_match('/^' .$tag .'.*/', substr($line, 2)) === 1) { … … 62 61 } 63 62 } 64 63 65 64 if($i === 1 || $fileComments[$length-1] !== '*/') { 66 $fileComments[] = $line;65 $fileComments[] = $line; 67 66 } else { 68 $classComments[] = $line;67 $classComments[] = $line; 69 68 } 70 69 } 71 70 } 72 71 73 72 // diffs only in one direction: file -> class 74 73 $diff = array_diff($fileComments, $classComments); trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubFunctionCommentSniff.php
r1300 r1309 3 3 * Parses and verifies the doc comments for functions. 4 4 * 5 * @ package Commenting6 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Commenting 7 7 */ 8 8 … … 32 32 * because of no extending possibility (no methods/attributes to overwrite). 33 33 * 34 * @package Commenting34 * @package Commenting 35 35 */ 36 36 class Stubbles_Sniffs_Commenting_stubFunctionCommentSniff implements PHP_CodeSniffer_Sniff … … 39 39 * The name of the method that we are currently processing. 40 40 * 41 * @var string41 * @var string 42 42 */ 43 43 private $_methodName = ''; … … 45 45 * The position in the stack where the fucntion token was found. 46 46 * 47 * @var int47 * @var int 48 48 */ 49 49 private $_functionToken = null; … … 51 51 * The position in the stack where the class token was found. 52 52 * 53 * @var int53 * @var int 54 54 */ 55 55 private $_classToken = null; … … 57 57 * The function comment parser for the current method. 58 58 * 59 * @var PHP_CodeSniffer_Comment_Parser_FunctionCommentParser59 * @var PHP_CodeSniffer_Comment_Parser_FunctionCommentParser 60 60 */ 61 61 protected $commentParser = null; … … 63 63 * The current PHP_CodeSniffer_File object we are processing. 64 64 * 65 * @var PHP_CodeSniffer_File65 * @var PHP_CodeSniffer_File 66 66 */ 67 67 protected $currentFile = null; … … 70 70 * Returns an array of tokens this test wants to listen for. 71 71 * 72 * @return array72 * @return array 73 73 */ 74 74 public function register() … … 80 80 * Processes this test, when one of its tokens is encountered. 81 81 * 82 * @param PHP_CodeSniffer_File $phpcsFileThe file being scanned.83 * @param int $stackPtrThe position of the current token84 * in the stack passed in $tokens.85 * 86 * @return void82 * @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 87 87 */ 88 88 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 244 244 * Process any throw tags that this function comment has. 245 245 * 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 250 249 */ 251 250 protected function processThrows($commentStart) … … 286 285 * Process the return comment of this function comment. 287 286 * 288 * @param int $commentStartThe position in the stack where the comment started.289 * @param int $commentEndThe position in the stack where the comment ended.290 * @param int|false $returnThe file tokens291 * 292 * @return void287 * @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 293 292 */ 294 293 protected function processReturn($commentStart, $commentEnd, $return) … … 344 343 * Process the function parameter comments. 345 344 * 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. 349 347 * @return void 350 348 */ trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Commenting/stubVariableCommentSniff.php
r1295 r1309 3 3 * Parses and verifies the variable doc comment. 4 4 * 5 * @package Commenting6 * @author Richard Sternagel <richard.sternagel@1und1.de>5 * @package Commenting 6 * @author Richard Sternagel <richard.sternagel@1und1.de> 7 7 */ 8 8 … … 28 28 * Copied and adapted content from Squiz/Sniffs/Commenting/VariableCommentSniff 29 29 * because of no extending possibility (no methods/attributes to overwrite). 30 * 31 * @package Commenting30 * 31 * @package Commenting 32 32 */ 33 33 … … 37 37 * The header comment parser for the current file. 38 38 * 39 * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser39 * @var PHP_CodeSniffer_Comment_Parser_ClassCommentParser 40 40 */ 41 41 protected $commentParser = null; … … 44 44 * Called to process class member vars. 45 45 * 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 51 50 */ 52 51 public function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 188 187 // Check each tag. 189 188 $this->processVar($commentStart, $commentEnd); 190 189 191 190 /* 192 191 * Stubbles … … 199 198 * Process the var tag. 200 199 * 201 * @param int $commentStartThe position in the stack where the comment started.202 * @param int $commentEndThe position in the stack where the comment ended.203 * 204 * @return void200 * @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 205 204 */ 206 205 protected function processVar($commentStart, $commentEnd) … … 268 267 * Not required for this sniff. 269 268 * 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 275 273 */ 276 274 protected function processVariable(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 284 282 * Not required for this sniff. 285 283 * 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 291 288 */ 292 289 protected function processVariableInString(PHP_CodeSniffer_File $phpcsFile, $stackPtr) trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/ControlStructures/stubSwitchDeclarationSniff.php
r1292 r1309 3 3 * This sniff checks for switch structures and 4 4 * validates them against a Stubbles specific 5 * switch structure Coding Standard 5 * switch structure Coding Standard. 6 6 * 7 * @author Richard Sternagel <richard.sternagel@1und1.de>8 * @package ControlStructures7 * @author Richard Sternagel <richard.sternagel@1und1.de> 8 * @package ControlStructures 9 9 */ 10 10 11 11 /** 12 12 * This sniff checks for switch structures and 13 * validates them against a nStubbles specific14 * switch structure Coding Standard 13 * validates them against a Stubbles specific 14 * switch structure Coding Standard. 15 15 * 16 16 * Copied and adapted content from Squiz/Sniffs/ControlStructures/SwitchDeclarationSniff 17 17 * because of no extending possibility (no methods/attributes to overwrite). 18 18 * 19 * @package ControlStructures19 * @package ControlStructures 20 20 */ 21 21 class Stubbles_Sniffs_ControlStructures_stubSwitchDeclarationSniff implements PHP_CodeSniffer_Sniff … … 24 24 * Returns an array of tokens this test wants to listen for. 25 25 * 26 * @return array26 * @return array 27 27 */ 28 28 public function register() … … 34 34 * Processes this test, when one of its tokens is encountered. 35 35 * 36 * @param PHP_CodeSniffer_File $phpcsFileThe file being scanned.37 * @param int $stackPtrThe position of the current token in the38 * 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. 39 39 * 40 * @return void40 * @return void 41 41 */ 42 42 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) … … 47 47 $nextCase = $stackPtr; 48 48 $caseAlignment = ($switch['column'] + 4); 49 49 50 50 /* 51 51 * Stubbles (no CASE statement at all should produce an error) trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Formatting/stubSpaceAfterCastSniff.php
r1131 r1309 3 3 * This sniff ensures that there is a space after cast tokens. 4 4 * 5 * @ package Formatting6 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Formatting 7 7 */ 8 8 … … 10 10 * This sniff ensures that there is a space after cast tokens. 11 11 * 12 * @package Formatting12 * @package Formatting 13 13 */ 14 14 class Stubbles_Sniffs_Formatting_stubSpaceAfterCastSniff implements PHP_CodeSniffer_Sniff … … 17 17 * Returns an array of tokens this test wants to listen for. 18 18 * 19 * @return array19 * @return array 20 20 */ 21 21 public function register() 22 22 { 23 23 return PHP_CodeSniffer_Tokens::$castTokens; 24 25 24 } 26 25 … … 28 27 * Processes this test, when one of its tokens is encountered. 29 28 * 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 35 33 */ 36 34 public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) trunk/src/main/php/org/stubbles/codeSniffer/Stubbles/Sniffs/Functions/stubFunctionCallSignatureSniff.php
r1286 r1309 3 3 * This sniff checks for whitespace in functions calls: 4 4 * 5 * @ package Functions6 * @ author Richard Sternagel <richard.sternagel@1und1.de>5 * @author Richard Sternagel <richard.sternagel@1und1.de> 6 * @package Functions 7 7 */ 8 8 … … 15 15 * <li>my_function(...)[*]</li> 16 16 * </ul> 17 * 17 * 18 18 * Multiline Methods should close on the same column: 19 19 * So this is allowed: … … 32 32 * Copied and adapted content from PEAR/Sniffs/Functions/FunctionCallSignatureSniff 33 33 * because of no extending possibility (no methods/attributes to overwrite). 34 * 35 * @package Functions34 * 35 * @package Functions 36 36 */ 37 37 class Stubbles_Sniffs_Functions_stubFunctionCallSignatureSniff implements PHP_CodeSniffer_Sniff … … 40 40 * Returns an array of tokens this test wants to listen for. 41 41 * 42 * @return array42
