mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Simplification of return types. No need to return more mixed than necessary.
This commit is contained in:
parent
345a18f15f
commit
41c646c5a1
9 changed files with 26 additions and 26 deletions
|
@ -355,7 +355,7 @@ class SecurityComponent extends Component {
|
|||
* Check if HTTP methods are required
|
||||
*
|
||||
* @param Controller $controller Instantiating controller
|
||||
* @return bool|null True if $method is required
|
||||
* @return bool True if $method is required
|
||||
*/
|
||||
protected function _methodsRequired(Controller $controller) {
|
||||
foreach (array('Post', 'Get', 'Put', 'Delete') as $method) {
|
||||
|
@ -365,7 +365,7 @@ class SecurityComponent extends Component {
|
|||
if (in_array($this->_action, $require) || $this->$property === array('*')) {
|
||||
if (!$this->request->is($method)) {
|
||||
if (!$this->blackHole($controller, $method)) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ class SecurityComponent extends Component {
|
|||
* Check if access requires secure connection
|
||||
*
|
||||
* @param Controller $controller Instantiating controller
|
||||
* @return bool|null True if secure connection required
|
||||
* @return bool True if secure connection required
|
||||
*/
|
||||
protected function _secureRequired(Controller $controller) {
|
||||
if (is_array($this->requireSecure) && !empty($this->requireSecure)) {
|
||||
|
@ -387,7 +387,7 @@ class SecurityComponent extends Component {
|
|||
if (in_array($this->_action, $requireSecure) || $this->requireSecure === array('*')) {
|
||||
if (!$this->request->is('ssl')) {
|
||||
if (!$this->blackHole($controller, 'secure')) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -824,14 +824,14 @@ class Multibyte {
|
|||
*
|
||||
* @param int $char decimal value of character
|
||||
* @param string $type Type 'lower' or 'upper'. Defaults to 'lower'.
|
||||
* @return array|null
|
||||
* @return array
|
||||
*/
|
||||
protected static function _find($char, $type = 'lower') {
|
||||
$found = array();
|
||||
if (!isset(self::$_codeRange[$char])) {
|
||||
$range = self::_codepoint($char);
|
||||
if ($range === false) {
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
if (!Configure::configured('_cake_core_')) {
|
||||
App::uses('PhpReader', 'Configure');
|
||||
|
@ -843,7 +843,7 @@ class Multibyte {
|
|||
}
|
||||
|
||||
if (!self::$_codeRange[$char]) {
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
self::$_table = self::$_codeRange[$char];
|
||||
$count = count(self::$_caseFold[self::$_table]);
|
||||
|
|
|
@ -73,7 +73,7 @@ class AclBehavior extends ModelBehavior {
|
|||
* @param Model $model Model using this behavior.
|
||||
* @param string|array|Model $ref Array with 'model' and 'foreign_key', model object, or string value
|
||||
* @param string $type Only needed when Acl is set up as 'both', specify 'Aro' or 'Aco' to get the correct node
|
||||
* @return array|null
|
||||
* @return array
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/acl.html#node
|
||||
*/
|
||||
public function node(Model $model, $ref = null, $type = null) {
|
||||
|
@ -81,7 +81,7 @@ class AclBehavior extends ModelBehavior {
|
|||
$type = $this->_typeMaps[$this->settings[$model->name]['type']];
|
||||
if (is_array($type)) {
|
||||
trigger_error(__d('cake_dev', 'AclBehavior is setup with more then one type, please specify type parameter for node()'), E_USER_WARNING);
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
}
|
||||
if (empty($ref)) {
|
||||
|
|
|
@ -443,7 +443,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
* @param int|string $id The ID of the record to read
|
||||
* @param string|array $fields Either a single string of a field name, or an array of field names
|
||||
* @param int $recursive The number of levels deep to fetch associated records
|
||||
* @return array|null Array of nodes from top most parent to current node
|
||||
* @return array Array of nodes from top most parent to current node
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/behaviors/tree.html#TreeBehavior::getPath
|
||||
*/
|
||||
public function getPath(Model $Model, $id = null, $fields = null, $recursive = null) {
|
||||
|
@ -462,7 +462,7 @@ class TreeBehavior extends ModelBehavior {
|
|||
if ($result) {
|
||||
$result = array_values($result);
|
||||
} else {
|
||||
return null;
|
||||
return array();
|
||||
}
|
||||
$item = $result[0];
|
||||
$results = $Model->find('all', array(
|
||||
|
|
|
@ -731,7 +731,7 @@ class Router {
|
|||
*
|
||||
* @param string $name Parameter name
|
||||
* @param bool $current Current parameter, useful when using requestAction
|
||||
* @return string Parameter value
|
||||
* @return string|null Parameter value
|
||||
*/
|
||||
public static function getParam($name = 'controller', $current = false) {
|
||||
$params = Router::getParams($current);
|
||||
|
|
|
@ -2731,9 +2731,9 @@ class PaginatorHelperTest extends CakeTestCase {
|
|||
'paramType' => 'named',
|
||||
)
|
||||
);
|
||||
$this->assertFalse($this->Paginator->numbers());
|
||||
$this->assertFalse($this->Paginator->first());
|
||||
$this->assertFalse($this->Paginator->last());
|
||||
$this->assertSame('', $this->Paginator->numbers());
|
||||
$this->assertSame('', $this->Paginator->first());
|
||||
$this->assertSame('', $this->Paginator->last());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -604,7 +604,7 @@ class Folder {
|
|||
$path = $this->pwd();
|
||||
}
|
||||
if (!$path) {
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
$path = Folder::slashTerm($path);
|
||||
if (is_dir($path)) {
|
||||
|
|
|
@ -696,7 +696,7 @@ class FormHelper extends AppHelper {
|
|||
* @param string|array $text Error message as string or array of messages.
|
||||
* If array contains `attributes` key it will be used as options for error container
|
||||
* @param array $options Rendering options for <div /> wrapper tag
|
||||
* @return string If there are errors this method returns an error message, otherwise null.
|
||||
* @return string|null If there are errors this method returns an error message, otherwise null.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#FormHelper::error
|
||||
*/
|
||||
public function error($field, $text = null, $options = array()) {
|
||||
|
|
|
@ -481,7 +481,7 @@ class PaginatorHelper extends AppHelper {
|
|||
* @param array $options Options list.
|
||||
* @param string $disabledTitle Disabled link title.
|
||||
* @param array $disabledOptions Disabled link options.
|
||||
* @return string|null
|
||||
* @return string
|
||||
*/
|
||||
protected function _pagingLink($which, $title = null, $options = array(), $disabledTitle = null, $disabledOptions = array()) {
|
||||
$check = 'has' . $which;
|
||||
|
@ -501,7 +501,7 @@ class PaginatorHelper extends AppHelper {
|
|||
}
|
||||
$options = (array)$disabledOptions + $_defaults;
|
||||
} elseif (!$this->{$check}($options['model'])) {
|
||||
return null;
|
||||
return '';
|
||||
}
|
||||
|
||||
foreach (array_keys($_defaults) as $key) {
|
||||
|
@ -707,7 +707,7 @@ class PaginatorHelper extends AppHelper {
|
|||
* - `currentTag` Tag to use for current page number, defaults to null
|
||||
*
|
||||
* @param array $options Options for the numbers, (before, after, model, modulus, separator)
|
||||
* @return string|bool numbers string.
|
||||
* @return string Numbers string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::numbers
|
||||
*/
|
||||
public function numbers($options = array()) {
|
||||
|
@ -728,7 +728,7 @@ class PaginatorHelper extends AppHelper {
|
|||
unset($options['model']);
|
||||
|
||||
if ($params['pageCount'] <= 1) {
|
||||
return false;
|
||||
return '';
|
||||
}
|
||||
|
||||
extract($options);
|
||||
|
@ -849,7 +849,7 @@ class PaginatorHelper extends AppHelper {
|
|||
* @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|bool numbers string.
|
||||
* @return string Numbers string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::first
|
||||
*/
|
||||
public function first($first = '<< first', $options = array()) {
|
||||
|
@ -866,7 +866,7 @@ class PaginatorHelper extends AppHelper {
|
|||
unset($options['model']);
|
||||
|
||||
if ($params['pageCount'] <= 1) {
|
||||
return false;
|
||||
return '';
|
||||
}
|
||||
extract($options);
|
||||
unset($options['tag'], $options['after'], $options['model'], $options['separator'], $options['ellipsis'], $options['class']);
|
||||
|
@ -912,7 +912,7 @@ class PaginatorHelper extends AppHelper {
|
|||
*
|
||||
* @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|bool numbers string.
|
||||
* @return string Numbers string.
|
||||
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::last
|
||||
*/
|
||||
public function last($last = 'last >>', $options = array()) {
|
||||
|
@ -929,7 +929,7 @@ class PaginatorHelper extends AppHelper {
|
|||
unset($options['model']);
|
||||
|
||||
if ($params['pageCount'] <= 1) {
|
||||
return false;
|
||||
return '';
|
||||
}
|
||||
|
||||
extract($options);
|
||||
|
@ -976,7 +976,7 @@ class PaginatorHelper extends AppHelper {
|
|||
* - `block` The block name to append the output to, or false/absenst to return as a string
|
||||
*
|
||||
* @param array $options Array of options
|
||||
* @return string|null Meta links
|
||||
* @return string|void Meta links
|
||||
*/
|
||||
public function meta($options = array()) {
|
||||
$model = isset($options['model']) ? $options['model'] : null;
|
||||
|
|
Loading…
Reference in a new issue