Skip to content

Commit

Permalink
Do not mix void with other return types.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Scherer committed Oct 10, 2015
1 parent 29cfdc6 commit 4c525a0
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 59 deletions.
2 changes: 1 addition & 1 deletion src/Console/ConsoleOutput.php
Expand Up @@ -301,7 +301,7 @@ public function styles($style = null, $definition = null)
* Get/Set the output type to use. The output type how formatting tags are treated.
*
* @param int|null $type The output type to use. Should be one of the class constants.
* @return int|void Either null or the value if getting.
* @return int|null Either null or the value if getting.
*/
public function outputAs($type = null)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -251,7 +251,7 @@ public function initialize(array $config)
* Callback for Controller.startup event.
*
* @param \Cake\Event\Event $event Event instance.
* @return void|\Cake\Network\Response
* @return \Cake\Network\Response|null
*/
public function startup(Event $event)
{
Expand All @@ -266,7 +266,7 @@ public function startup(Event $event)
* `checkAuthIn` config.
*
* @param \Cake\Event\Event $event Event instance.
* @return void|\Cake\Network\Response
* @return \Cake\Network\Response|null
*/
public function authCheck(Event $event)
{
Expand Down Expand Up @@ -347,7 +347,7 @@ protected function _isAllowed(Controller $controller)
* is returned.
*
* @param \Cake\Controller\Controller $controller A reference to the controller object.
* @return void|\Cake\Network\Response Null if current action is login action
* @return \Cake\Network\Response|null Null if current action is login action
* else response object returned by authenticate object or Controller::redirect().
*/
protected function _unauthenticated(Controller $controller)
Expand Down Expand Up @@ -657,14 +657,14 @@ public function logout()
* Get the current user from storage.
*
* @param string $key Field to retrieve. Leave null to get entire User record.
* @return array|void Either User record or null if no user is logged in.
* @return array|null Either User record or null if no user is logged in.
* @link http://book.cakephp.org/3.0/en/controllers/components/authentication.html#accessing-the-logged-in-user
*/
public function user($key = null)
{
$user = $this->storage()->read();
if (!$user) {
return;
return null;
}

if ($key === null) {
Expand Down Expand Up @@ -818,13 +818,13 @@ public function constructAuthenticate()
*
* @param \Cake\Auth\Storage\StorageInterface|null $storage Sets provided
* object as storage or if null returns configuread storage object.
* @return \Cake\Auth\Storage\StorageInterface|void
* @return \Cake\Auth\Storage\StorageInterface|null
*/
public function storage(StorageInterface $storage = null)
{
if ($storage !== null) {
$this->_storage = $storage;
return;
return null;
}

if ($this->_storage) {
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -245,7 +245,7 @@ public function convertXml($xml)
* @param Event $event The Controller.beforeRedirect event.
* @param string|array $url A string or array containing the redirect location
* @param \Cake\Network\Response $response The response object.
* @return void|\Cake\Network\Response The response object if the redirect is caught.
* @return \Cake\Network\Response|null The response object if the redirect is caught.
*/
public function beforeRedirect(Event $event, $url, Response $response)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/Controller.php
Expand Up @@ -484,7 +484,7 @@ protected function _loadComponents()
* - Calls the controller `beforeFilter`.
* - triggers Component `startup` methods.
*
* @return void|\Cake\Network\Response
* @return \Cake\Network\Response|null
*/
public function startupProcess()
{
Expand All @@ -505,7 +505,7 @@ public function startupProcess()
* - triggers the component `shutdown` callback.
* - calls the Controller's `afterFilter` method.
*
* @return void|\Cake\Network\Response
* @return \Cake\Network\Response|null
*/
public function shutdownProcess()
{
Expand All @@ -522,7 +522,7 @@ public function shutdownProcess()
* @param string|array $url A string or array-based URL pointing to another location within the app,
* or an absolute URL
* @param int $status HTTP status code (eg: 301)
* @return void|\Cake\Network\Response
* @return \Cake\Network\Response|null
* @link http://book.cakephp.org/3.0/en/controllers.html#Controller::redirect
*/
public function redirect($url, $status = 302)
Expand Down
4 changes: 2 additions & 2 deletions src/Database/Query.php
Expand Up @@ -1580,7 +1580,7 @@ public function decorateResults($callback, $overwrite = false)
*
* @param callable $callback the function to be executed for each ExpressionInterface
* found inside this query.
* @return void|$this
* @return $this|null
*/
public function traverseExpressions(callable $callback)
{
Expand All @@ -1589,7 +1589,7 @@ public function traverseExpressions(callable $callback)
foreach ($expression as $e) {
$visitor($e);
}
return;
return null;
}

if ($expression instanceof ExpressionInterface) {
Expand Down
8 changes: 4 additions & 4 deletions src/I18n/I18n.php
Expand Up @@ -120,7 +120,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|void The configured translator.
* @return \Aura\Intl\Translator|null The configured translator.
*/
public static function translator($name = 'default', $locale = null, callable $loader = null)
{
Expand All @@ -131,7 +131,7 @@ public static function translator($name = 'default', $locale = null, callable $l

$packages = static::translators()->getPackages();
$packages->set($name, $locale, $loader);
return;
return null;
}

$translators = static::translators();
Expand Down Expand Up @@ -206,7 +206,7 @@ public static function config($name, callable $loader)
* locale as stored in the `intl.default_locale` PHP setting.
*
* @param string|null $locale The name of the locale to set as default.
* @return string|void The name of the default locale.
* @return string|null The name of the default locale.
*/
public static function locale($locale = null)
{
Expand All @@ -217,7 +217,7 @@ public static function locale($locale = null)
if (isset(static::$_collection)) {
static::translators()->setLocale($locale);
}
return;
return null;
}

$current = Locale::getDefault();
Expand Down
24 changes: 12 additions & 12 deletions src/I18n/functions.php
Expand Up @@ -69,13 +69,13 @@ function __n($singular, $plural, $count, $args = null)
* @param string $domain Domain.
* @param string $msg String to translate.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Translated string.
* @return string|null Translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__d
*/
function __d($domain, $msg, $args = null)
{
if (!$msg) {
return;
return null;
}
$arguments = func_num_args() === 3 ? (array)$args : array_slice(func_get_args(), 2);
return I18n::translator($domain)->translate($msg, $arguments);
Expand All @@ -94,13 +94,13 @@ function __d($domain, $msg, $args = null)
* @param string $plural Plural.
* @param int $count Count.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Plural form of translated string.
* @return string|null Plural form of translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dn
*/
function __dn($domain, $singular, $plural, $count, $args = null)
{
if (!$singular) {
return;
return null;
}

$arguments = func_num_args() === 5 ? (array)$args : array_slice(func_get_args(), 4);
Expand All @@ -121,13 +121,13 @@ function __dn($domain, $singular, $plural, $count, $args = null)
* @param string $context Context of the text.
* @param string $singular Text to translate.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Translated string.
* @return string|null Translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__
*/
function __x($context, $singular, $args = null)
{
if (!$singular) {
return;
return null;
}

$arguments = func_num_args() === 3 ? (array)$args : array_slice(func_get_args(), 2);
Expand All @@ -148,13 +148,13 @@ function __x($context, $singular, $args = null)
* @param string $plural Plural text.
* @param int $count Count.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Plural form of translated string.
* @return string|null Plural form of translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__xn
*/
function __xn($context, $singular, $plural, $count, $args = null)
{
if (!$singular) {
return;
return null;
}

$arguments = func_num_args() === 5 ? (array)$args : array_slice(func_get_args(), 2);
Expand All @@ -176,13 +176,13 @@ function __xn($context, $singular, $plural, $count, $args = null)
* @param string $context Context of the text.
* @param string $msg String to translate.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Translated string.
* @return string|null Translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dx
*/
function __dx($domain, $context, $msg, $args = null)
{
if (!$msg) {
return;
return null;
}

$arguments = func_num_args() === 4 ? (array)$args : array_slice(func_get_args(), 2);
Expand All @@ -207,13 +207,13 @@ function __dx($domain, $context, $msg, $args = null)
* @param string $plural Plural text.
* @param int $count Count.
* @param mixed $args Array with arguments or multiple arguments in function.
* @return void|string Plural form of translated string.
* @return string|null Plural form of translated string.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#__dxn
*/
function __dxn($domain, $context, $singular, $plural, $count, $args = null)
{
if (!$singular) {
return;
return null;
}

$arguments = func_num_args() === 6 ? (array)$args : array_slice(func_get_args(), 2);
Expand Down
4 changes: 2 additions & 2 deletions src/Routing/Dispatcher.php
Expand Up @@ -54,7 +54,7 @@ class Dispatcher
*
* @param \Cake\Network\Request $request Request object to dispatch.
* @param \Cake\Network\Response $response Response object to put the results of the dispatch into.
* @return string|void if `$request['return']` is set then it returns response body, null otherwise
* @return string|null if `$request['return']` is set then it returns response body, null otherwise
* @throws \Cake\Routing\Exception\MissingControllerException When the controller is missing.
*/
public function dispatch(Request $request, Response $response)
Expand All @@ -67,7 +67,7 @@ public function dispatch(Request $request, Response $response)
return $beforeEvent->result->body();
}
$beforeEvent->result->send();
return;
return null;
}

$controller = false;
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Route/Route.php
Expand Up @@ -116,7 +116,7 @@ public function __construct($template, $defaults = [], array $options = [])
* Get/Set the supported extensions for this route.
*
* @param null|string|array $extensions The extensions to set. Use null to get.
* @return array|void The extensions or null.
* @return array|null The extensions or null.
*/
public function extensions($extensions = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Routing/RouteBuilder.php
Expand Up @@ -132,7 +132,7 @@ public function __construct(RouteCollection $collection, $path, array $params =
* Get or set default route class.
*
* @param string|null $routeClass Class name.
* @return string|void
* @return string|null
*/
public function routeClass($routeClass = null)
{
Expand All @@ -149,7 +149,7 @@ public function routeClass($routeClass = null)
* extensions applied. However, setting extensions does not modify existing routes.
*
* @param null|string|array $extensions Either the extensions to use or null.
* @return array|void
* @return array|null
*/
public function extensions($extensions = null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Routing/Router.php
Expand Up @@ -161,7 +161,7 @@ class Router
* Get or set default route class.
*
* @param string|null $routeClass Class name.
* @return string|void
* @return string|null
*/
public static function defaultRouteClass($routeClass = null)
{
Expand Down
10 changes: 5 additions & 5 deletions src/Shell/CompletionShell.php
Expand Up @@ -51,7 +51,7 @@ public function main()
/**
* list commands
*
* @return void|int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool|null Returns the number of bytes returned from writing to stdout.
*/
public function commands()
{
Expand All @@ -62,7 +62,7 @@ public function commands()
/**
* list options for the named command
*
* @return void|int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool|null Returns the number of bytes returned from writing to stdout.
*/
public function options()
{
Expand All @@ -78,7 +78,7 @@ public function options()
/**
* list subcommands for the named command
*
* @return void|int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool|null Returns the number of bytes returned from writing to stdout.
*/
public function subcommands()
{
Expand All @@ -93,7 +93,7 @@ public function subcommands()
/**
* Guess autocomplete from the whole argument string
*
* @return void|int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool|null Returns the number of bytes returned from writing to stdout.
*/
public function fuzzy()
{
Expand Down Expand Up @@ -151,7 +151,7 @@ public function getOptionParser()
* Emit results as a string, space delimited
*
* @param array $options The options to output
* @return void|int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool|null Returns the number of bytes returned from writing to stdout.
*/
protected function _output($options = [])
{
Expand Down
2 changes: 1 addition & 1 deletion src/Shell/I18nShell.php
Expand Up @@ -74,7 +74,7 @@ public function main()
* Inits PO file from POT file.
*
* @param string|null $language Language code to use.
* @return void|int
* @return int|null
*/
public function init($language = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/TestSuite/Fixture/TestFixture.php
Expand Up @@ -204,13 +204,13 @@ protected function _schemaFromImport()
* Get/Set the Cake\Database\Schema\Table instance used by this fixture.
*
* @param \Cake\Database\Schema\Table $schema The table to set.
* @return void|\Cake\Database\Schema\Table
* @return \Cake\Database\Schema\Table|null
*/
public function schema(Table $schema = null)
{
if ($schema) {
$this->_schema = $schema;
return;
return null;
}
return $this->_schema;
}
Expand Down

0 comments on commit 4c525a0

Please sign in to comment.