From e690662f0e26df0f46cb846504f2ebcf23447643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=BCrth?= Date: Fri, 25 Sep 2015 17:11:20 +0200 Subject: [PATCH] Various improvments to the CakePH Plib files Mostly CS, doc blocks and explicit returning nulls. --- lib/Cake/Console/Command/AclShell.php | 4 +- lib/Cake/Console/Command/Task/FixtureTask.php | 4 +- lib/Cake/Console/Command/Task/ViewTask.php | 2 +- lib/Cake/Console/Command/TestShell.php | 4 +- .../Templates/default/classes/model.ctp | 2 +- .../Console/Templates/default/views/view.ctp | 3 +- lib/Cake/Controller/Component/Acl/DbAcl.php | 1 - lib/Cake/Controller/Component/Acl/PhpAcl.php | 2 - .../Controller/Component/AclComponent.php | 4 +- .../Controller/Component/AuthComponent.php | 6 +-- .../Controller/Component/CookieComponent.php | 1 - .../Component/RequestHandlerComponent.php | 3 +- .../Controller/Component/SessionComponent.php | 2 +- lib/Cake/Core/Object.php | 1 - lib/Cake/Event/CakeEvent.php | 1 - lib/Cake/Event/CakeEventManager.php | 4 +- lib/Cake/Log/Engine/FileLog.php | 2 +- lib/Cake/Model/AclNode.php | 1 - lib/Cake/Model/Datasource/CakeSession.php | 2 +- lib/Cake/Model/Datasource/DboSource.php | 6 +-- .../Datasource/Session/DatabaseSession.php | 1 - lib/Cake/Model/Model.php | 4 +- lib/Cake/Network/CakeResponse.php | 2 +- lib/Cake/Network/CakeSocket.php | 2 +- lib/Cake/Routing/Dispatcher.php | 2 +- lib/Cake/Routing/Filter/AssetDispatcher.php | 2 +- lib/Cake/Routing/Filter/CacheDispatcher.php | 2 +- lib/Cake/Utility/Debugger.php | 7 ++- lib/Cake/Utility/Hash.php | 2 +- lib/Cake/Utility/Set.php | 4 +- lib/Cake/View/Errors/fatal_error.ctp | 1 - lib/Cake/View/Errors/missing_action.ctp | 3 +- lib/Cake/View/Errors/missing_behavior.ctp | 3 +- lib/Cake/View/Errors/missing_component.ctp | 3 +- lib/Cake/View/Errors/missing_controller.ctp | 3 +- lib/Cake/View/Errors/missing_database.ctp | 3 +- lib/Cake/View/Errors/missing_datasource.ctp | 5 +- .../View/Errors/missing_datasource_config.ctp | 3 +- lib/Cake/View/Errors/missing_helper.ctp | 3 +- lib/Cake/View/Errors/missing_layout.ctp | 3 +- lib/Cake/View/Errors/missing_plugin.ctp | 3 +- lib/Cake/View/Errors/missing_table.ctp | 5 +- lib/Cake/View/Errors/missing_view.ctp | 3 +- lib/Cake/View/Errors/pdo_error.ctp | 3 +- lib/Cake/View/Errors/private_action.ctp | 3 +- lib/Cake/View/Errors/scaffold_error.ctp | 3 +- lib/Cake/View/Helper/CacheHelper.php | 6 +-- lib/Cake/View/Helper/FlashHelper.php | 2 +- lib/Cake/View/Helper/FormHelper.php | 6 +-- lib/Cake/View/Helper/HtmlHelper.php | 2 +- lib/Cake/View/Scaffolds/form.ctp | 12 ++--- lib/Cake/View/Scaffolds/index.ctp | 22 ++++---- lib/Cake/View/Scaffolds/view.ctp | 4 +- lib/Cake/View/View.php | 2 +- lib/Cake/basics.php | 54 +++++++++---------- 55 files changed, 123 insertions(+), 120 deletions(-) diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index f5e493f7a..15536ebb6 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -558,7 +558,7 @@ class AclShell extends AppShell { * or an array of properties to use in AcoNode::node() * * @param string $class Class type you want (Aro/Aco) - * @param string|array $identifier A mixed identifier for finding the node. + * @param string|array|null $identifier A mixed identifier for finding the node, otherwise null. * @return int Integer of NodeId. Will trigger an error if nothing is found. */ protected function _getNodeId($class, $identifier) { @@ -568,7 +568,7 @@ class AclShell extends AppShell { $identifier = var_export($identifier, true); } $this->error(__d('cake_console', 'Could not find node using reference "%s"', $identifier)); - return; + return null; } return Hash::get($node, "0.{$class}.id"); } diff --git a/lib/Cake/Console/Command/Task/FixtureTask.php b/lib/Cake/Console/Command/Task/FixtureTask.php index b20c22b4b..4cd95d34a 100644 --- a/lib/Cake/Console/Command/Task/FixtureTask.php +++ b/lib/Cake/Console/Command/Task/FixtureTask.php @@ -210,7 +210,7 @@ class FixtureTask extends BakeTask { * @param string $model Name of model to bake. * @param string $useTable Name of table to use. * @param array $importOptions Options for public $import - * @return string Baked fixture content + * @return string|null Baked fixture content, otherwise null. */ public function bake($model, $useTable = false, $importOptions = array()) { App::uses('CakeSchema', 'Model'); @@ -243,7 +243,7 @@ class FixtureTask extends BakeTask { $data = $this->_Schema->read(array('models' => false, 'connection' => $this->connection)); if (!isset($data['tables'][$useTable])) { $this->err("Warning: Could not find the '${useTable}' table for ${model}."); - return; + return null; } $tableInfo = $data['tables'][$useTable]; diff --git a/lib/Cake/Console/Command/Task/ViewTask.php b/lib/Cake/Console/Command/Task/ViewTask.php index 2c49775dc..06ecf0013 100644 --- a/lib/Cake/Console/Command/Task/ViewTask.php +++ b/lib/Cake/Console/Command/Task/ViewTask.php @@ -89,7 +89,7 @@ class ViewTask extends BakeTask { $this->_interactive(); } if (empty($this->args[0])) { - return; + return null; } if (!isset($this->connection)) { $this->connection = 'default'; diff --git a/lib/Cake/Console/Command/TestShell.php b/lib/Cake/Console/Command/TestShell.php index 15012bfeb..fe6cfd873 100644 --- a/lib/Cake/Console/Command/TestShell.php +++ b/lib/Cake/Console/Command/TestShell.php @@ -179,11 +179,11 @@ class TestShell extends Shell { /** * Parse the CLI options into an array CakeTestDispatcher can use. * - * @return array Array of params for CakeTestDispatcher + * @return array|null Array of params for CakeTestDispatcher or null. */ protected function _parseArgs() { if (empty($this->args)) { - return; + return null; } $params = array( 'core' => false, diff --git a/lib/Cake/Console/Templates/default/classes/model.ctp b/lib/Cake/Console/Templates/default/classes/model.ctp index 0014e004e..6c3e64763 100644 --- a/lib/Cake/Console/Templates/default/classes/model.ctp +++ b/lib/Cake/Console/Templates/default/classes/model.ctp @@ -106,7 +106,7 @@ foreach ($associations as $assoc): if (!empty($assoc)): ?> - //The Associations below have been created with all possible keys, those that are not needed can be removed + // The Associations below have been created with all possible keys, those that are not needed can be removed \n"; - +_Instance = $adapter; $this->_Instance->initialize($this); - return; + return null; } return $this->_Instance; } diff --git a/lib/Cake/Controller/Component/AuthComponent.php b/lib/Cake/Controller/Component/AuthComponent.php index e36114419..56b6a06dd 100644 --- a/lib/Cake/Controller/Component/AuthComponent.php +++ b/lib/Cake/Controller/Component/AuthComponent.php @@ -481,7 +481,7 @@ class AuthComponent extends Component { */ public function constructAuthorize() { if (empty($this->authorize)) { - return; + return null; } $this->_authorizeObjects = array(); $config = Hash::normalize((array)$this->authorize); @@ -772,12 +772,12 @@ class AuthComponent extends Component { /** * Loads the configured authentication objects. * - * @return mixed either null on empty authenticate value, or an array of loaded objects. + * @return mixed Either null on empty authenticate value, or an array of loaded objects. * @throws CakeException */ public function constructAuthenticate() { if (empty($this->authenticate)) { - return; + return null; } $this->_authenticateObjects = array(); $config = Hash::normalize((array)$this->authenticate); diff --git a/lib/Cake/Controller/Component/CookieComponent.php b/lib/Cake/Controller/Component/CookieComponent.php index 6ed908d55..2bb75194d 100644 --- a/lib/Cake/Controller/Component/CookieComponent.php +++ b/lib/Cake/Controller/Component/CookieComponent.php @@ -27,7 +27,6 @@ App::uses('Hash', 'Utility'); * * @package Cake.Controller.Component * @link http://book.cakephp.org/2.0/en/core-libraries/components/cookie.html - * */ class CookieComponent extends Component { diff --git a/lib/Cake/Controller/Component/RequestHandlerComponent.php b/lib/Cake/Controller/Component/RequestHandlerComponent.php index 271b56773..ea1d72704 100644 --- a/lib/Cake/Controller/Component/RequestHandlerComponent.php +++ b/lib/Cake/Controller/Component/RequestHandlerComponent.php @@ -32,7 +32,6 @@ App::uses('Xml', 'Utility'); * * @package Cake.Controller.Component * @link http://book.cakephp.org/2.0/en/core-libraries/components/request-handling.html - * */ class RequestHandlerComponent extends Component { @@ -280,7 +279,7 @@ class RequestHandlerComponent extends Component { * "304 Not Modified" header. * * @param Controller $controller Controller instance. - * @return bool false if the render process should be aborted + * @return bool False if the render process should be aborted. */ public function beforeRender(Controller $controller) { if ($this->settings['checkHttpCache'] && $this->response->checkNotModified($this->request)) { diff --git a/lib/Cake/Controller/Component/SessionComponent.php b/lib/Cake/Controller/Component/SessionComponent.php index cb196775a..0a7dd062e 100644 --- a/lib/Cake/Controller/Component/SessionComponent.php +++ b/lib/Cake/Controller/Component/SessionComponent.php @@ -34,7 +34,7 @@ class SessionComponent extends Component { * Get / Set the userAgent * * @param string $userAgent Set the userAgent - * @return void + * @return string Current user agent. */ public function userAgent($userAgent = null) { return CakeSession::userAgent($userAgent); diff --git a/lib/Cake/Core/Object.php b/lib/Cake/Core/Object.php index 59ec9e3ef..ffc7f19dc 100644 --- a/lib/Cake/Core/Object.php +++ b/lib/Cake/Core/Object.php @@ -31,7 +31,6 @@ class Object { /** * Constructor, no-op - * */ public function __construct() { } diff --git a/lib/Cake/Event/CakeEvent.php b/lib/Cake/Event/CakeEvent.php index 869609283..d8ed26234 100644 --- a/lib/Cake/Event/CakeEvent.php +++ b/lib/Cake/Event/CakeEvent.php @@ -71,7 +71,6 @@ class CakeEvent { * $event = new CakeEvent('Order.afterBuy', $this, array('buyer' => $userData)); * $event = new CakeEvent('User.afterRegister', $UserModel); * ``` - * */ public function __construct($name, $subject = null, $data = null) { $this->_name = $name; diff --git a/lib/Cake/Event/CakeEventManager.php b/lib/Cake/Event/CakeEventManager.php index f647fd941..9043fbf94 100644 --- a/lib/Cake/Event/CakeEventManager.php +++ b/lib/Cake/Event/CakeEventManager.php @@ -172,10 +172,10 @@ class CakeEventManager { foreach (array_keys($this->_listeners) as $eventKey) { $this->detach($callable, $eventKey); } - return; + return null; } if (empty($this->_listeners[$eventKey])) { - return; + return null; } foreach ($this->_listeners[$eventKey] as $priority => $callables) { foreach ($callables as $k => $callback) { diff --git a/lib/Cake/Log/Engine/FileLog.php b/lib/Cake/Log/Engine/FileLog.php index 840889466..66d2ca5d2 100644 --- a/lib/Cake/Log/Engine/FileLog.php +++ b/lib/Cake/Log/Engine/FileLog.php @@ -196,7 +196,7 @@ class FileLog extends BaseLog { if (!file_exists($filepath) || filesize($filepath) < $this->_size ) { - return; + return null; } if ($this->_config['rotate'] === 0) { diff --git a/lib/Cake/Model/AclNode.php b/lib/Cake/Model/AclNode.php index ab73f7b1d..1080b9a22 100644 --- a/lib/Cake/Model/AclNode.php +++ b/lib/Cake/Model/AclNode.php @@ -39,7 +39,6 @@ class AclNode extends Model { /** * Constructor - * */ public function __construct() { $config = Configure::read('Acl.database'); diff --git a/lib/Cake/Model/Datasource/CakeSession.php b/lib/Cake/Model/Datasource/CakeSession.php index b6c20b209..b3b471686 100644 --- a/lib/Cake/Model/Datasource/CakeSession.php +++ b/lib/Cake/Model/Datasource/CakeSession.php @@ -357,7 +357,7 @@ class CakeSession { * Get / Set the user agent * * @param string|null $userAgent Set the user agent - * @return string Current user agent + * @return string Current user agent. */ public static function userAgent($userAgent = null) { if ($userAgent) { diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 927a6e369..9bd3b0ca0 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -1258,7 +1258,7 @@ class DboSource extends DataSource { $queryTemplate = $this->generateAssociationQuery($Model, $LinkModel, $type, $association, $assocData, $queryData, $external); if (empty($queryTemplate)) { - return; + return null; } if (!is_array($resultSet)) { @@ -1952,7 +1952,7 @@ class DboSource extends DataSource { * * @param string $type type of query being run. e.g select, create, update, delete, schema, alter. * @param array $data Array of data to insert into the query. - * @return string Rendered SQL expression to be run. + * @return string|null Rendered SQL expression to be run, otherwise null. */ public function renderStatement($type, $data) { extract($data); @@ -1986,7 +1986,7 @@ class DboSource extends DataSource { } return "CREATE TABLE {$table} (\n{$columns}{$indexes}) {$tableParameters};"; case 'alter': - return; + return null; } } diff --git a/lib/Cake/Model/Datasource/Session/DatabaseSession.php b/lib/Cake/Model/Datasource/Session/DatabaseSession.php index 08c398a7a..a9c6e8627 100644 --- a/lib/Cake/Model/Datasource/Session/DatabaseSession.php +++ b/lib/Cake/Model/Datasource/Session/DatabaseSession.php @@ -43,7 +43,6 @@ class DatabaseSession implements CakeSessionHandlerInterface { /** * Constructor. Looks at Session configuration information and * sets up the session model. - * */ public function __construct() { $modelName = Configure::read('Session.handler.model'); diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php index bfce2dd41..1b094cdf5 100644 --- a/lib/Cake/Model/Model.php +++ b/lib/Cake/Model/Model.php @@ -1190,12 +1190,12 @@ class Model extends Object implements CakeEventListener { * * @param string|array|SimpleXmlElement|DomNode $one Array or string of data * @param string $two Value string for the alternative indata method - * @return array Data with all of $one's keys and values + * @return array|null Data with all of $one's keys and values, otherwise null. * @link http://book.cakephp.org/2.0/en/models/saving-your-data.html */ public function set($one, $two = null) { if (!$one) { - return; + return null; } if (is_object($one)) { diff --git a/lib/Cake/Network/CakeResponse.php b/lib/Cake/Network/CakeResponse.php index 3c5a3c46a..fdefe1478 100644 --- a/lib/Cake/Network/CakeResponse.php +++ b/lib/Cake/Network/CakeResponse.php @@ -452,7 +452,7 @@ class CakeResponse { /** * Formats the Content-Type header based on the configured contentType and charset - * the charset will only be set in the header if the response is of type text/* + * the charset will only be set in the header if the response is of type text * * @return void */ diff --git a/lib/Cake/Network/CakeSocket.php b/lib/Cake/Network/CakeSocket.php index b4c378900..aebdee191 100644 --- a/lib/Cake/Network/CakeSocket.php +++ b/lib/Cake/Network/CakeSocket.php @@ -216,7 +216,7 @@ class CakeSocket { */ public function context() { if (!$this->connection) { - return; + return null; } return stream_context_get_options($this->connection); } diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 13e2a2248..87c0a8116 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -152,7 +152,7 @@ class Dispatcher implements CakeEventListener { return $beforeEvent->result->body(); } $beforeEvent->result->send(); - return; + return null; } $controller = $this->_getController($request, $response); diff --git a/lib/Cake/Routing/Filter/AssetDispatcher.php b/lib/Cake/Routing/Filter/AssetDispatcher.php index 3a4908bcf..c90a8235c 100644 --- a/lib/Cake/Routing/Filter/AssetDispatcher.php +++ b/lib/Cake/Routing/Filter/AssetDispatcher.php @@ -42,7 +42,7 @@ class AssetDispatcher extends DispatcherFilter { public function beforeDispatch(CakeEvent $event) { $url = urldecode($event->data['request']->url); if (strpos($url, '..') !== false || strpos($url, '.') === false) { - return; + return null; } if ($result = $this->_filterAsset($event)) { diff --git a/lib/Cake/Routing/Filter/CacheDispatcher.php b/lib/Cake/Routing/Filter/CacheDispatcher.php index 9219005bb..24361bf3b 100644 --- a/lib/Cake/Routing/Filter/CacheDispatcher.php +++ b/lib/Cake/Routing/Filter/CacheDispatcher.php @@ -39,7 +39,7 @@ class CacheDispatcher extends DispatcherFilter { */ public function beforeDispatch(CakeEvent $event) { if (Configure::read('Cache.check') !== true) { - return; + return null; } $path = $event->data['request']->here(); diff --git a/lib/Cake/Utility/Debugger.php b/lib/Cake/Utility/Debugger.php index b6fccf2aa..ec29a4d6e 100644 --- a/lib/Cake/Utility/Debugger.php +++ b/lib/Cake/Utility/Debugger.php @@ -91,7 +91,6 @@ class Debugger { /** * Constructor. - * */ public function __construct() { $docRef = ini_get('docref_root'); @@ -200,7 +199,7 @@ class Debugger { * @param string $file File on which error occurred * @param int $line Line that triggered the error * @param array $context Context - * @return bool true if error was handled + * @return bool|null True if error was handled, otherwise null. * @deprecated 3.0.0 Will be removed in 3.0. This function is superseded by Debugger::outputError(). */ public static function showError($code, $description, $file = null, $line = null, $context = null) { @@ -217,7 +216,7 @@ class Debugger { if (!in_array($info, $self->errors)) { $self->errors[] = $info; } else { - return; + return null; } switch ($code) { @@ -247,7 +246,7 @@ class Debugger { $level = LOG_NOTICE; break; default: - return; + return null; } $data = compact( diff --git a/lib/Cake/Utility/Hash.php b/lib/Cake/Utility/Hash.php index ad06cf95b..451e8f13e 100644 --- a/lib/Cake/Utility/Hash.php +++ b/lib/Cake/Utility/Hash.php @@ -465,7 +465,7 @@ class Hash { $count = count($paths); if (!$count) { - return; + return null; } for ($i = 0; $i < $count; $i++) { diff --git a/lib/Cake/Utility/Set.php b/lib/Cake/Utility/Set.php index d52c8d7ad..10750c1c6 100644 --- a/lib/Cake/Utility/Set.php +++ b/lib/Cake/Utility/Set.php @@ -228,7 +228,7 @@ class Set { * @param array $data Source array from which to extract the data * @param string $format Format string into which values will be inserted, see sprintf() * @param array $keys An array containing one or more Set::extract()-style key paths - * @return array An array of strings extracted from $keys and formatted with $format + * @return array|null An array of strings extracted from $keys and formatted with $format, otherwise null. * @link http://book.cakephp.org/2.0/en/core-utility-libraries/set.html#Set::format */ public static function format($data, $format, $keys) { @@ -236,7 +236,7 @@ class Set { $count = count($keys); if (!$count) { - return; + return null; } for ($i = 0; $i < $count; $i++) { diff --git a/lib/Cake/View/Errors/fatal_error.ctp b/lib/Cake/View/Errors/fatal_error.ctp index 0871555b8..52b2a8a72 100644 --- a/lib/Cake/View/Errors/fatal_error.ctp +++ b/lib/Cake/View/Errors/fatal_error.ctp @@ -36,4 +36,3 @@ if (extension_loaded('xdebug')) { xdebug_print_function_stack(); } -?> diff --git a/lib/Cake/View/Errors/missing_action.ctp b/lib/Cake/View/Errors/missing_action.ctp index 5876e9304..f507cd110 100644 --- a/lib/Cake/View/Errors/missing_action.ctp +++ b/lib/Cake/View/Errors/missing_action.ctp @@ -38,4 +38,5 @@ class extends AppController { :

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_behavior.ctp b/lib/Cake/View/Errors/missing_behavior.ctp index e8024ebf3..dee50802e 100644 --- a/lib/Cake/View/Errors/missing_behavior.ctp +++ b/lib/Cake/View/Errors/missing_behavior.ctp @@ -36,4 +36,5 @@ class extends ModelBehavior {

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_component.ctp b/lib/Cake/View/Errors/missing_component.ctp index ab5d77cf9..2bb1455e3 100644 --- a/lib/Cake/View/Errors/missing_component.ctp +++ b/lib/Cake/View/Errors/missing_component.ctp @@ -36,4 +36,5 @@ class extends Component {

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_controller.ctp b/lib/Cake/View/Errors/missing_controller.ctp index 7f31ff8f4..c20c9c87a 100644 --- a/lib/Cake/View/Errors/missing_controller.ctp +++ b/lib/Cake/View/Errors/missing_controller.ctp @@ -36,4 +36,5 @@ class AppController {

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_database.ctp b/lib/Cake/View/Errors/missing_database.ctp index 0432b7424..73c9ccd50 100644 --- a/lib/Cake/View/Errors/missing_database.ctp +++ b/lib/Cake/View/Errors/missing_database.ctp @@ -28,4 +28,5 @@

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_datasource.ctp b/lib/Cake/View/Errors/missing_datasource.ctp index 9a16d508c..7b4868374 100644 --- a/lib/Cake/View/Errors/missing_datasource.ctp +++ b/lib/Cake/View/Errors/missing_datasource.ctp @@ -20,7 +20,7 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';

: ' . h($pluginDot . $class) . ''); ?> - +

@@ -29,4 +29,5 @@ $pluginDot = empty($plugin) ? null : $plugin . '.';

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_datasource_config.ctp b/lib/Cake/View/Errors/missing_datasource_config.ctp index 0fe5929a6..b08f2d56b 100644 --- a/lib/Cake/View/Errors/missing_datasource_config.ctp +++ b/lib/Cake/View/Errors/missing_datasource_config.ctp @@ -24,4 +24,5 @@

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_helper.ctp b/lib/Cake/View/Errors/missing_helper.ctp index 93fa54ed2..0da9aa00e 100644 --- a/lib/Cake/View/Errors/missing_helper.ctp +++ b/lib/Cake/View/Errors/missing_helper.ctp @@ -36,4 +36,5 @@ class extends AppHelper {

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_layout.ctp b/lib/Cake/View/Errors/missing_layout.ctp index b8c5d81cf..e1cf0dfcb 100644 --- a/lib/Cake/View/Errors/missing_layout.ctp +++ b/lib/Cake/View/Errors/missing_layout.ctp @@ -41,4 +41,5 @@

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_plugin.ctp b/lib/Cake/View/Errors/missing_plugin.ctp index 0d5592e71..b2f02bc70 100644 --- a/lib/Cake/View/Errors/missing_plugin.ctp +++ b/lib/Cake/View/Errors/missing_plugin.ctp @@ -40,4 +40,5 @@ CakePlugin::loadAll();

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_table.ctp b/lib/Cake/View/Errors/missing_table.ctp index 7c308a864..34e943e04 100644 --- a/lib/Cake/View/Errors/missing_table.ctp +++ b/lib/Cake/View/Errors/missing_table.ctp @@ -17,11 +17,12 @@

: - ' . h($table) . '', '' . h($class) . '', '' . h($ds) . ''); ?> + ' . h($table) . '', '' . h($class) . '', '' . h($ds) . ''); ?>

:

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/missing_view.ctp b/lib/Cake/View/Errors/missing_view.ctp index b2579d578..37c3dcca8 100644 --- a/lib/Cake/View/Errors/missing_view.ctp +++ b/lib/Cake/View/Errors/missing_view.ctp @@ -41,4 +41,5 @@

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/pdo_error.ctp b/lib/Cake/View/Errors/pdo_error.ctp index b9c7a0ca3..71afc6f0a 100644 --- a/lib/Cake/View/Errors/pdo_error.ctp +++ b/lib/Cake/View/Errors/pdo_error.ctp @@ -33,4 +33,5 @@ :

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/private_action.ctp b/lib/Cake/View/Errors/private_action.ctp index 11a18a3b8..00810609e 100644 --- a/lib/Cake/View/Errors/private_action.ctp +++ b/lib/Cake/View/Errors/private_action.ctp @@ -24,4 +24,5 @@

-element('exception_stack_trace'); ?> +element('exception_stack_trace'); diff --git a/lib/Cake/View/Errors/scaffold_error.ctp b/lib/Cake/View/Errors/scaffold_error.ctp index ce1eea8e6..998d75e76 100644 --- a/lib/Cake/View/Errors/scaffold_error.ctp +++ b/lib/Cake/View/Errors/scaffold_error.ctp @@ -33,6 +33,5 @@ function _scaffoldError() {
element('exception_stack_trace'); + echo $this->element('exception_stack_trace'); } -?> diff --git a/lib/Cake/View/Helper/CacheHelper.php b/lib/Cake/View/Helper/CacheHelper.php index a6c7f47e3..ed5560a52 100644 --- a/lib/Cake/View/Helper/CacheHelper.php +++ b/lib/Cake/View/Helper/CacheHelper.php @@ -271,8 +271,8 @@ class CacheHelper extends AppHelper { * * @param string $content view content to write to a cache file. * @param string $timestamp Duration to set for cache file. - * @param bool $useCallbacks Whether to include statements in cached file which - * run callbacks. + * @param bool|null $useCallbacks Whether to include statements in cached file which + * run callbacks, otherwise null. * @return bool success of caching view. */ protected function _writeFile($content, $timestamp, $useCallbacks = false) { @@ -294,7 +294,7 @@ class CacheHelper extends AppHelper { $cache = strtolower(Inflector::slug($path)); if (empty($cache)) { - return; + return null; } $cache = $cache . '.php'; $file = '_getModel($model); if (!$object) { - return; + return null; } if ($key === 'key') { @@ -561,12 +561,12 @@ class FormHelper extends AppHelper { * generating the hash, else $this->fields is being used. * @param array $secureAttributes will be passed as html attributes into the hidden * input elements generated for the Security Component. - * @return string A hidden input field with a security hash + * @return string|null A hidden input field with a security hash, otherwise null. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::secure */ public function secure($fields = array(), $secureAttributes = array()) { if (!isset($this->request['_Token']) || empty($this->request['_Token'])) { - return; + return null; } $locked = array(); $unlockedFields = $this->_unlockedFields; diff --git a/lib/Cake/View/Helper/HtmlHelper.php b/lib/Cake/View/Helper/HtmlHelper.php index a9c99e0cc..5098cec86 100644 --- a/lib/Cake/View/Helper/HtmlHelper.php +++ b/lib/Cake/View/Helper/HtmlHelper.php @@ -446,7 +446,7 @@ class HtmlHelper extends AppHelper { if (empty($options['block'])) { return $out . "\n"; } - return; + return ''; } if ($options['once'] && isset($this->_includedAssets[__METHOD__][$path])) { diff --git a/lib/Cake/View/Scaffolds/form.ctp b/lib/Cake/View/Scaffolds/form.ctp index 2f2face1d..0a6b5ddea 100644 --- a/lib/Cake/View/Scaffolds/form.ctp +++ b/lib/Cake/View/Scaffolds/form.ctp @@ -35,9 +35,9 @@
  • Html->link(__d('cake', 'List') . ' ' . $pluralHumanName, array('action' => 'index')); ?>
  • $_data) { - foreach ($_data as $_alias => $_details) { - if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) { + foreach ($associations as $_type => $_data): + foreach ($_data as $_alias => $_details): + if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)): echo "\t\t
  • " . $this->Html->link( __d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index') @@ -47,9 +47,9 @@ array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add') ) . "
  • \n"; $done[] = $_details['controller']; - } - } - } + endif; + endforeach; + endforeach; ?> diff --git a/lib/Cake/View/Scaffolds/index.ctp b/lib/Cake/View/Scaffolds/index.ctp index dbae19167..e0219f4f0 100644 --- a/lib/Cake/View/Scaffolds/index.ctp +++ b/lib/Cake/View/Scaffolds/index.ctp @@ -26,21 +26,21 @@ '; - foreach ($scaffoldFields as $_field) { + foreach ($scaffoldFields as $_field): $isKey = false; - if (!empty($associations['belongsTo'])) { - foreach ($associations['belongsTo'] as $_alias => $_details) { - if ($_field === $_details['foreignKey']) { + if (!empty($associations['belongsTo'])): + foreach ($associations['belongsTo'] as $_alias => $_details): + if ($_field === $_details['foreignKey']): $isKey = true; echo '' . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . ''; break; - } - } - } - if ($isKey !== true) { + endif; + endforeach; + endif; + if ($isKey !== true): echo '' . h(${$singularVar}[$modelClass][$_field]) . ''; - } - } + endif; + endforeach; echo ''; echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey])); @@ -67,7 +67,7 @@ endforeach; Paginator->prev('< ' . __d('cake', 'previous'), array(), null, array('class' => 'prev disabled')); echo $this->Paginator->numbers(array('separator' => '')); - echo $this->Paginator->next(__d('cake', 'next') .' >', array(), null, array('class' => 'next disabled')); + echo $this->Paginator->next(__d('cake', 'next') . ' >', array(), null, array('class' => 'next disabled')); ?> diff --git a/lib/Cake/View/Scaffolds/view.ctp b/lib/Cake/View/Scaffolds/view.ctp index 8ec83432f..64a3e31f1 100644 --- a/lib/Cake/View/Scaffolds/view.ctp +++ b/lib/Cake/View/Scaffolds/view.ctp @@ -95,10 +95,10 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
    " . Inflector::humanize($_field) . "\n"; echo "\t\t
    \n\t" . ${$singularVar}[$_alias][$_field] . "\n 
    \n"; - } + endforeach; ?>
    diff --git a/lib/Cake/View/View.php b/lib/Cake/View/View.php index e1014fad3..12434f7d2 100644 --- a/lib/Cake/View/View.php +++ b/lib/Cake/View/View.php @@ -464,7 +464,7 @@ class View extends Object { */ public function render($view = null, $layout = null) { if ($this->hasRendered) { - return; + return null; } if ($view !== false && $viewFileName = $this->_getViewFileName($view)) { diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 51afffa18..e1edb6ea1 100644 --- a/lib/Cake/basics.php +++ b/lib/Cake/basics.php @@ -580,7 +580,7 @@ if (!function_exists('__')) { */ function __($singular, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); @@ -600,13 +600,13 @@ if (!function_exists('__n')) { * @param string $singular Singular text to translate * @param string $plural Plural text * @param int $count Count - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return mixed plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n */ function __n($singular, $plural, $count, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); @@ -624,13 +624,13 @@ if (!function_exists('__d')) { * * @param string $domain Domain * @param string $msg String to translate - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d */ function __d($domain, $msg, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain); @@ -651,13 +651,13 @@ if (!function_exists('__dn')) { * @param string $singular Singular string to translate * @param string $plural Plural * @param int $count Count - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn */ function __dn($domain, $singular, $plural, $count, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, I18n::LC_MESSAGES, $count); @@ -689,13 +689,13 @@ if (!function_exists('__dc')) { * @param string $domain Domain * @param string $msg Message to translate * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc */ function __dc($domain, $msg, $category, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain, $category); @@ -731,13 +731,13 @@ if (!function_exists('__dcn')) { * @param string $plural Plural * @param int $count Count * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn */ function __dcn($domain, $singular, $plural, $count, $category, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, $category, $count); @@ -765,13 +765,13 @@ if (!function_exists('__c')) { * * @param string $msg String to translate * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c */ function __c($msg, $category, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, null, $category); @@ -788,13 +788,13 @@ if (!function_exists('__x')) { * * @param string $context Context of the text * @param string $singular Text to translate - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return mixed translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ */ function __x($context, $singular, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); @@ -815,13 +815,13 @@ if (!function_exists('__xn')) { * @param string $singular Singular text to translate * @param string $plural Plural text * @param int $count Count - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return mixed plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n */ function __xn($context, $singular, $plural, $count, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); @@ -840,13 +840,13 @@ if (!function_exists('__dx')) { * @param string $domain Domain * @param string $context Context of the text * @param string $msg String to translate - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d */ function __dx($domain, $context, $msg, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain, null, null, null, $context); @@ -868,13 +868,13 @@ if (!function_exists('__dxn')) { * @param string $singular Singular string to translate * @param string $plural Plural * @param int $count Count - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn */ function __dxn($domain, $context, $singular, $plural, $count, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, I18n::LC_MESSAGES, $count, null, $context); @@ -907,13 +907,13 @@ if (!function_exists('__dxc')) { * @param string $context Context of the text * @param string $msg Message to translate * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc */ function __dxc($domain, $context, $msg, $category, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, $domain, $category, null, null, $context); @@ -950,13 +950,13 @@ if (!function_exists('__dxcn')) { * @param string $plural Plural * @param int $count Count * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string plural form of translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn */ function __dxcn($domain, $context, $singular, $plural, $count, $category, $args = null) { if (!$singular) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($singular, $plural, $domain, $category, $count, null, $context); @@ -985,13 +985,13 @@ if (!function_exists('__xc')) { * @param string $context Context of the text * @param string $msg String to translate * @param int $category Category - * @param mixed $args Array with arguments or multiple arguments in function + * @param mixed $args Array with arguments or multiple arguments in function, otherwise null. * @return string translated string * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c */ function __xc($context, $msg, $category, $args = null) { if (!$msg) { - return; + return null; } App::uses('I18n', 'I18n'); $translated = I18n::translate($msg, null, null, $category, null, null, $context);