diff --git a/src/Controller/Component/CookieComponent.php b/src/Controller/Component/CookieComponent.php index da39b44a4c9..7c966b402b3 100644 --- a/src/Controller/Component/CookieComponent.php +++ b/src/Controller/Component/CookieComponent.php @@ -171,7 +171,7 @@ public function initialize(array $config) { * @param null|string|array $option Either the option name to set, or an array of options to set, * or null to read config options for a given key. * @param string|null $value Either the value to set, or empty when $option is an array. - * @return void + * @return array|null */ public function configKey($keyname, $option = null, $value = null) { if ($option === null) { @@ -183,6 +183,7 @@ public function configKey($keyname, $option = null, $value = null) { $option = [$option => $value]; } $this->_keyConfig[$keyname] = $option; + return null; } /** diff --git a/src/Controller/Component/RequestHandlerComponent.php b/src/Controller/Component/RequestHandlerComponent.php index 02e8c182a0b..eb86cca8229 100644 --- a/src/Controller/Component/RequestHandlerComponent.php +++ b/src/Controller/Component/RequestHandlerComponent.php @@ -625,7 +625,7 @@ public function responseType() { * Maps a content type alias back to its mime-type(s) * * @param string|array $alias String alias to convert back into a content type. Or an array of aliases to map. - * @return string Null on an undefined alias. String value of the mapped alias type. If an + * @return string|null Null on an undefined alias. String value of the mapped alias type. If an * alias maps to more than one content type, the first one will be returned. */ public function mapAlias($alias) { diff --git a/src/Core/functions.php b/src/Core/functions.php index 652579e36f7..9b2cb7f7857 100644 --- a/src/Core/functions.php +++ b/src/Core/functions.php @@ -167,7 +167,7 @@ function pj($var) { * environment information. * * @param string $key Environment variable name. - * @return string Environment variable setting. + * @return string|null Environment variable setting. * @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#env */ function env($key) { diff --git a/src/Database/Connection.php b/src/Database/Connection.php index 83bff34d807..7b2f8f8a9e2 100644 --- a/src/Database/Connection.php +++ b/src/Database/Connection.php @@ -134,7 +134,7 @@ public function config() { */ public function configName() { if (empty($this->_config['name'])) { - return null; + return ''; } return $this->_config['name']; } diff --git a/src/Database/Schema/PostgresSchema.php b/src/Database/Schema/PostgresSchema.php index 9b04250dc26..0005240117e 100644 --- a/src/Database/Schema/PostgresSchema.php +++ b/src/Database/Schema/PostgresSchema.php @@ -151,7 +151,7 @@ public function convertColumnDescription(Table $table, $row) { * We need to remove those. * * @param string $default The default value. - * @return string + * @return string|null */ protected function _defaultValue($default) { if (is_numeric($default) || $default === null) { diff --git a/src/Database/Type/BinaryType.php b/src/Database/Type/BinaryType.php index 3afde97faab..66b2f981392 100644 --- a/src/Database/Type/BinaryType.php +++ b/src/Database/Type/BinaryType.php @@ -44,7 +44,7 @@ public function toDatabase($value, Driver $driver) { * * @param null|string|resource $value The value to convert. * @param Driver $driver The driver instance to convert with. - * @return resource + * @return resource|null * @throws \Cake\Core\Exception\Exception */ public function toPHP($value, Driver $driver) { diff --git a/src/Filesystem/Folder.php b/src/Filesystem/Folder.php index 541b25c5b5d..a247916ffe7 100644 --- a/src/Filesystem/Folder.php +++ b/src/Filesystem/Folder.php @@ -596,7 +596,7 @@ public function delete($path = null) { $path = $this->pwd(); } if (!$path) { - return null; + return false; } $path = Folder::slashTerm($path); if (is_dir($path)) { diff --git a/src/Network/Response.php b/src/Network/Response.php index 12dc77d3cc8..c680b4f962a 100644 --- a/src/Network/Response.php +++ b/src/Network/Response.php @@ -723,7 +723,7 @@ public function httpCodes($code = null) { * e.g `type(array('jpg' => 'text/plain'));` * * @param string $contentType Content type key. - * @return mixed current content type or false if supplied an invalid content type + * @return mixed Current content type or false if supplied an invalid content type */ public function type($contentType = null) { if ($contentType === null) { @@ -751,7 +751,7 @@ public function type($contentType = null) { * e.g `getMimeType('pdf'); // returns 'application/pdf'` * * @param string $alias the content type alias to map - * @return mixed string mapped mime type or false if $alias is not mapped + * @return mixed String mapped mime type or false if $alias is not mapped */ public function getMimeType($alias) { if (isset($this->_mimeTypes[$alias])) { @@ -837,7 +837,7 @@ public function cache($since, $time = '+1 day') { * if set to false, the response will be set to private * if no value is provided, it will return whether the response is sharable or not * @param int $time time in seconds after which the response should no longer be considered fresh - * @return bool + * @return bool|null */ public function sharable($public = null, $time = null) { if ($public === null) { @@ -872,7 +872,7 @@ public function sharable($public = null, $time = null) { * If called with no parameters, this function will return the current max-age value if any * * @param int $seconds if null, the method will return the current s-maxage value - * @return int + * @return int|null */ public function sharedMaxAge($seconds = null) { if ($seconds !== null) { @@ -892,7 +892,7 @@ public function sharedMaxAge($seconds = null) { * If called with no parameters, this function will return the current max-age value if any * * @param int $seconds if null, the method will return the current max-age value - * @return int + * @return int|null */ public function maxAge($seconds = null) { if ($seconds !== null) { @@ -955,7 +955,7 @@ protected function _setCacheControl() { * `$response->expires()` Will return the current expiration header value * * @param string|\DateTime $time Valid time string or \DateTime instance. - * @return string + * @return string|null */ public function expires($time = null) { if ($time !== null) { @@ -979,7 +979,7 @@ public function expires($time = null) { * `$response->modified()` Will return the current Last-Modified header value * * @param string|\DateTime $time Valid time string or \DateTime instance. - * @return string + * @return string|null */ public function modified($time = null) { if ($time !== null) { @@ -1024,7 +1024,7 @@ public function notModified() { * * @param string|array $cacheVariances a single Vary string or an array * containing the list for variances. - * @return array + * @return array|null */ public function vary($cacheVariances = null) { if ($cacheVariances !== null) { @@ -1056,7 +1056,7 @@ public function vary($cacheVariances = null) { * @param string $hash the unique hash that identifies this response * @param bool $weak whether the response is semantically the same as * other with the same hash or not - * @return string + * @return string|null */ public function etag($hash = null, $weak = false) { if ($hash !== null) { diff --git a/src/Network/Session.php b/src/Network/Session.php index e2e6e90a682..33caa7e7be4 100644 --- a/src/Network/Session.php +++ b/src/Network/Session.php @@ -352,7 +352,7 @@ public function check($name = null) { } if (!isset($_SESSION)) { - return null; + return false; } return Hash::get($_SESSION, $name) !== null; diff --git a/src/Network/Socket.php b/src/Network/Socket.php index e53ffbd4a83..7cd445d6362 100644 --- a/src/Network/Socket.php +++ b/src/Network/Socket.php @@ -188,7 +188,7 @@ protected function _connectionErrorHandler($code, $message) { */ public function context() { if (!$this->connection) { - return; + return null; } return stream_context_get_options($this->connection); } @@ -232,7 +232,7 @@ public function addresses() { /** * Get the last error as a string. * - * @return string Last error + * @return string|null Last error */ public function lastError() { if (!empty($this->lastError)) { diff --git a/src/ORM/ResultSet.php b/src/ORM/ResultSet.php index b32217f1101..b8d7f873b2e 100644 --- a/src/ORM/ResultSet.php +++ b/src/ORM/ResultSet.php @@ -255,7 +255,7 @@ public function unserialize($serialized) { * end of the results simulating the behavior when the result set is backed * by a statement. * - * @return array|object + * @return array|object|null */ public function first() { if (isset($this->_results[0])) { diff --git a/src/Routing/Filter/AssetFilter.php b/src/Routing/Filter/AssetFilter.php index f292f78080f..0c8507fc704 100644 --- a/src/Routing/Filter/AssetFilter.php +++ b/src/Routing/Filter/AssetFilter.php @@ -48,7 +48,7 @@ public function beforeDispatch(Event $event) { $url = urldecode($request->url); if (strpos($url, '..') !== false || strpos($url, '.') === false) { - return; + return null; } $assetFile = $this->_getAssetFile($url); diff --git a/src/Validation/Validator.php b/src/Validation/Validator.php index a0debc451df..5c172a3e79f 100644 --- a/src/Validation/Validator.php +++ b/src/Validation/Validator.php @@ -149,7 +149,7 @@ public function hasField($name) { * * @param string $name The name under which the provider should be set. * @param null|object|string $object Provider object or class name. - * @return Validator|object|string + * @return Validator|object|string|null */ public function provider($name, $object = null) { if ($object === null) { diff --git a/src/View/Helper/PaginatorHelper.php b/src/View/Helper/PaginatorHelper.php index 4f238ff9637..596aebcfd7b 100644 --- a/src/View/Helper/PaginatorHelper.php +++ b/src/View/Helper/PaginatorHelper.php @@ -175,7 +175,7 @@ public function current($model = null) { * * @param string $model Optional model name. Uses the default if none is specified. * @param array $options Options for pagination links. See #options for list of keys. - * @return string The name of the key by which the recordset is being sorted, or + * @return string|null The name of the key by which the recordset is being sorted, or * null if the results are not currently sorted. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::sortKey */ @@ -491,7 +491,7 @@ protected function _hasPage($model, $page) { /** * Gets the default model of the paged sets * - * @return string Model name or null if the pagination isn't initialized. + * @return string|null Model name or null if the pagination isn't initialized. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::defaultModel */ public function defaultModel() {