diff --git a/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/FunctionCommentSniff.php b/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/FunctionCommentSniff.php index 356eca2..7eb64da 100644 --- a/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/FunctionCommentSniff.php +++ b/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/FunctionCommentSniff.php @@ -31,7 +31,15 @@ */ class Barracuda_Sniffs_Commenting_FunctionCommentSniff extends PEAR_Sniffs_Commenting_FunctionCommentSniff { - protected $customAllowedTypes = array('bool', 'int'); + protected $allowedTypes = array( + 'int', + 'bool', + ); + + public function __construct() + { + PHP_CodeSniffer::$allowedTypes = array_merge(PHP_CodeSniffer::$allowedTypes, $this->allowedTypes); + } /** * Process the return comment of this function comment. @@ -81,13 +89,6 @@ protected function processReturn(PHP_CodeSniffer_File $phpcsFile, $stackPtr, $co $suggestedName = PHP_CodeSniffer::suggestType($typeName); if (in_array($suggestedName, $suggestedNames) === false) { $suggestedNames[] = $suggestedName; - if ($suggestedName == 'boolean') { - $suggestedNames[] = 'bool'; - } - - if ($suggestedName == 'integer') { - $suggestedNames[] = 'int'; - } } } diff --git a/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/VariableCommentSniff.php b/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/VariableCommentSniff.php index 46c3031..56d0596 100644 --- a/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/VariableCommentSniff.php +++ b/PHP_CodeSniffer/Barracuda/Sniffs/Commenting/VariableCommentSniff.php @@ -32,7 +32,15 @@ class Barracuda_Sniffs_Commenting_VariableCommentSniff extends PHP_CodeSniffer_Standards_AbstractVariableSniff { - protected $customAllowedTypes = array('bool', 'int'); + protected $allowedTypes = array( + 'bool', + 'int', + ); + + public function __construct() + { + PHP_CodeSniffer::$allowedTypes = array_merge(PHP_CodeSniffer::$allowedTypes, $this->allowedTypes); + } /** * Called to process class member vars. @@ -120,7 +128,7 @@ public function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr) $varType = $tokens[($foundVar + 2)]['content']; $suggestedType = PHP_CodeSniffer::suggestType($varType); - if ($varType !== $suggestedType && !in_array($varType, $this->customAllowedTypes)) { + if ($varType !== $suggestedType) { $error = 'Expected "%s" but found "%s" for @var tag in member variable comment'; $data = array( $suggestedType,