Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
ypnos committed Mar 14, 2016
2 parents 067f2b4 + 65271f3 commit db79e7d
Show file tree
Hide file tree
Showing 231 changed files with 1,313 additions and 727 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Expand Up @@ -16,4 +16,4 @@
// @license http://www.opensource.org/licenses/mit-license.php MIT License
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
3.2.3
3.2.5
2 changes: 1 addition & 1 deletion src/Cache/Cache.php
Expand Up @@ -117,7 +117,7 @@ class Cache
* Returns the Cache Registry instance used for creating and using cache adapters.
* Also allows for injecting of a new registry instance.
*
* @param \Cake\Core\ObjectRegistry $registry Injectable registry object.
* @param \Cake\Core\ObjectRegistry|null $registry Injectable registry object.
* @return \Cake\Core\ObjectRegistry
*/
public static function registry(ObjectRegistry $registry = null)
Expand Down
6 changes: 3 additions & 3 deletions src/Cache/Engine/RedisEngine.php
Expand Up @@ -153,11 +153,11 @@ public function read($key)
$key = $this->_key($key);

$value = $this->_Redis->get($key);
if (ctype_digit($value)) {
$value = (int)$value;
if (preg_match('/^[-]?\d+$/', $value)) {
return (int)$value;
}
if ($value !== false && is_string($value)) {
$value = unserialize($value);
return unserialize($value);
}
return $value;
}
Expand Down
13 changes: 11 additions & 2 deletions src/Cache/Engine/XcacheEngine.php
Expand Up @@ -58,7 +58,7 @@ class XcacheEngine extends CacheEngine
*/
public function init(array $config = [])
{
if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') || !extension_loaded('xcache')) {
if (!extension_loaded('xcache')) {
return false;
}

Expand All @@ -77,6 +77,10 @@ public function write($key, $value)
{
$key = $this->_key($key);

if (!is_numeric($value)) {
$value = serialize($value);
}

$duration = $this->_config['duration'];
$expires = time() + $duration;
xcache_set($key . '_expires', $expires, $duration);
Expand All @@ -100,7 +104,12 @@ public function read($key)
if ($cachetime < $time || ($time + $this->_config['duration']) < $cachetime) {
return false;
}
return xcache_get($key);

$value = xcache_get($key);
if (is_string($value) && !is_numeric($value)) {
$value = unserialize($value);
}
return $value;
}
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/CollectionInterface.php
Expand Up @@ -462,7 +462,7 @@ public function countBy($callback);
* // Total: 6
* ```
*
* @param string|callable $matcher The property name to sum or a function
* @param string|callable|null $matcher The property name to sum or a function
* If no value is passed, an identity function will be used.
* that will return the value of the property to sum.
* @return float|int
Expand Down Expand Up @@ -840,7 +840,7 @@ public function stopWhen($condition);
* });
* ```
*
* @param callable $transformer A callable function that will receive each of
* @param callable|null $transformer A callable function that will receive each of
* the items in the collection and should return an array or Traversable object
* @return \Cake\Collection\CollectionInterface
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Collection/Iterator/MapReduce.php
Expand Up @@ -108,7 +108,7 @@ class MapReduce implements IteratorAggregate
* @param callable $mapper the mapper callback. This function will receive 3 arguments.
* The first one is the current value, second the current results key and third is
* this class instance so you can call the result emitters.
* @param callable $reducer the reducer callback. This function will receive 3 arguments.
* @param callable|null $reducer the reducer callback. This function will receive 3 arguments.
* The first one is the list of values inside a bucket, second one is the name
* of the bucket that was created during the mapping phase and third one is an
* instance of this class.
Expand Down Expand Up @@ -152,7 +152,7 @@ public function emitIntermediate($value, $bucket)
* for this record.
*
* @param mixed $value The value to be appended to the final list of results
* @param string $key and optional key to assign to the value
* @param string|null $key and optional key to assign to the value
* @return void
*/
public function emit($value, $key = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Collection/Iterator/TreeIterator.php
Expand Up @@ -80,7 +80,7 @@ public function __construct(RecursiveIterator $items, $mode = RecursiveIteratorI
*
* @param string|callable $valuePath The property to extract or a callable to return
* the display value
* @param string|callable $keyPath The property to use as iteration key or a
* @param string|callable|null $keyPath The property to use as iteration key or a
* callable returning the key value.
* @param string $spacer The string to use for prefixing the values according to
* their depth in the tree
Expand Down
2 changes: 1 addition & 1 deletion src/Collection/Iterator/ZipIterator.php
Expand Up @@ -67,7 +67,7 @@ class ZipIterator extends MultipleIterator implements CollectionInterface, Seria
* iterators by their corresponding index.
*
* @param array $sets The list of array or iterators to be zipped.
* @param callable $callable The function to use for zipping the elements of each iterator.
* @param callable|null $callable The function to use for zipping the elements of each iterator.
*/
public function __construct(array $sets, $callable = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Console/ConsoleIo.php
Expand Up @@ -181,7 +181,7 @@ public function out($message = '', $newlines = 1, $level = ConsoleIo::NORMAL)
*
* @param array|string $message The message to output.
* @param int $newlines Number of newlines to append.
* @param int $size The number of bytes to overwrite. Defaults to the
* @param int|null $size The number of bytes to overwrite. Defaults to the
* length of the last message output.
* @return void
*/
Expand Down Expand Up @@ -269,7 +269,7 @@ public function outputAs($mode)
/**
* Add a new output style or get defined styles.
*
* @param string $style The style to get or create.
* @param string|null $style The style to get or create.
* @param array|bool|null $definition The array definition of the style to change or create a style
* or false to remove a style.
* @return mixed If you are getting styles, the style or null will be returned. If you are creating/modifying
Expand Down
2 changes: 1 addition & 1 deletion src/Console/ConsoleOptionParser.php
Expand Up @@ -617,7 +617,7 @@ public function parse($argv)
* Generates help text based on the description, options, arguments, subcommands and epilog
* in the parser.
*
* @param string $subcommand If present and a valid subcommand that has a linked parser.
* @param string|null $subcommand If present and a valid subcommand that has a linked parser.
* That subcommands help will be shown instead.
* @param string $format Define the output format, can be text or xml
* @param int $width The width to format user content to. Defaults to 72
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Shell.php
Expand Up @@ -158,7 +158,7 @@ class Shell
/**
* Constructs this Shell instance.
*
* @param \Cake\Console\ConsoleIo $io An io instance.
* @param \Cake\Console\ConsoleIo|null $io An io instance.
* @link http://book.cakephp.org/3.0/en/console-and-shells.html#Shell
*/
public function __construct(ConsoleIo $io = null)
Expand Down Expand Up @@ -187,7 +187,7 @@ public function __construct(ConsoleIo $io = null)
/**
* Get/Set the io object for this shell.
*
* @param \Cake\Console\ConsoleIo $io The ConsoleIo object to use.
* @param \Cake\Console\ConsoleIo|null $io The ConsoleIo object to use.
* @return \Cake\Console\ConsoleIo The current ConsoleIo object.
*/
public function io(ConsoleIo $io = null)
Expand Down
10 changes: 5 additions & 5 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -567,7 +567,7 @@ public function getAuthorize($alias)
* $this->Auth->allow();
* ```
*
* @param string|array $actions Controller action name or array of actions
* @param string|array|null $actions Controller action name or array of actions
* @return void
* @link http://book.cakephp.org/3.0/en/controllers/components/authentication.html#making-actions-public
*/
Expand Down Expand Up @@ -596,7 +596,7 @@ public function allow($actions = null)
* ```
* to remove all items from the allowed list
*
* @param string|array $actions Controller action name or array of actions
* @param string|array|null $actions Controller action name or array of actions
* @return void
* @see \Cake\Controller\Component\AuthComponent::allow()
* @link http://book.cakephp.org/3.0/en/controllers/components/authentication.html#making-actions-require-authorization
Expand Down Expand Up @@ -656,8 +656,8 @@ public function logout()
/**
* Get the current user from storage.
*
* @param string $key Field to retrieve. Leave null to get entire User record.
* @return array|null Either User record or null if no user is logged in.
* @param string|null $key Field to retrieve. Leave null to get entire User record.
* @return mixed|null Either User record or null if no user is logged in, or retrieved field if key is specified.
* @link http://book.cakephp.org/3.0/en/controllers/components/authentication.html#accessing-the-logged-in-user
*/
public function user($key = null)
Expand Down Expand Up @@ -724,7 +724,7 @@ protected function _getUser()
* `loginRedirect`, the `loginRedirect` value is returned.
* - If there is no session and no `loginRedirect`, / is returned.
*
* @param string|array $url Optional URL to write as the login redirect URL.
* @param string|array|null $url Optional URL to write as the login redirect URL.
* @return string Redirect URL
*/
public function redirectUrl($url = null)
Expand Down
6 changes: 3 additions & 3 deletions src/Controller/Component/RequestHandlerComponent.php
Expand Up @@ -392,7 +392,7 @@ public function isWap()
*
* Returns true if the client accepts xml.
*
* @param string|array $type Can be null (or no parameter), a string type name, or an
* @param string|array|null $type Can be null (or no parameter), a string type name, or an
* array of types
* @return mixed If null or no parameter is passed, returns an array of content
* types the client accepts. If a string is passed, returns true
Expand Down Expand Up @@ -426,7 +426,7 @@ public function accepts($type = null)
/**
* Determines the content type of the data the client has sent (i.e. in a POST request)
*
* @param string|array $type Can be null (or no parameter), a string type name, or an array of types
* @param string|array|null $type Can be null (or no parameter), a string type name, or an array of types
* @return mixed If a single type is supplied a boolean will be returned. If no type is provided
* The mapped value of CONTENT_TYPE will be returned. If an array is supplied the first type
* in the request content type will be returned.
Expand Down Expand Up @@ -471,7 +471,7 @@ public function requestedWith($type = null)
* if provided, and secondarily by the list of content-types provided in
* HTTP_ACCEPT.
*
* @param string|array $type An optional array of 'friendly' content-type names, i.e.
* @param string|array|null $type An optional array of 'friendly' content-type names, i.e.
* 'html', 'xml', 'js', etc.
* @return mixed If $type is null or not provided, the first content-type in the
* list, based on preference, is returned. If a single type is provided
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Component/SecurityComponent.php
Expand Up @@ -144,7 +144,7 @@ public function implementedEvents()
/**
* Sets the actions that require a request that is SSL-secured, or empty for all actions
*
* @param string|array $actions Actions list
* @param string|array|null $actions Actions list
* @return void
*/
public function requireSecure($actions = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/ComponentRegistry.php
Expand Up @@ -40,7 +40,7 @@ class ComponentRegistry extends ObjectRegistry implements EventDispatcherInterfa
/**
* Constructor.
*
* @param \Cake\Controller\Controller $controller Controller instance.
* @param \Cake\Controller\Controller|null $controller Controller instance.
*/
public function __construct(Controller $controller = null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Controller/Controller.php
Expand Up @@ -574,8 +574,8 @@ public function setAction($action)
/**
* Instantiates the correct view class, hands it its data, and uses it to render the view output.
*
* @param string $view View to use for rendering
* @param string $layout Layout to use
* @param string|null $view View to use for rendering
* @param string|null $layout Layout to use
* @return \Cake\Network\Response A response object containing the rendered view.
* @link http://book.cakephp.org/3.0/en/controllers.html#rendering-a-view
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Core/App.php
Expand Up @@ -170,7 +170,7 @@ protected static function _classExistsInBase($name, $namespace)
* Will return the path for datasources under the 'MyPlugin' plugin.
*
* @param string $type type of path
* @param string $plugin name of plugin
* @param string|null $plugin name of plugin
* @return array
* @link http://book.cakephp.org/3.0/en/core-libraries/app.html#finding-paths-to-namespaces
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Core/Configure.php
Expand Up @@ -112,7 +112,7 @@ public static function write($config, $value = null)
* Configure::read('Name.key'); will return only the value of Configure::Name[key]
* ```
*
* @param string $var Variable to obtain. Use '.' to access array elements.
* @param string|null $var Variable to obtain. Use '.' to access array elements.
* @return mixed Value stored in configure, or null.
* @link http://book.cakephp.org/3.0/en/development/configuration.html#reading-configuration-data
*/
Expand Down Expand Up @@ -385,7 +385,7 @@ public static function version()
*
* @param string $name The storage name for the saved configuration.
* @param string $cacheConfig The cache configuration to save into. Defaults to 'default'
* @param array $data Either an array of data to store, or leave empty to store all values.
* @param array|null $data Either an array of data to store, or leave empty to store all values.
* @return bool Success
*/
public static function store($name, $cacheConfig = 'default', $data = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Configure/Engine/JsonConfig.php
Expand Up @@ -93,6 +93,6 @@ public function read($key)
public function dump($key, array $data)
{
$filename = $this->_getFilePath($key);
return file_put_contents($filename, json_encode($data)) > 0;
return file_put_contents($filename, json_encode($data, JSON_PRETTY_PRINT)) > 0;
}
}
4 changes: 2 additions & 2 deletions src/Core/Exception/Exception.php
Expand Up @@ -52,7 +52,7 @@ class Exception extends RuntimeException
* @param string|array $message Either the string of the error message, or an array of attributes
* that are made available in the view, and sprintf()'d into Exception::$_messageTemplate
* @param int $code The code of the error, is also the HTTP status code for the error.
* @param \Exception $previous the previous exception.
* @param \Exception|null $previous the previous exception.
*/
public function __construct($message, $code = 500, $previous = null)
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getAttributes()
* @param string|array|null $header An array of header strings or a single header string
* - an associative array of "header name" => "header value"
* - an array of string headers is also accepted
* @param string $value The header value.
* @param string|null $value The header value.
* @return array
*/
public function responseHeader($header = null, $value = null)
Expand Down
6 changes: 3 additions & 3 deletions src/Core/Plugin.php
Expand Up @@ -320,7 +320,7 @@ public static function bootstrap($plugin)
/**
* Loads the routes file for a plugin, or all plugins configured to load their respective routes file
*
* @param string $plugin name of the plugin, if null will operate on all plugins having enabled the
* @param string|null $plugin name of the plugin, if null will operate on all plugins having enabled the
* loading of routes files
* @return bool
*/
Expand All @@ -346,7 +346,7 @@ public static function routes($plugin = null)
* Returns true if the plugin $plugin is already loaded
* If plugin is null, it will return a list of all loaded plugins
*
* @param string $plugin Plugin name.
* @param string|null $plugin Plugin name.
* @return bool|array Boolean true if $plugin is already loaded.
* If $plugin is null, returns a list of plugins that have been loaded
*/
Expand All @@ -363,7 +363,7 @@ public static function loaded($plugin = null)
/**
* Forgets a loaded plugin or all of them if first parameter is null
*
* @param string $plugin name of the plugin to forget
* @param string|null $plugin name of the plugin to forget
* @return void
*/
public static function unload($plugin = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Core/StaticConfigTrait.php
Expand Up @@ -73,7 +73,7 @@ trait StaticConfigTrait
* ```
*
* @param string|array $key The name of the configuration, or an array of multiple configs.
* @param array $config An array of name => configuration data for adapter.
* @param array|null $config An array of name => configuration data for adapter.
* @return array|null Null when adding configuration or an array of configuration data when reading.
* @throws \BadMethodCallException When trying to modify an existing config.
*/
Expand Down
6 changes: 3 additions & 3 deletions src/Core/functions.php
Expand Up @@ -30,7 +30,7 @@
* Arrays will be mapped and have all their elements escaped. Objects will be string cast if they
* implement a `__toString` method. Otherwise the class name will be used.
* @param bool $double Encode existing html entities.
* @param string $charset Character set to use when escaping. Defaults to config value in `mb_internal_encoding()`
* @param string|null $charset Character set to use when escaping. Defaults to config value in `mb_internal_encoding()`
* or 'UTF-8'.
* @return string Wrapped text.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#h
Expand Down Expand Up @@ -82,7 +82,7 @@ function h($text, $double = true, $charset = null)
*
* @param string $name The name you want to plugin split.
* @param bool $dotAppend Set to true if you want the plugin to have a '.' appended to it.
* @param string $plugin Optional default plugin to use if no plugin is found. Defaults to null.
* @param string|null $plugin Optional default plugin to use if no plugin is found. Defaults to null.
* @return array Array with 2 indexes. 0 => plugin name, 1 => class name.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#pluginSplit
*/
Expand Down Expand Up @@ -176,7 +176,7 @@ function pj($var)
* environment information.
*
* @param string $key Environment variable name.
* @param string $default Specify a default value in case the environment variable is not defined.
* @param string|null $default Specify a default value in case the environment variable is not defined.
* @return string|null Environment variable setting.
* @link http://book.cakephp.org/3.0/en/core-libraries/global-constants-and-functions.html#env
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Connection.php
Expand Up @@ -609,7 +609,7 @@ public function inTransaction()
* Quotes value to be used safely in database query.
*
* @param mixed $value The value to quote.
* @param string $type Type to be used for determining kind of quoting to perform
* @param string|null $type Type to be used for determining kind of quoting to perform
* @return string Quoted value
*/
public function quote($value, $type = null)
Expand Down

0 comments on commit db79e7d

Please sign in to comment.