diff --git a/src/Auth/DigestAuthenticate.php b/src/Auth/DigestAuthenticate.php index 01d1d60af10..1329fb0368d 100644 --- a/src/Auth/DigestAuthenticate.php +++ b/src/Auth/DigestAuthenticate.php @@ -132,7 +132,7 @@ public function getUser(ServerRequest $request) * Gets the digest headers from the request/environment. * * @param \Cake\Http\ServerRequest $request Request object. - * @return array Array of digest information. + * @return array|bool Array of digest information. */ protected function _getDigest(ServerRequest $request) { diff --git a/src/Auth/Storage/MemoryStorage.php b/src/Auth/Storage/MemoryStorage.php index 12d9c0f7474..ab9cbc68a09 100644 --- a/src/Auth/Storage/MemoryStorage.php +++ b/src/Auth/Storage/MemoryStorage.php @@ -30,7 +30,7 @@ class MemoryStorage implements StorageInterface /** * Redirect url. * - * @var string + * @var string|null */ protected $_redirectUrl; diff --git a/src/Cache/Cache.php b/src/Cache/Cache.php index 4a35c096a74..ea5d65f7510 100644 --- a/src/Cache/Cache.php +++ b/src/Cache/Cache.php @@ -102,7 +102,7 @@ class Cache /** * Cache Registry used for creating and using cache adapters. * - * @var \Cake\Cache\CacheRegistry + * @var \Cake\Core\ObjectRegistry */ protected static $_registry; diff --git a/src/Cache/Engine/FileEngine.php b/src/Cache/Engine/FileEngine.php index 3f4ea7e6222..4c49f41c61c 100644 --- a/src/Cache/Engine/FileEngine.php +++ b/src/Cache/Engine/FileEngine.php @@ -36,7 +36,7 @@ class FileEngine extends CacheEngine /** * Instance of SplFileObject class * - * @var \SplFileObject + * @var \SplFileObject|null */ protected $_File = null; diff --git a/src/Cache/Engine/WincacheEngine.php b/src/Cache/Engine/WincacheEngine.php index 8260429445d..ddf63fb524a 100644 --- a/src/Cache/Engine/WincacheEngine.php +++ b/src/Cache/Engine/WincacheEngine.php @@ -204,7 +204,7 @@ public function groups() */ public function clearGroup($group) { - $success = null; + $success = false; wincache_ucache_inc($this->_config['prefix'] . $group, 1, $success); return $success; diff --git a/src/Collection/Iterator/MapReduce.php b/src/Collection/Iterator/MapReduce.php index 077fffdf2c4..bf57cc8bc9e 100644 --- a/src/Collection/Iterator/MapReduce.php +++ b/src/Collection/Iterator/MapReduce.php @@ -52,7 +52,7 @@ class MapReduce implements IteratorAggregate /** * Holds the original data that needs to be processed * - * @var \Traversable + * @var \Traversable|null */ protected $_data; @@ -74,7 +74,7 @@ class MapReduce implements IteratorAggregate /** * Count of elements emitted during the Reduce phase * - * @var string + * @var int */ protected $_counter = 0; diff --git a/src/Console/ConsoleInputSubcommand.php b/src/Console/ConsoleInputSubcommand.php index 26042bd073e..68e9ad0ebc1 100644 --- a/src/Console/ConsoleInputSubcommand.php +++ b/src/Console/ConsoleInputSubcommand.php @@ -102,7 +102,7 @@ public function help($width = 0) /** * Get the usage value for this option * - * @return mixed Either false or a ConsoleOptionParser + * @return \Cake\Console\ConsoleOptionParser|bool Either false or a ConsoleOptionParser */ public function parser() { diff --git a/src/Console/ConsoleOptionParser.php b/src/Console/ConsoleOptionParser.php index 7aedc4de392..e53482759b0 100644 --- a/src/Console/ConsoleOptionParser.php +++ b/src/Console/ConsoleOptionParser.php @@ -100,7 +100,7 @@ class ConsoleOptionParser /** * Map of short -> long options, generated when using addOption() * - * @var string + * @var array */ protected $_shortOptions = []; @@ -501,7 +501,7 @@ public function addArgument($name, array $params = []) if ($a->isEqualTo($arg)) { return $this; } - if ($options['required'] && !$a->isRequired()) { + if (!empty($options['required']) && !$a->isRequired()) { throw new LogicException('A required argument cannot follow an optional one'); } } diff --git a/src/Console/ConsoleOutput.php b/src/Console/ConsoleOutput.php index 93e02652295..e31a7f19875 100644 --- a/src/Console/ConsoleOutput.php +++ b/src/Console/ConsoleOutput.php @@ -119,9 +119,9 @@ class ConsoleOutput ]; /** - * formatting options for colored output + * Formatting options for colored output. * - * @var string + * @var array */ protected static $_options = [ 'bold' => 1, diff --git a/src/Console/HelpFormatter.php b/src/Console/HelpFormatter.php index 74eabdf2dd8..fcf7cf0824c 100644 --- a/src/Console/HelpFormatter.php +++ b/src/Console/HelpFormatter.php @@ -210,6 +210,6 @@ public function xml($string = true) $argument->xml($arguments); } - return $string ? $xml->asXml() : $xml; + return $string ? $xml->asXML() : $xml; } } diff --git a/src/Console/Shell.php b/src/Console/Shell.php index 859f0782c07..18554477401 100644 --- a/src/Console/Shell.php +++ b/src/Console/Shell.php @@ -129,7 +129,7 @@ class Shell /** * Contains tasks to load and instantiate * - * @var array + * @var array|bool * @link http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::$tasks */ public $tasks = []; diff --git a/src/Controller/Component/AuthComponent.php b/src/Controller/Component/AuthComponent.php index b370a34bfce..5c1d2b42349 100644 --- a/src/Controller/Component/AuthComponent.php +++ b/src/Controller/Component/AuthComponent.php @@ -192,7 +192,7 @@ class AuthComponent extends Component /** * Storage object. * - * @var \Cake\Auth\Storage\StorageInterface + * @var \Cake\Auth\Storage\StorageInterface|null */ protected $_storage; diff --git a/src/Controller/Component/CookieComponent.php b/src/Controller/Component/CookieComponent.php index 9113c419d9c..7c1e97426cd 100644 --- a/src/Controller/Component/CookieComponent.php +++ b/src/Controller/Component/CookieComponent.php @@ -85,7 +85,7 @@ class CookieComponent extends Component * * Accessed in the controller using $this->Cookie->read('Name.key'); * - * @var string + * @var array */ protected $_values = []; @@ -104,7 +104,7 @@ class CookieComponent extends Component * A reference to the Controller's Cake\Network\Response object. * Currently unused. * - * @var \Cake\Network\Response + * @var \Cake\Network\Response|null * @deprecated 3.4.0 Will be removed in 4.0.0 */ protected $_response = null; diff --git a/src/Controller/Component/SecurityComponent.php b/src/Controller/Component/SecurityComponent.php index 7677b541305..8fdcd8f14a5 100644 --- a/src/Controller/Component/SecurityComponent.php +++ b/src/Controller/Component/SecurityComponent.php @@ -637,7 +637,7 @@ protected function _matchExistingFields($dataFields, &$expectedFields, $intKeyMe * * @param array $expectedFields Expected fields * @param string $missingMessage Message template - * @return string Error message about expected fields + * @return string|null Error message about expected fields */ protected function _debugExpectedFields($expectedFields = [], $missingMessage = '') { diff --git a/src/Database/Connection.php b/src/Database/Connection.php index f2ba0dd2c31..5b77e41f140 100644 --- a/src/Database/Connection.php +++ b/src/Database/Connection.php @@ -88,9 +88,9 @@ class Connection implements ConnectionInterface /** * The schema collection object * - * @var \Cake\Database\Schema\Collection + * @var \Cake\Database\Schema\Collection|null */ - protected $_schemaCollection; + protected $_schemaCollection = null; /** * Constructor. @@ -612,7 +612,7 @@ public function rollbackSavepoint($name) */ public function disableForeignKeys() { - $this->execute($this->_driver->disableForeignKeySql())->closeCursor(); + $this->execute($this->_driver->disableForeignKeySQL())->closeCursor(); } /** @@ -622,7 +622,7 @@ public function disableForeignKeys() */ public function enableForeignKeys() { - $this->execute($this->_driver->enableForeignKeySql())->closeCursor(); + $this->execute($this->_driver->enableForeignKeySQL())->closeCursor(); } /** diff --git a/src/Database/Dialect/SqlserverDialectTrait.php b/src/Database/Dialect/SqlserverDialectTrait.php index 3617ffa2c68..b883ad84f09 100644 --- a/src/Database/Dialect/SqlserverDialectTrait.php +++ b/src/Database/Dialect/SqlserverDialectTrait.php @@ -298,7 +298,7 @@ protected function _transformFunctionExpression(FunctionExpression $expression) * Used by Cake\Schema package to reflect schema and * generate schema. * - * @return \Cake\Database\Schema\MysqlSchema + * @return \Cake\Database\Schema\SqlserverSchema */ public function schemaDialect() { diff --git a/src/Database/Driver.php b/src/Database/Driver.php index 97d4aef533d..3839319f386 100644 --- a/src/Database/Driver.php +++ b/src/Database/Driver.php @@ -86,7 +86,7 @@ abstract public function disconnect(); * If first argument is passed, * * @param null|\PDO $connection The connection object - * @return void + * @return \Cake\Database\Connection */ abstract public function connection($connection = null); @@ -258,7 +258,7 @@ public function schemaValue($value) is_numeric($value) && strpos($value, ',') === false && $value[0] !== '0' && strpos($value, 'e') === false) ) { - return $value; + return (string)$value; } return $this->_connection->quote($value, PDO::PARAM_STR); diff --git a/src/Database/Driver/PDODriverTrait.php b/src/Database/Driver/PDODriverTrait.php index 593b36e1828..a4a6ff86146 100644 --- a/src/Database/Driver/PDODriverTrait.php +++ b/src/Database/Driver/PDODriverTrait.php @@ -27,9 +27,9 @@ trait PDODriverTrait /** * Instance of PDO. * - * @var \PDO + * @var \PDO|null */ - protected $_connection; + protected $_connection = null; /** * Establishes a connection to the database server @@ -79,7 +79,7 @@ public function disconnect() } /** - * Check whether or not the driver is connected. + * Checks whether or not the driver is connected. * * @return bool */ @@ -94,9 +94,8 @@ public function isConnected() $connected = false; } } - $this->connected = !empty($connected); - return $this->connected; + return (bool)$connected; } /** diff --git a/src/Database/Expression/Comparison.php b/src/Database/Expression/Comparison.php index 2edd09d30ed..bfa75e3864d 100644 --- a/src/Database/Expression/Comparison.php +++ b/src/Database/Expression/Comparison.php @@ -42,7 +42,7 @@ class Comparison implements ExpressionInterface, FieldInterface /** * The type to be used for casting the value to a database representation * - * @var string + * @var string|array */ protected $_type; diff --git a/src/Database/Expression/ValuesExpression.php b/src/Database/Expression/ValuesExpression.php index a19bda618f7..1cdd3c70ec0 100644 --- a/src/Database/Expression/ValuesExpression.php +++ b/src/Database/Expression/ValuesExpression.php @@ -60,7 +60,7 @@ class ValuesExpression implements ExpressionInterface * Whether or not values have been casted to expressions * already. * - * @var string + * @var bool */ protected $_castedExpressions = false; diff --git a/src/Database/Log/LoggedQuery.php b/src/Database/Log/LoggedQuery.php index cb528fcb56c..0cc71312364 100644 --- a/src/Database/Log/LoggedQuery.php +++ b/src/Database/Log/LoggedQuery.php @@ -33,14 +33,14 @@ class LoggedQuery /** * Number of milliseconds this query took to complete * - * @var float + * @var int */ public $took = 0; /** * Associative array with the params bound to the query string * - * @var string + * @var array */ public $params = []; @@ -54,7 +54,7 @@ class LoggedQuery /** * The exception that was thrown by the execution of this query * - * @var \Exception + * @var \Exception|null */ public $error; diff --git a/src/Database/Log/LoggingStatement.php b/src/Database/Log/LoggingStatement.php index 9ebf08f595a..ec8b6e9038b 100644 --- a/src/Database/Log/LoggingStatement.php +++ b/src/Database/Log/LoggingStatement.php @@ -28,7 +28,7 @@ class LoggingStatement extends StatementDecorator /** * Logger instance responsible for actually doing the logging task * - * @var \Cake\Database\Log\QueryLogger + * @var \Cake\Database\Log\QueryLogger|null */ protected $_logger; @@ -110,7 +110,7 @@ public function bindValue($column, $value, $type = 'string') * it returns the currently setup logger instance * * @param object|null $instance Logger object instance. - * @return object Logger instance + * @return object|null Logger instance */ public function logger($instance = null) { diff --git a/src/Database/Query.php b/src/Database/Query.php index f959bf3b028..48f92626e1b 100644 --- a/src/Database/Query.php +++ b/src/Database/Query.php @@ -1618,7 +1618,7 @@ public function func() * iterated without having to call execute() manually, thus making it look like * a result set instead of the query itself. * - * @return \Iterator + * @return \Cake\Database\StatementInterface|null */ public function getIterator() { diff --git a/src/Database/Schema/TableSchema.php b/src/Database/Schema/TableSchema.php index 3c98a2579c4..58fcc6e85f3 100644 --- a/src/Database/Schema/TableSchema.php +++ b/src/Database/Schema/TableSchema.php @@ -399,7 +399,7 @@ public function columnType($name, $type = null) * based upon. * * @param string $column The column name to get the base type from - * @return string The base type name + * @return string|null The base type name */ public function baseColumnType($column) { diff --git a/src/Database/Statement/BufferedStatement.php b/src/Database/Statement/BufferedStatement.php index 3168d793722..70683c73859 100644 --- a/src/Database/Statement/BufferedStatement.php +++ b/src/Database/Statement/BufferedStatement.php @@ -46,6 +46,7 @@ class BufferedStatement extends StatementDecorator /** * Current record pointer + * * @var int */ protected $_counter = 0; diff --git a/src/Database/Statement/StatementDecorator.php b/src/Database/Statement/StatementDecorator.php index 2d57e506071..42fe0529bed 100644 --- a/src/Database/Statement/StatementDecorator.php +++ b/src/Database/Statement/StatementDecorator.php @@ -37,7 +37,7 @@ class StatementDecorator implements StatementInterface, Countable, IteratorAggre * Statement instance implementation, such as PDOStatement * or any other custom implementation. * - * @var mixed + * @var \Cake\Database\StatementInterface */ protected $_statement; diff --git a/src/Database/Type.php b/src/Database/Type.php index b9c456eea2e..be402b131a0 100644 --- a/src/Database/Type.php +++ b/src/Database/Type.php @@ -269,7 +269,7 @@ public static function boolval($value) * Will convert values into strings * * @param mixed $value The value to convert to a string. - * @return bool + * @return string * @deprecated 3.1.8 This method is now unused. */ public static function strval($value) diff --git a/src/Database/Type/DecimalType.php b/src/Database/Type/DecimalType.php index 962e32206ae..675a4e16fa8 100644 --- a/src/Database/Type/DecimalType.php +++ b/src/Database/Type/DecimalType.php @@ -72,7 +72,7 @@ public function toDatabase($value, Driver $driver) * * @param null|string|resource $value The value to convert. * @param \Cake\Database\Driver $driver The driver instance to convert with. - * @return float + * @return float|null * @throws \Cake\Core\Exception\Exception */ public function toPHP($value, Driver $driver) diff --git a/src/Database/Type/FloatType.php b/src/Database/Type/FloatType.php index f365d7ddfdf..1d36ea63e02 100644 --- a/src/Database/Type/FloatType.php +++ b/src/Database/Type/FloatType.php @@ -48,7 +48,7 @@ class FloatType extends Type implements TypeInterface * * @param string|resource $value The value to convert. * @param \Cake\Database\Driver $driver The driver instance to convert with. - * @return string|null + * @return float|null */ public function toDatabase($value, Driver $driver) { @@ -64,7 +64,7 @@ public function toDatabase($value, Driver $driver) * * @param null|string|resource $value The value to convert. * @param \Cake\Database\Driver $driver The driver instance to convert with. - * @return resource + * @return float|null * @throws \Cake\Core\Exception\Exception */ public function toPHP($value, Driver $driver) @@ -73,7 +73,7 @@ public function toPHP($value, Driver $driver) return null; } if (is_array($value)) { - return 1; + return 1.0; } return (float)$value; @@ -95,7 +95,7 @@ public function toStatement($value, Driver $driver) * Marshalls request data into PHP floats. * * @param mixed $value The value to convert. - * @return mixed Converted value. + * @return float|null Converted value. */ public function marshal($value) { @@ -109,7 +109,7 @@ public function marshal($value) return $this->_parseValue($value); } if (is_array($value)) { - return 1; + return 1.0; } return $value; diff --git a/src/Database/Type/IntegerType.php b/src/Database/Type/IntegerType.php index 1beb94fb28e..38a5adbc855 100644 --- a/src/Database/Type/IntegerType.php +++ b/src/Database/Type/IntegerType.php @@ -33,7 +33,7 @@ class IntegerType extends Type implements TypeInterface * * @param mixed $value The value to convert. * @param \Cake\Database\Driver $driver The driver instance to convert with. - * @return int + * @return int|null */ public function toDatabase($value, Driver $driver) { @@ -53,7 +53,7 @@ public function toDatabase($value, Driver $driver) * * @param mixed $value The value to convert. * @param \Cake\Database\Driver $driver The driver instance to convert with. - * @return int + * @return int|null */ public function toPHP($value, Driver $driver) { diff --git a/src/Datasource/QueryTrait.php b/src/Datasource/QueryTrait.php index 05eaec47719..4ec18deb0bb 100644 --- a/src/Datasource/QueryTrait.php +++ b/src/Datasource/QueryTrait.php @@ -37,7 +37,7 @@ trait QueryTrait * * When set, query execution will be bypassed. * - * @var \Cake\Datasource\ResultSetInterface + * @var \Cake\Datasource\ResultSetInterface|null * @see \Cake\Datasource\QueryTrait::setResult() */ protected $_results; @@ -265,7 +265,7 @@ public function aliasFields($fields, $defaultAlias = null) */ public function all() { - if (isset($this->_results)) { + if ($this->_results !== null) { return $this->_results; } diff --git a/src/Error/Debugger.php b/src/Error/Debugger.php index c80003abc7b..bfd403a9ecb 100644 --- a/src/Error/Debugger.php +++ b/src/Error/Debugger.php @@ -62,7 +62,7 @@ class Debugger * Templates used when generating trace or error strings. Can be global or indexed by the format * value used in $_outputFormat. * - * @var string + * @var array */ protected $_templates = [ 'log' => [ @@ -98,7 +98,7 @@ class Debugger /** * Holds current output data when outputFormat is false. * - * @var string + * @var array */ protected $_data = []; @@ -163,13 +163,13 @@ public function __construct() * Returns a reference to the Debugger singleton object instance. * * @param string|null $class Class name. - * @return object|Debugger + * @return object|\Cake\Error\Debugger */ public static function getInstance($class = null) { static $instance = []; if (!empty($class)) { - if (!$instance || strtolower($class) != strtolower(get_class($instance[0]))) { + if (!$instance || strtolower($class) !== strtolower(get_class($instance[0]))) { $instance[0] = new $class(); } } diff --git a/src/Error/ExceptionRenderer.php b/src/Error/ExceptionRenderer.php index 1008848ed6b..bb829fc574c 100644 --- a/src/Error/ExceptionRenderer.php +++ b/src/Error/ExceptionRenderer.php @@ -50,12 +50,19 @@ class ExceptionRenderer implements ExceptionRendererInterface { + /** + * The exception being handled. + * + * @var \Exception + */ + public $error; + /** * Controller instance. * * @var \Cake\Controller\Controller */ - public $controller = null; + public $controller; /** * Template to render for Cake\Core\Exception\Exception @@ -71,13 +78,6 @@ class ExceptionRenderer implements ExceptionRendererInterface */ public $method = ''; - /** - * The exception being handled. - * - * @var \Exception - */ - public $error = null; - /** * Creates the controller to perform rendering on the error response. * If the error is a Cake\Core\Exception\Exception it will be converted to either a 400 or a 500 diff --git a/src/Event/Event.php b/src/Event/Event.php index bdd11c85014..00a636fe9c9 100644 --- a/src/Event/Event.php +++ b/src/Event/Event.php @@ -188,7 +188,7 @@ public function setResult($value = null) * Access the event data/payload. * * @param string|null $key The data payload element to return, or null to return all data. - * @return array|null The data payload if $key is null, or the data value for the given $key. If the $key does not + * @return mixed[]|mixed|null The data payload if $key is null, or the data value for the given $key. If the $key does not * exist a null value is returned. */ public function data($key = null) diff --git a/src/Filesystem/Folder.php b/src/Filesystem/Folder.php index 173bcde9d6f..cc2d9bbbc5d 100644 --- a/src/Filesystem/Folder.php +++ b/src/Filesystem/Folder.php @@ -167,7 +167,7 @@ public function pwd() * Change directory to $path. * * @param string $path Path to the directory to change to - * @return string The new path. Returns false on failure + * @return string|bool The new path. Returns false on failure */ public function cd($path) { @@ -924,7 +924,7 @@ public function errors($reset = true) * Get the real path (taking ".." and such into account) * * @param string $path Path to resolve - * @return string The resolved path + * @return string|bool The resolved path */ public function realpath($path) { diff --git a/src/Http/ActionDispatcher.php b/src/Http/ActionDispatcher.php index f8691166480..96cd8ca3245 100644 --- a/src/Http/ActionDispatcher.php +++ b/src/Http/ActionDispatcher.php @@ -67,8 +67,8 @@ public function __construct($factory = null, $eventManager = null, array $filter * Dispatches a Request & Response * * @param \Cake\Http\ServerRequest $request The request to dispatch. - * @param \Cake\Network\Response $response The response to dispatch. - * @return \Cake\Network\Response A modified/replaced response. + * @param \Cake\Http\Response $response The response to dispatch. + * @return \Cake\Http\Response A modified/replaced response. */ public function dispatch(ServerRequest $request, Response $response) { diff --git a/src/Http/Client/Adapter/Stream.php b/src/Http/Client/Adapter/Stream.php index 41fa7bdb20c..74b111e45a4 100644 --- a/src/Http/Client/Adapter/Stream.php +++ b/src/Http/Client/Adapter/Stream.php @@ -29,7 +29,7 @@ class Stream /** * Context resource used by the stream API. * - * @var resource + * @var resource|null */ protected $_context; @@ -50,7 +50,7 @@ class Stream /** * The stream resource. * - * @var resource + * @var resource|null */ protected $_stream; @@ -71,7 +71,7 @@ class Stream public function send(Request $request, array $options) { $this->_stream = null; - $this->_context = []; + $this->_context = null; $this->_contextOptions = []; $this->_sslContextOptions = []; $this->_connectionErrors = []; diff --git a/src/Http/ControllerFactory.php b/src/Http/ControllerFactory.php index aad6136a8e8..ce56d28cd20 100644 --- a/src/Http/ControllerFactory.php +++ b/src/Http/ControllerFactory.php @@ -62,16 +62,16 @@ public function create(ServerRequest $request, Response $response) strpos($controller, '.') !== false || $firstChar === strtolower($firstChar) ) { - return $this->missingController($request); + $this->missingController($request); } $className = App::className($pluginPath . $controller, $namespace, 'Controller'); if (!$className) { - return $this->missingController($request); + $this->missingController($request); } $reflection = new ReflectionClass($className); if ($reflection->isAbstract() || $reflection->isInterface()) { - return $this->missingController($request); + $this->missingController($request); } return $reflection->newInstance($request, $response, $controller); diff --git a/src/Http/Response.php b/src/Http/Response.php index d4eb673e79b..26f20c41b72 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -479,7 +479,7 @@ protected function _createStream() * Sends the complete response to the client including headers and message body. * Will echo out the content in the response body. * - * @return void + * @return void|null * @deprecated 3.4.0 Will be removed in 4.0.0 */ public function send() diff --git a/src/Http/ResponseTransformer.php b/src/Http/ResponseTransformer.php index a2aae538b4d..d3b29f98e72 100644 --- a/src/Http/ResponseTransformer.php +++ b/src/Http/ResponseTransformer.php @@ -133,7 +133,7 @@ protected static function parseCookies(array $cookieHeader) * Convert a PSR7 Response headers into a flat array * * @param \Psr\Http\Message\ResponseInterface $response The response to convert. - * @return \Cake\Network\Response The equivalent CakePHP response + * @return array Headers. */ protected static function collapseHeaders(PsrResponse $response) { diff --git a/src/Http/ServerRequestFactory.php b/src/Http/ServerRequestFactory.php index be4f91aeaa4..7954e2b05c0 100644 --- a/src/Http/ServerRequestFactory.php +++ b/src/Http/ServerRequestFactory.php @@ -115,7 +115,7 @@ public static function marshalUriFromServer(array $server, array $headers) * * @param string $base The base path to remove. * @param \Psr\Http\Message\UriInterface $uri The uri to update. - * @return \Psr\Http\Message\ServerRequestInterface The modified Uri instance. + * @return \Psr\Http\Message\UriInterface The modified Uri instance. */ protected static function updatePath($base, $uri) { diff --git a/src/I18n/I18n.php b/src/I18n/I18n.php index e9ef7f4c487..7f120a69839 100644 --- a/src/I18n/I18n.php +++ b/src/I18n/I18n.php @@ -38,9 +38,9 @@ class I18n /** * The translators collection * - * @var \Aura\Intl\TranslatorLocator + * @var \Aura\Intl\TranslatorLocator|null */ - protected static $_collection; + protected static $_collection = null; /** * The environment default locale @@ -54,7 +54,7 @@ class I18n * for getting specific translators based of their name and locale * or to configure some aspect of future translations that are not yet constructed. * - * @return \Aura\Intl\TranslatorLocator The translators collection. + * @return \Aura\Intl\TranslatorLocator|\Cake\I18n\TranslatorRegistry The translators collection. */ public static function translators() { @@ -121,7 +121,7 @@ public static function translators() * @param string|null $locale The locale for the translator. * @param callable|null $loader A callback function or callable class responsible for * constructing a translations package instance. - * @return \Aura\Intl\Translator|null The configured translator. + * @return \Aura\Intl\TranslatorInterface|null The configured translator. */ public static function translator($name = 'default', $locale = null, callable $loader = null) { diff --git a/src/I18n/Number.php b/src/I18n/Number.php index d20853dcab3..f14d0ffa63c 100644 --- a/src/I18n/Number.php +++ b/src/I18n/Number.php @@ -50,9 +50,9 @@ class Number /** * Default currency used by Number::currency() * - * @var string + * @var string|null */ - protected static $_defaultCurrency; + protected static $_defaultCurrency = null; /** * Formats a number with a level of precision. diff --git a/src/I18n/Time.php b/src/I18n/Time.php index b3df5b99dbc..f3679590e4c 100644 --- a/src/I18n/Time.php +++ b/src/I18n/Time.php @@ -65,7 +65,7 @@ class Time extends MutableDateTime implements JsonSerializable * The format to use when formatting a time using `Cake\I18n\Time::timeAgoInWords()` * and the difference is more than `Cake\I18n\Time::$wordEnd` * - * @var string + * @var string|array|int * @see \Cake\I18n\Time::timeAgoInWords() */ public static $wordFormat = [IntlDateFormatter::SHORT, -1]; @@ -108,7 +108,7 @@ class Time extends MutableDateTime implements JsonSerializable public function __construct($time = null, $tz = null) { if ($time instanceof DateTimeInterface) { - $tz = $time->getTimeZone(); + $tz = $time->getTimezone(); $time = $time->format('Y-m-d H:i:s'); } diff --git a/src/I18n/TranslatorRegistry.php b/src/I18n/TranslatorRegistry.php index 5d26ddd9558..105b0b5b3e8 100644 --- a/src/I18n/TranslatorRegistry.php +++ b/src/I18n/TranslatorRegistry.php @@ -128,7 +128,7 @@ public function setCacher(CacheEngine $cacher) * @param string $name The translator package to retrieve. * @param string|null $locale The locale to use; if empty, uses the default * locale. - * @return \Aura\Intl\TranslatorInterface A translator object. + * @return \Aura\Intl\TranslatorInterface|null A translator object. * @throws \Aura\Intl\Exception If no translator with that name could be found * for the given locale. */ diff --git a/src/Log/Log.php b/src/Log/Log.php index 9355d14dfb9..1929cae8eec 100644 --- a/src/Log/Log.php +++ b/src/Log/Log.php @@ -129,9 +129,9 @@ class Log /** * LogEngineRegistry class * - * @var \Cake\Log\LogEngineRegistry + * @var \Cake\Log\LogEngineRegistry|null */ - protected static $_registry; + protected static $_registry = null; /** * Handled log levels diff --git a/src/Mailer/Email.php b/src/Mailer/Email.php index ace217a6350..63762a6ea80 100644 --- a/src/Mailer/Email.php +++ b/src/Mailer/Email.php @@ -222,7 +222,7 @@ class Email implements JsonSerializable, Serializable /** * The transport instance to use for sending mail. * - * @var \Cake\Mailer\AbstractTransport + * @var \Cake\Mailer\AbstractTransport|null */ protected $_transport = null; @@ -237,14 +237,14 @@ class Email implements JsonSerializable, Serializable * Charset the email header is sent in * If null, the $charset property will be used as default * - * @var string + * @var string|null */ public $headerCharset = null; /** * The application wide charset, used to encode headers and body * - * @var string + * @var string|null */ protected $_appCharset = null; @@ -260,7 +260,7 @@ class Email implements JsonSerializable, Serializable /** * If set, boundary to use for multipart mime messages * - * @var string + * @var string|null */ protected $_boundary = null; diff --git a/src/Mailer/Transport/SmtpTransport.php b/src/Mailer/Transport/SmtpTransport.php index 433ef1be87b..b830b8dbc8a 100644 --- a/src/Mailer/Transport/SmtpTransport.php +++ b/src/Mailer/Transport/SmtpTransport.php @@ -52,9 +52,9 @@ class SmtpTransport extends AbstractTransport /** * Content of email to return * - * @var string + * @var array */ - protected $_content; + protected $_content = []; /** * The response of the last sent SMTP command. diff --git a/src/Network/Session.php b/src/Network/Session.php index 97c585ddc1d..8024045a2d6 100644 --- a/src/Network/Session.php +++ b/src/Network/Session.php @@ -319,7 +319,7 @@ public function start() } if (ini_get('session.use_cookies') && headers_sent($file, $line)) { - return; + return false; } if (!session_start()) { diff --git a/src/Network/Socket.php b/src/Network/Socket.php index 6d6b42bea2a..30517f43b20 100644 --- a/src/Network/Socket.php +++ b/src/Network/Socket.php @@ -53,7 +53,7 @@ class Socket /** * Reference to socket connection resource * - * @var resource + * @var resource|null */ public $connection = null; @@ -312,8 +312,8 @@ public function setLastError($errNum, $errStr) /** * Write data to the socket. * - * @param string $data The data to write to the socket - * @return bool Success + * @param string $data The data to write to the socket. + * @return int Bytes written. */ public function write($data) { diff --git a/src/ORM/Behavior/TimestampBehavior.php b/src/ORM/Behavior/TimestampBehavior.php index 3b6e5372650..063538b625e 100644 --- a/src/ORM/Behavior/TimestampBehavior.php +++ b/src/ORM/Behavior/TimestampBehavior.php @@ -132,7 +132,7 @@ public function implementedEvents() * * @param \DateTime|null $ts Timestamp * @param bool $refreshTimestamp If true timestamp is refreshed. - * @return \Cake\I18n\Time + * @return \DateTime */ public function timestamp(DateTime $ts = null, $refreshTimestamp = false) { diff --git a/src/ORM/Behavior/TranslateBehavior.php b/src/ORM/Behavior/TranslateBehavior.php index 59315d8ea00..51eb078a3cc 100644 --- a/src/ORM/Behavior/TranslateBehavior.php +++ b/src/ORM/Behavior/TranslateBehavior.php @@ -480,7 +480,7 @@ protected function _referenceName(Table $table) * * @param \Cake\Datasource\ResultSetInterface $results Results to map. * @param string $locale Locale string - * @return \Cake\Collection\Collection + * @return \Cake\Collection\CollectionInterface */ protected function _rowMapper($results, $locale) { @@ -521,7 +521,7 @@ protected function _rowMapper($results, $locale) * into each entity under the `_translations` key * * @param \Cake\Datasource\ResultSetInterface $results Results to modify. - * @return \Cake\Collection\Collection + * @return \Cake\Collection\CollectionInterface */ public function groupTranslations($results) { diff --git a/src/ORM/Behavior/TreeBehavior.php b/src/ORM/Behavior/TreeBehavior.php index 619a6e929c1..1fb89664771 100644 --- a/src/ORM/Behavior/TreeBehavior.php +++ b/src/ORM/Behavior/TreeBehavior.php @@ -966,8 +966,8 @@ protected function _ensureFields($entity) protected function _getPrimaryKey() { if (!$this->_primaryKey) { - $this->_primaryKey = (array)$this->_table->primaryKey(); - $this->_primaryKey = $this->_primaryKey[0]; + $primaryKey = (array)$this->_table->primaryKey(); + $this->_primaryKey = $primaryKey[0]; } return $this->_primaryKey; diff --git a/src/ORM/EagerLoader.php b/src/ORM/EagerLoader.php index e2bf54f37f2..055eec82c11 100644 --- a/src/ORM/EagerLoader.php +++ b/src/ORM/EagerLoader.php @@ -40,9 +40,9 @@ class EagerLoader * Contains a nested array with the compiled containments tree * This is a normalized version of the user provided containments array. * - * @var array + * @var \Cake\ORM\EagerLoadable[]|\Cake\ORM\EagerLoadable|null */ - protected $_normalized; + protected $_normalized = null; /** * List of options accepted by associations in contain() @@ -67,7 +67,7 @@ class EagerLoader /** * A list of associations that should be loaded with a separate query * - * @var array + * @var \Cake\ORM\EagerLoadable[] */ protected $_loadExternal = []; @@ -457,7 +457,7 @@ public function attachableAssociations(Table $repository) * * @param \Cake\ORM\Table $repository The table containing the associations * to be loaded - * @return array + * @return \Cake\ORM\EagerLoadable[] */ public function externalAssociations(Table $repository) { @@ -481,7 +481,7 @@ public function externalAssociations(Table $repository) * separated strings representing associations that lead to this `$alias` in the * chain of associations to be loaded. The second value is the path to follow in * entities' properties to fetch a record of the corresponding association. - * @return array normalized associations + * @return \Cake\ORM\EagerLoadable Object with normalized associations * @throws \InvalidArgumentException When containments refer to associations that do not exist. */ protected function _normalizeContain(Table $parent, $alias, $options, $paths) @@ -551,6 +551,7 @@ protected function _fixStrategies() if (count($configs) < 2) { continue; } + /* @var \Cake\ORM\EagerLoadable $loadable */ foreach ($configs as $loadable) { if (strpos($loadable->aliasPath(), '.')) { $this->_correctStrategy($loadable); @@ -624,7 +625,7 @@ protected function _resolveJoins($associations, $matching = []) * @param \Cake\ORM\Query $query The query for which to eager load external * associations * @param \Cake\Database\StatementInterface $statement The statement created after executing the $query - * @return \Cake\Database\Statement\CallbackStatement statement modified statement with extra loaders + * @return \Cake\Database\StatementInterface statement modified statement with extra loaders */ public function loadExternal($query, $statement) { @@ -687,6 +688,7 @@ public function associationsMap($table) } $visitor = function ($level, $matching = false) use (&$visitor, &$map) { + /* @var \Cake\ORM\EagerLoadable $meta */ foreach ($level as $assoc => $meta) { $canBeJoined = $meta->canBeJoined(); $instance = $meta->instance(); @@ -750,6 +752,7 @@ public function addToJoinsMap($alias, Association $assoc, $asMatching = false, $ protected function _collectKeys($external, $query, $statement) { $collectKeys = []; + /* @var \Cake\ORM\EagerLoadable $meta */ foreach ($external as $meta) { $instance = $meta->instance(); if (!$instance->requiresKeys($meta->config())) { diff --git a/src/ORM/Query.php b/src/ORM/Query.php index 62af60447ee..0e19ab778b5 100644 --- a/src/ORM/Query.php +++ b/src/ORM/Query.php @@ -148,7 +148,7 @@ class Query extends DatabaseQuery implements JsonSerializable, QueryInterface * * When set, count query execution will be bypassed. * - * @var int + * @var int|null */ protected $_resultsCount; diff --git a/src/Routing/Dispatcher.php b/src/Routing/Dispatcher.php index bfb66d3a429..d55f9436ddb 100644 --- a/src/Routing/Dispatcher.php +++ b/src/Routing/Dispatcher.php @@ -50,7 +50,7 @@ class Dispatcher * If the controller is found, and the action is not found an exception will be thrown. * * @param \Cake\Http\ServerRequest $request Request object to dispatch. - * @param \Cake\Network\Response $response Response object to put the results of the dispatch into. + * @param \Cake\Http\Response $response Response object to put the results of the dispatch into. * @return string|null if `$request['return']` is set then it returns response body, null otherwise * @throws \LogicException When the controller did not get created in the Dispatcher.beforeDispatch event. */ diff --git a/src/Routing/DispatcherFilter.php b/src/Routing/DispatcherFilter.php index b5bd8667890..b7c74a8641b 100644 --- a/src/Routing/DispatcherFilter.php +++ b/src/Routing/DispatcherFilter.php @@ -156,6 +156,7 @@ public function handle(Event $event) */ public function matches(Event $event) { + /* @var \Cake\Http\ServerRequest $request */ $request = $event->data('request'); $pass = true; if (!empty($this->_config['for'])) { diff --git a/src/Routing/Filter/AssetFilter.php b/src/Routing/Filter/AssetFilter.php index 55f9c82b746..d78082f125b 100644 --- a/src/Routing/Filter/AssetFilter.php +++ b/src/Routing/Filter/AssetFilter.php @@ -66,6 +66,7 @@ public function __construct($config = []) */ public function beforeDispatch(Event $event) { + /* @var \Cake\Http\ServerRequest $request */ $request = $event->data('request'); $url = urldecode($request->url); @@ -77,6 +78,7 @@ public function beforeDispatch(Event $event) if ($assetFile === null || !file_exists($assetFile)) { return null; } + /* @var \Cake\Network\Response $response */ $response = $event->data('response'); $event->stopPropagation(); diff --git a/src/Routing/Filter/LocaleSelectorFilter.php b/src/Routing/Filter/LocaleSelectorFilter.php index 4b2cd484740..bf1a82cfe3e 100644 --- a/src/Routing/Filter/LocaleSelectorFilter.php +++ b/src/Routing/Filter/LocaleSelectorFilter.php @@ -58,6 +58,7 @@ public function __construct($config = []) */ public function beforeDispatch(Event $event) { + /* @var \Cake\Http\ServerRequest $request */ $request = $event->data('request'); $locale = Locale::acceptFromHttp($request->header('Accept-Language')); diff --git a/src/Routing/Filter/RoutingFilter.php b/src/Routing/Filter/RoutingFilter.php index 271ad8efb7a..c6e1dc593e3 100644 --- a/src/Routing/Filter/RoutingFilter.php +++ b/src/Routing/Filter/RoutingFilter.php @@ -47,6 +47,7 @@ class RoutingFilter extends DispatcherFilter */ public function beforeDispatch(Event $event) { + /* @var \Cake\Http\ServerRequest $request */ $request = $event->data('request'); if (Router::getRequest(true) !== $request) { Router::setRequestInfo($request); @@ -61,6 +62,7 @@ public function beforeDispatch(Event $event) return null; } catch (RedirectException $e) { $event->stopPropagation(); + /* @var \Cake\Network\Response $response */ $response = $event->data('response'); $response->statusCode($e->getCode()); $response->header('Location', $e->getMessage()); diff --git a/src/Routing/Route/Route.php b/src/Routing/Route/Route.php index 1223cd34784..43d3dd3f15c 100644 --- a/src/Routing/Route/Route.php +++ b/src/Routing/Route/Route.php @@ -163,7 +163,7 @@ public function compiled() * Modifies defaults property so all necessary keys are set * and populates $this->names with the named routing elements. * - * @return array Returns a string regular expression of the compiled route. + * @return string Returns a string regular expression of the compiled route. */ public function compile() { diff --git a/src/Routing/RouteBuilder.php b/src/Routing/RouteBuilder.php index 2a886f8d005..2f7a39738c0 100644 --- a/src/Routing/RouteBuilder.php +++ b/src/Routing/RouteBuilder.php @@ -189,7 +189,7 @@ public function path() /** * Get the parameter names/values for this scope. * - * @return string + * @return array */ public function params() { diff --git a/src/Routing/Router.php b/src/Routing/Router.php index b2a7417eee3..b528abbc7f0 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -45,7 +45,7 @@ class Router /** * Default route class. * - * @var bool + * @var string */ protected static $_defaultRouteClass = 'Cake\Routing\Route\Route'; diff --git a/src/Shell/CommandListShell.php b/src/Shell/CommandListShell.php index 94d7de6df09..fb96bc127a1 100644 --- a/src/Shell/CommandListShell.php +++ b/src/Shell/CommandListShell.php @@ -127,7 +127,7 @@ protected function _asXml($shellList) } } $this->_io->outputAs(ConsoleOutput::RAW); - $this->out($shells->saveXml()); + $this->out($shells->saveXML()); } /** diff --git a/src/Shell/ServerShell.php b/src/Shell/ServerShell.php index fb25ebb19da..3775b80b7de 100644 --- a/src/Shell/ServerShell.php +++ b/src/Shell/ServerShell.php @@ -48,7 +48,7 @@ class ServerShell extends Shell /** * listen port * - * @var string + * @var int */ protected $_port = null; diff --git a/src/Shell/Task/ExtractTask.php b/src/Shell/Task/ExtractTask.php index b0d620e6b97..ffdd7fda875 100644 --- a/src/Shell/Task/ExtractTask.php +++ b/src/Shell/Task/ExtractTask.php @@ -93,7 +93,7 @@ class ExtractTask extends Shell /** * Holds the validation string domain to use for validation messages when extracting * - * @var bool + * @var string */ protected $_validationDomain = 'default'; diff --git a/src/TestSuite/Fixture/FixtureInjector.php b/src/TestSuite/Fixture/FixtureInjector.php index e8e7143217d..983d40483e1 100644 --- a/src/TestSuite/Fixture/FixtureInjector.php +++ b/src/TestSuite/Fixture/FixtureInjector.php @@ -54,7 +54,7 @@ public function __construct(FixtureManager $manager) $manager->setDebug(in_array('--debug', $_SERVER['argv'])); } $this->_fixtureManager = $manager; - $this->_fixtureManager->shutdown(); + $this->_fixtureManager->shutDown(); } /** @@ -81,7 +81,7 @@ public function startTestSuite(PHPUnit_Framework_TestSuite $suite) public function endTestSuite(PHPUnit_Framework_TestSuite $suite) { if ($this->_first === $suite) { - $this->_fixtureManager->shutdown(); + $this->_fixtureManager->shutDown(); } } diff --git a/src/TestSuite/IntegrationTestCase.php b/src/TestSuite/IntegrationTestCase.php index 6edbb896289..bfcd4688c68 100644 --- a/src/TestSuite/IntegrationTestCase.php +++ b/src/TestSuite/IntegrationTestCase.php @@ -54,14 +54,14 @@ abstract class IntegrationTestCase extends TestCase * * @var string|null */ - protected $_appClass; + protected $_appClass = null; /** * The customized application constructor arguments. * * @var array|null */ - protected $_appArgs; + protected $_appArgs = null; /** * The data used to build the next request. @@ -73,16 +73,16 @@ abstract class IntegrationTestCase extends TestCase /** * The response for the most recent request. * - * @var \Cake\Http\Response + * @var \Cake\Http\Response|null */ - protected $_response; + protected $_response = null; /** * The exception being thrown if the case. * - * @var \Cake\Core\Exception\Exception + * @var \Exception|null */ - protected $_exception; + protected $_exception = null; /** * Session data to use in the next request. @@ -101,30 +101,30 @@ abstract class IntegrationTestCase extends TestCase /** * The controller used in the last request. * - * @var \Cake\Controller\Controller + * @var \Cake\Controller\Controller|null */ - protected $_controller; + protected $_controller = null; /** * The last rendered view * - * @var string + * @var string|null */ - protected $_viewName; + protected $_viewName = null; /** * The last rendered layout * - * @var string + * @var string|null */ - protected $_layoutName; + protected $_layoutName = null; /** * The session instance from the last request * - * @var \Cake\Network\Session + * @var \Cake\Network\Session|null */ - protected $_requestSession; + protected $_requestSession = null; /** * Boolean flag for whether or not the request should have @@ -435,7 +435,7 @@ protected function _sendRequest($url, $method, $data = []) /** * Get the correct dispatcher instance. * - * @return object A dispatcher instance + * @return \Cake\TestSuite\MiddlewareDispatcher|\Cake\TestSuite\LegacyRequestDispatcher A dispatcher instance */ protected function _makeDispatcher() { diff --git a/src/TestSuite/MiddlewareDispatcher.php b/src/TestSuite/MiddlewareDispatcher.php index 145c3fa8c57..7b6b9a896e7 100644 --- a/src/TestSuite/MiddlewareDispatcher.php +++ b/src/TestSuite/MiddlewareDispatcher.php @@ -70,7 +70,7 @@ public function __construct($test, $class = null, $constructorArgs = null) * Run a request and get the response. * * @param \Cake\Http\ServerRequest $request The request to execute. - * @return \Cake\Http\Response The generated response. + * @return \Psr\Http\Message\ResponseInterface The generated response. */ public function execute($request) { diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index ee4260e174e..851d8963027 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -516,7 +516,7 @@ public function assertHtml($expected, $string, $fullDebug = false) * @param string $string The HTML string to check. * @param bool $fullDebug Whether or not more verbose output should be used. * @param array|string $regex Full regexp from `assertHtml` - * @return string + * @return string|bool */ protected function _assertAttributes($assertions, $string, $fullDebug = false, $regex = '') { diff --git a/src/Utility/CookieCryptTrait.php b/src/Utility/CookieCryptTrait.php index 6cdba47bc6e..4af2fec4658 100644 --- a/src/Utility/CookieCryptTrait.php +++ b/src/Utility/CookieCryptTrait.php @@ -97,7 +97,7 @@ protected function _checkCipher($encrypt) * @param array $values Values to decrypt * @param string|bool $mode Encryption mode * @param string|null $key Used as the security salt if specified. - * @return string decrypted string + * @return string|array Decrypted values */ protected function _decrypt($values, $mode, $key = null) { @@ -119,7 +119,7 @@ protected function _decrypt($values, $mode, $key = null) * @param string $value The value to decode & decrypt. * @param string|false $encrypt The encryption cipher to use. * @param string|null $key Used as the security salt if specified. - * @return string Decoded value. + * @return string|array Decoded values. */ protected function _decode($value, $encrypt, $key) { @@ -158,7 +158,7 @@ protected function _implode(array $array) * Maintains reading backwards compatibility with 1.x CookieComponent::_implode(). * * @param string $string A string containing JSON encoded data, or a bare string. - * @return array Map of key and values + * @return string|array Map of key and values */ protected function _explode($string) { diff --git a/src/Utility/Security.php b/src/Utility/Security.php index 242f19039cf..00144c1c80c 100644 --- a/src/Utility/Security.php +++ b/src/Utility/Security.php @@ -255,7 +255,7 @@ protected static function _checkKey($key, $method) * @param string $cipher The ciphertext to decrypt. * @param string $key The 256 bit/32 byte key to use as a cipher key. * @param string|null $hmacSalt The salt to use for the HMAC process. Leave null to use Security.salt. - * @return string Decrypted data. Any trailing null bytes will be removed. + * @return string|bool Decrypted data. Any trailing null bytes will be removed. * @throws \InvalidArgumentException On invalid data or key. */ public static function decrypt($cipher, $key, $hmacSalt = null) diff --git a/src/View/Form/EntityContext.php b/src/View/Form/EntityContext.php index fbb09d65fd4..2b3dbe29817 100644 --- a/src/View/Form/EntityContext.php +++ b/src/View/Form/EntityContext.php @@ -295,7 +295,7 @@ protected function _schemaDefault($field, $entity) * * @param array|\Traversable $values The list from which to extract primary keys from * @param array $path Each one of the parts in a path for a field name - * @return array + * @return array|null */ protected function _extractMultiple($values, $path) { diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index e78385fea6b..a7795a0302c 100644 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -161,7 +161,7 @@ class FormHelper extends Helper /** * Defines the type of form being created. Set by FormHelper::create(). * - * @var string + * @var string|null */ public $requestType = null; @@ -185,7 +185,7 @@ class FormHelper extends Helper /** * Context for the current form. * - * @var \Cake\View\Form\ContextInterface + * @var \Cake\View\Form\ContextInterface|null */ protected $_context; @@ -689,7 +689,9 @@ protected function _secure($lock, $field, $value = null) if ($lock) { if (!in_array($field, $this->fields)) { if ($value !== null) { - return $this->fields[$field] = $value; + $this->fields[$field] = $value; + + return; } if (isset($this->fields[$field]) && $value === null) { unset($this->fields[$field]); diff --git a/src/View/Helper/HtmlHelper.php b/src/View/Helper/HtmlHelper.php index e0ed36c2b83..673411b60dc 100644 --- a/src/View/Helper/HtmlHelper.php +++ b/src/View/Helper/HtmlHelper.php @@ -924,6 +924,7 @@ public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $ $count = 0; } + $out = []; foreach ($data as $line) { $count++; $cellsOut = $this->_renderCells($line, $useCount); @@ -942,7 +943,7 @@ public function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $ * * @param array $line Line data to render. * @param bool $useCount Renders the count into the row. Default is false. - * @return string + * @return string[] */ protected function _renderCells($line, $useCount = false) { diff --git a/src/View/Helper/NumberHelper.php b/src/View/Helper/NumberHelper.php index 738c6027049..2f1c5ea8d0a 100644 --- a/src/View/Helper/NumberHelper.php +++ b/src/View/Helper/NumberHelper.php @@ -89,7 +89,7 @@ public function __call($method, $params) * * @param float $number A floating point number. * @param int $precision The precision of the returned number. - * @return float Formatted float. + * @return string Formatted float. * @see \Cake\I18n\Number::precision() * @link http://book.cakephp.org/3.0/en/views/helpers/number.html#formatting-floating-point-numbers */ diff --git a/src/View/Helper/PaginatorHelper.php b/src/View/Helper/PaginatorHelper.php index 6f9f64cdb25..5db4e3bc993 100644 --- a/src/View/Helper/PaginatorHelper.php +++ b/src/View/Helper/PaginatorHelper.php @@ -746,7 +746,7 @@ public function counter($options = []) * options and a modulus of 8, ellipsis content will be inserted after the first and last link sets. * * @param array $options Options for the numbers. - * @return string numbers string. + * @return string|false Numbers string. * @link http://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-page-number-links */ public function numbers(array $options = []) @@ -987,7 +987,7 @@ protected function _numbers($templater, $params, $options) * @param string|int $first if string use as label for the link. If numeric, the number of page links * you want at the beginning of the range. * @param array $options An array of options. - * @return string numbers string. + * @return string|false Numbers string. * @link http://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-jump-links */ public function first($first = '<< first', array $options = []) @@ -1048,7 +1048,7 @@ public function first($first = '<< first', array $options = []) * * @param string|int $last if string use as label for the link, if numeric print page numbers * @param array $options Array of options - * @return string numbers string. + * @return string|false Numbers string. * @link http://book.cakephp.org/3.0/en/views/helpers/paginator.html#creating-jump-links */ public function last($last = 'last >>', array $options = []) diff --git a/src/View/Helper/TimeHelper.php b/src/View/Helper/TimeHelper.php index 3bb209a3300..360fcaeac70 100644 --- a/src/View/Helper/TimeHelper.php +++ b/src/View/Helper/TimeHelper.php @@ -205,7 +205,7 @@ public function toQuarter($dateString, $range = false) */ public function toUnix($dateString, $timezone = null) { - return (new Time($dateString, $timezone))->toUnixString(); + return (int)(new Time($dateString, $timezone))->toUnixString(); } /** @@ -334,7 +334,7 @@ public function isWithinNext($timeInterval, $dateString, $timezone = null) */ public function gmt($string = null) { - return (new Time($string))->toUnixString(); + return (int)(new Time($string))->toUnixString(); } /** diff --git a/src/View/SerializedView.php b/src/View/SerializedView.php index 6f07e2a68d3..0218f65b370 100644 --- a/src/View/SerializedView.php +++ b/src/View/SerializedView.php @@ -83,7 +83,7 @@ abstract protected function _serialize($serialize); * names. If true all view variables will be serialized. If unset normal * view template will be rendered. * - * @param string|null $view The view being rendered. + * @param string|bool|null $view The view being rendered. * @param string|null $layout The layout being rendered. * @return string|null The rendered view. */ diff --git a/src/View/View.php b/src/View/View.php index 0e0071777e9..c66529aada1 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -568,7 +568,7 @@ public function elementExists($name) * a plugin template/layout can be used instead of the app ones. If the chosen plugin is not found * the template will be located along the regular view path cascade. * - * @param string|null $view Name of view file to use + * @param string|false|null $view Name of view file to use * @param string|null $layout Layout to use. * @return string|null Rendered content or null if content already rendered and returned earlier. * @throws \Cake\Core\Exception\Exception If there is an error in the view. diff --git a/src/View/Widget/MultiCheckboxWidget.php b/src/View/Widget/MultiCheckboxWidget.php index f417522a404..9b1ac7d885c 100644 --- a/src/View/Widget/MultiCheckboxWidget.php +++ b/src/View/Widget/MultiCheckboxWidget.php @@ -236,7 +236,7 @@ protected function _isSelected($key, $selected) * Helper method for deciding what options are disabled. * * @param string $key The key to test. - * @param array|null $disabled The disabled values. + * @param array|bool|null $disabled The disabled values. * @return bool */ protected function _isDisabled($key, $disabled) diff --git a/src/View/Widget/RadioWidget.php b/src/View/Widget/RadioWidget.php index e91cf570b84..bb5e2d7d774 100644 --- a/src/View/Widget/RadioWidget.php +++ b/src/View/Widget/RadioWidget.php @@ -222,7 +222,7 @@ protected function _renderInput($val, $text, $data, $context) * @param string $input The input widget. * @param \Cake\View\Form\ContextInterface $context The form context. * @param bool $escape Whether or not to HTML escape the label. - * @return string Generated label. + * @return string|bool Generated label. */ protected function _renderLabel($radio, $label, $input, $context, $escape) { diff --git a/tests/TestCase/Controller/Component/CookieComponentTest.php b/tests/TestCase/Controller/Component/CookieComponentTest.php index d2f25379719..39d0dff3067 100644 --- a/tests/TestCase/Controller/Component/CookieComponentTest.php +++ b/tests/TestCase/Controller/Component/CookieComponentTest.php @@ -28,6 +28,11 @@ class CookieComponentTest extends TestCase { + /** + * @var \Cake\Controller\Component\CookieComponent + */ + protected $Cookie; + /** * start * diff --git a/tests/TestCase/Database/DriverTest.php b/tests/TestCase/Database/DriverTest.php index 94cf116962e..2504c3ecf7d 100644 --- a/tests/TestCase/Database/DriverTest.php +++ b/tests/TestCase/Database/DriverTest.php @@ -261,7 +261,7 @@ public function schemaValueProvider() [null, 'NULL'], [false, 'FALSE'], [true, 'TRUE'], - [1, 1], + [1, '1'], ['0', '0'], ['42', '42'] ]; diff --git a/tests/TestCase/Database/Type/FloatTypeTest.php b/tests/TestCase/Database/Type/FloatTypeTest.php index 62eb5c7d472..83d83696cff 100644 --- a/tests/TestCase/Database/Type/FloatTypeTest.php +++ b/tests/TestCase/Database/Type/FloatTypeTest.php @@ -92,7 +92,7 @@ public function testToPHP() $this->assertSame(2.0, $result); $result = $this->type->toPHP(['3', '4'], $this->driver); - $this->assertSame(1, $result); + $this->assertSame(1.0, $result); } /** @@ -141,7 +141,7 @@ public function testMarshal() $this->assertSame('3.5 bears', $result); $result = $this->type->marshal(['3', '4']); - $this->assertSame(1, $result); + $this->assertSame(1.0, $result); } /** diff --git a/tests/TestCase/View/Helper/TimeHelperTest.php b/tests/TestCase/View/Helper/TimeHelperTest.php index 0400a5cdb59..ce1382251e4 100644 --- a/tests/TestCase/View/Helper/TimeHelperTest.php +++ b/tests/TestCase/View/Helper/TimeHelperTest.php @@ -183,7 +183,7 @@ public function testNiceOutputTimezone() */ public function testToUnix() { - $this->assertEquals(1397980800, $this->Time->toUnix('2014-04-20 08:00:00')); + $this->assertSame(1397980800, $this->Time->toUnix('2014-04-20 08:00:00')); } /**