diff --git a/.travis.yml b/.travis.yml index 9e258ad6..6c1f97ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: php php: - - 5.3 - - 5.4 - 5.5 - 5.6 + - 7.1 + - 7.2 before_script: - mv ../cakephp-codesniffer ../cakephp_codesniffer && cd ../cakephp_codesniffer diff --git a/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php b/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php index a34004d6..ded39e6d 100644 --- a/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php +++ b/CakePHP/Sniffs/Commenting/FunctionCommentSniff.php @@ -10,7 +10,7 @@ * @author Marc McIntyre * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @link https://pear.php.net/package/PHP_CodeSniffer */ if (class_exists('PHP_CodeSniffer_CommentParser_FunctionCommentParser', true) === false) { @@ -41,7 +41,7 @@ * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence * @version Release: @package_version@ - * @link http://pear.php.net/package/PHP_CodeSniffer + * @link https://pear.php.net/package/PHP_CodeSniffer */ class CakePHP_Sniffs_Commenting_FunctionCommentSniff implements PHP_CodeSniffer_Sniff { @@ -469,5 +469,3 @@ protected function processParams($commentStart) }//end class - -?> diff --git a/CakePHP/Sniffs/Commenting/FunctionCommentThrowTagSniff.php b/CakePHP/Sniffs/Commenting/FunctionCommentThrowTagSniff.php index 6d97754f..8280fcdd 100644 --- a/CakePHP/Sniffs/Commenting/FunctionCommentThrowTagSniff.php +++ b/CakePHP/Sniffs/Commenting/FunctionCommentThrowTagSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.10 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ if (class_exists('PHP_CodeSniffer_Standards_AbstractScopeSniff', true) === false) { $error = 'Class PHP_CodeSniffer_Standards_AbstractScopeSniff not found'; @@ -21,7 +21,6 @@ /** * Ensures the throws in the code are declared in the PHPDoc - * */ class CakePHP_Sniffs_Commenting_FunctionCommentThrowTagSniff extends PHP_CodeSniffer_Standards_AbstractScopeSniff { diff --git a/CakePHP/Sniffs/Commenting/FunctionCommentTypeSniff.php b/CakePHP/Sniffs/Commenting/FunctionCommentTypeSniff.php index 5af4b899..3f3de087 100644 --- a/CakePHP/Sniffs/Commenting/FunctionCommentTypeSniff.php +++ b/CakePHP/Sniffs/Commenting/FunctionCommentTypeSniff.php @@ -1,15 +1,15 @@ * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence - * @link http://pear.php.net/package/PHP_CodeSniffer + * @link https://pear.php.net/package/PHP_CodeSniffer */ /** @@ -25,7 +25,7 @@ * @copyright 2006-2012 Squiz Pty Ltd (ABN 77 084 670 600) * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence * @version Release: 1.5.0RC3 - * @link http://pear.php.net/package/PHP_CodeSniffer + * @link https://pear.php.net/package/PHP_CodeSniffer */ class CakePHP_Sniffs_NamingConventions_UpperCaseConstantNameSniff implements PHP_CodeSniffer_Sniff { @@ -151,6 +151,14 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) { return; } + // Is this a return type declarations? + if ($tokens[$nextPtr]['code'] === T_OPEN_CURLY_BRACKET) { + $prevPtrReturnType = $phpcsFile->findPrevious(array(T_WHITESPACE, T_INLINE_THEN), ($stackPtr - 1), null, true); + if (in_array($tokens[$prevPtrReturnType]['code'], array(T_COLON, T_INLINE_ELSE), true)) { + return; + } + } + // Is this a variable name, in the form ${varname} ? if ($tokens[$prevPtr]['code'] === T_OPEN_CURLY_BRACKET) { $nextPtr = $phpcsFile->findNext(T_WHITESPACE, ($stackPtr + 1), null, true); diff --git a/CakePHP/Sniffs/NamingConventions/ValidClassBracketsSniff.php b/CakePHP/Sniffs/NamingConventions/ValidClassBracketsSniff.php index 8cedacbd..e88931cd 100644 --- a/CakePHP/Sniffs/NamingConventions/ValidClassBracketsSniff.php +++ b/CakePHP/Sniffs/NamingConventions/ValidClassBracketsSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.12 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ /** diff --git a/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php b/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php index 1130bdb1..c873e9cc 100644 --- a/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php +++ b/CakePHP/Sniffs/NamingConventions/ValidFunctionNameSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.1 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ /** diff --git a/CakePHP/Sniffs/NamingConventions/ValidTraitNameSniff.php b/CakePHP/Sniffs/NamingConventions/ValidTraitNameSniff.php index 5876eb88..20bc76a6 100644 --- a/CakePHP/Sniffs/NamingConventions/ValidTraitNameSniff.php +++ b/CakePHP/Sniffs/NamingConventions/ValidTraitNameSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.10 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ /** diff --git a/CakePHP/Sniffs/NamingConventions/ValidVariableNameSniff.php b/CakePHP/Sniffs/NamingConventions/ValidVariableNameSniff.php index 2e022922..dc4f3581 100644 --- a/CakePHP/Sniffs/NamingConventions/ValidVariableNameSniff.php +++ b/CakePHP/Sniffs/NamingConventions/ValidVariableNameSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.1 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ if (class_exists('PHP_CodeSniffer_Standards_AbstractVariableSniff', true) === false) { @@ -115,7 +115,7 @@ protected function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr) } } elseif ($private === true) { if (substr($varName, 0, 2) !== '__') { - $error = 'Private member variable "%s" must contain a leading underscore'; + $error = 'Private member variable "%s" must contain two leading underscores'; $data = array($varName); $phpcsFile->addError($error, $stackPtr, 'PrivateNoUnderscore', $data); return; @@ -204,7 +204,7 @@ protected function processVariableInString(PHP_CodeSniffer_File $phpcsFile, $sta * Variables in CakePHP can either be $fooBar, $FooBar, $_fooBar, or $_FooBar. * * @param string $string The variable to check. - * @param boolea $public Whether or not the variable is public. + * @param boolean $public Whether or not the variable is public. * @return boolean */ protected function _isValidVar($string, $public = true) { diff --git a/CakePHP/Sniffs/PHP/DisallowShortOpenTagSniff.php b/CakePHP/Sniffs/PHP/DisallowShortOpenTagSniff.php index c4abb1d5..67c0a2c1 100644 --- a/CakePHP/Sniffs/PHP/DisallowShortOpenTagSniff.php +++ b/CakePHP/Sniffs/PHP/DisallowShortOpenTagSniff.php @@ -2,17 +2,17 @@ /** * PHP Version 5 * - * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) + * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) + * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) * * Licensed under The MIT License * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org) - * @link http://pear.php.net/package/PHP_CodeSniffer_CakePHP + * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * @link https://pear.php.net/package/PHP_CodeSniffer_CakePHP * @since CakePHP CodeSniffer 0.1.14 - * @license http://www.opensource.org/licenses/mit-license.php MIT License + * @license https://www.opensource.org/licenses/mit-license.php MIT License */ /** diff --git a/CakePHP/Sniffs/PHP/TypeCastingSniff.php b/CakePHP/Sniffs/PHP/TypeCastingSniff.php index 812dfeb7..638f7e31 100644 --- a/CakePHP/Sniffs/PHP/TypeCastingSniff.php +++ b/CakePHP/Sniffs/PHP/TypeCastingSniff.php @@ -1,15 +1,15 @@ diff --git a/CakePHP/tests/files/return_type_declaration_pass.php b/CakePHP/tests/files/return_type_declaration_pass.php new file mode 100644 index 00000000..505d3479 --- /dev/null +++ b/CakePHP/tests/files/return_type_declaration_pass.php @@ -0,0 +1,31 @@ +MIT License - http://github.com/cakephp/cakephp-codesniffer/blob/master/README + https://github.com/cakephp/cakephp-codesniffer/blob/master/README diff --git a/composer.json b/composer.json index 4a1df3ad..42571b2b 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "CakePHP CodeSniffer Standards", "type": "library", "keywords": ["framework", "codesniffer"], - "homepage": "http://cakephp.org", + "homepage": "https://cakephp.org", "license": "MIT", "authors": [ { @@ -13,14 +13,14 @@ ], "support": { "issues": "https://github.com/cakephp/cakephp-codesniffer/issues", - "forum": "http://stackoverflow.com/tags/cakephp", + "forum": "https://stackoverflow.com/tags/cakephp", "irc": "irc://irc.freenode.org/cakephp", "source": "https://github.com/cakephp/cakephp-codesniffer" }, "require": { - "squizlabs/php_codesniffer": "~1.4" + "squizlabs/php_codesniffer": "^1.4.0" }, "require-dev": { - "phpunit/phpunit": "4.1.*" + "phpunit/phpunit": "^4.1.0" } } diff --git a/phpunit.xml b/phpunit.xml index c3a3ec87..fe2c423d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -5,7 +5,6 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" mapTestClassNameToCoveredClassName="false" - strict="false" verbose="false" bootstrap="./CakePHP/tests/bootstrap.php">