Browse Source

use short array syntax for docs

antograssiot 11 years ago
parent
commit
6d777f5fbf

+ 5 - 5
src/Auth/BasicAuthenticate.php

@@ -29,11 +29,11 @@ use Cake\Network\Response;
  *
  * In your controller's components array, add auth + the required config
  * {{{
- *  public $components = array(
- *      'Auth' => array(
- *          'authenticate' => array('Basic')
- *      )
- *  );
+ *  public $components = [
+ *      'Auth' => [
+ *          'authenticate' => ['Basic']
+ *      ]
+ *  ];
  * }}}
  *
  * You should also set `AuthComponent::$sessionKey = false;` in your AppController's

+ 4 - 4
src/Cache/README.md

@@ -20,19 +20,19 @@ Caching engines need to be configured with the `Cache::config()` method.
 use Cake\Cache\Cache;
 
 // Using a short name
-Cache::config('default', array(
+Cache::config('default', [
     'className' => 'File',
     'duration' => '+1 hours',
     'path' => sys_get_tmp_dir(),
     'prefix' => 'my_app_'
-));
+]);
 
 // Using a fully namespaced name.
-Cache::config('long', array(
+Cache::config('long', [
     'className' => 'Cake\Cache\Engine\ApcEngine',
     'duration' => '+1 week',
     'prefix' => 'my_app_'
-));
+]);
 
 // Using a constructed object.
 $object = new FileEngine($config);

+ 4 - 4
src/Controller/Component/PaginatorComponent.php

@@ -120,11 +120,11 @@ class PaginatorComponent extends Component
      * You can paginate with any find type defined on your table using the `finder` option.
      *
      * {{{
-     *  $settings = array(
-     *    'Articles' => array(
+     *  $settings = [
+     *    'Articles' => [
      *      'finder' => 'popular'
-     *    )
-     *  );
+     *    ]
+     *  ];
      *  $results = $paginator->paginate($table, $settings);
      * }}}
      *

+ 3 - 3
src/Controller/Component/RequestHandlerComponent.php

@@ -381,7 +381,7 @@ class RequestHandlerComponent extends Component
      *
      * Usage:
      *
-     * `$this->RequestHandler->accepts(array('xml', 'html', 'json'));`
+     * `$this->RequestHandler->accepts(['xml', 'html', 'json']);`
      *
      * Returns true if the client accepts any of the supplied types.
      *
@@ -522,7 +522,7 @@ class RequestHandlerComponent extends Component
      *
      * Render the response as an xml file and force the result as a file download.
      *
-     * `$this->RequestHandler->renderAs($this, 'xml', array('attachment' => 'myfile.xml');`
+     * `$this->RequestHandler->renderAs($this, 'xml', ['attachment' => 'myfile.xml'];`
      *
      * @param Controller $controller A reference to a controller object
      * @param string $type Type of response to send (e.g: 'ajax')
@@ -686,7 +686,7 @@ class RequestHandlerComponent extends Component
     /**
      * Getter/setter for viewClassMap
      *
-     * @param array|string|null $type The type string or array with format `array('type' => 'viewClass')` to map one or more
+     * @param array|string|null $type The type string or array with format `['type' => 'viewClass']` to map one or more
      * @param array|null $viewClass The viewClass to be used for the type without `View` appended
      * @return array|string Returns viewClass when only string $type is set, else array with viewClassMap
      */

+ 1 - 1
src/Controller/Controller.php

@@ -167,7 +167,7 @@ class Controller implements EventListenerInterface
      * Array containing the names of components this controller uses. Component names
      * should not contain the "Component" portion of the class name.
      *
-     * Example: `public $components = array('Session', 'RequestHandler', 'Acl');`
+     * Example: `public $components = ['Session', 'RequestHandler', 'Acl'];`
      *
      * @var array
      * @link http://book.cakephp.org/3.0/en/controllers/components.html

+ 1 - 1
src/Database/Statement/PDOStatement.php

@@ -82,7 +82,7 @@ class PDOStatement extends StatementDecorator
      * {{{
      *  $statement = $connection->prepare('SELECT id, title from articles');
      *  $statement->execute();
-     *  print_r($statement->fetch('assoc')); // will show array('id' => 1, 'title' => 'a title')
+     *  print_r($statement->fetch('assoc')); // will show ['id' => 1, 'title' => 'a title']
      * }}}
      *
      * @param string $type 'num' for positional columns, assoc for named columns

+ 1 - 1
src/Database/Statement/StatementDecorator.php

@@ -171,7 +171,7 @@ class StatementDecorator implements StatementInterface, \Countable, \IteratorAgg
      * {{{
      * $statement = $connection->prepare('SELECT id, title from articles');
      * $statement->execute();
-     * print_r($statement->fetch('assoc')); // will show array('id' => 1, 'title' => 'a title')
+     * print_r($statement->fetch('assoc')); // will show ['id' => 1, 'title' => 'a title']
      * }}}
      *
      * @param string $type 'num' for positional columns, assoc for named columns

+ 1 - 1
src/Database/StatementInterface.php

@@ -101,7 +101,7 @@ interface StatementInterface
      * {{{
      *  $statement = $connection->prepare('SELECT id, title from articles');
      *  $statement->execute();
-     *  print_r($statement->fetch('assoc')); // will show array('id' => 1, 'title' => 'a title')
+     *  print_r($statement->fetch('assoc')); // will show ['id' => 1, 'title' => 'a title']
      * }}}
      *
      * @param string $type 'num' for positional columns, assoc for named columns

+ 1 - 1
src/Error/Debugger.php

@@ -599,7 +599,7 @@ class Debugger
      * Alternatively if you want to use a custom callback to do all the formatting, you can use
      * the callback key, and provide a callable:
      *
-     * `Debugger::addFormat('custom', array('callback' => array($foo, 'outputError'));`
+     * `Debugger::addFormat('custom', ['callback' => [$foo, 'outputError']];`
      *
      * The callback can expect two parameters. The first is an array of all
      * the error data. The second contains the formatted strings generated using

+ 1 - 1
src/Event/Event.php

@@ -64,7 +64,7 @@ class Event
      * ### Examples of usage:
      *
      * {{{
-     *  $event = new Event('Order.afterBuy', $this, array('buyer' => $userData));
+     *  $event = new Event('Order.afterBuy', $this, ['buyer' => $userData]);
      *  $event = new Event('User.afterRegister', $UserModel);
      * }}}
      *

+ 3 - 3
src/Event/EventListenerInterface.php

@@ -30,11 +30,11 @@ interface EventListenerInterface
      *
      * {{{
      *  public function implementedEvents() {
-     *      return array(
+     *      return [
      *          'Order.complete' => 'sendEmail',
      *          'Article.afterBuy' => 'decrementInventory',
-     *          'User.onRegister' => array('callable' => 'logRegistration', 'priority' => 20, 'passParams' => true)
-     *      );
+     *          'User.onRegister' => ['callable' => 'logRegistration', 'priority' => 20, 'passParams' => true]
+     *      ];
      *  }
      * }}}
      *

+ 7 - 5
src/Network/Email/Email.php

@@ -1079,27 +1079,29 @@ class Email
      * Attach a file with a different filename:
      *
      * {{{
-     * $email->attachments(array('custom_name.txt' => 'path/to/file.txt'));
+     * $email->attachments(['custom_name.txt' => 'path/to/file.txt']);
      * }}}
      *
      * Attach a file and specify additional properties:
      *
      * {{{
-     * $email->attachments(array('custom_name.png' => array(
+     * $email->attachments(['custom_name.png' => [
      *      'file' => 'path/to/file',
      *      'mimetype' => 'image/png',
      *      'contentId' => 'abc123',
      *      'contentDisposition' => false
-     * ));
+     *    ]
+     * ]);
      * }}}
      *
      * Attach a file from string and specify additional properties:
      *
      * {{{
-     * $email->attachments(array('custom_name.png' => array(
+     * $email->attachments(['custom_name.png' => [
      *      'data' => file_get_contents('path/to/file'),
      *      'mimetype' => 'image/png'
-     * ));
+     *    ]
+     * ]);
      * }}}
      *
      * The `contentId` key allows you to specify an inline attachment. In your email text, you

+ 8 - 8
src/Network/Email/SmtpTransport.php

@@ -129,21 +129,21 @@ class SmtpTransport extends AbstractTransport
      * A response consists of one or more lines containing a response
      * code and an optional response message text:
      * {{{
-     * array(
-     *     array(
+     * [
+     *     [
      *         'code' => '250',
      *         'message' => 'mail.example.com'
-     *     ),
-     *     array(
+     *     ],
+     *     [
      *         'code' => '250',
      *         'message' => 'PIPELINING'
-     *     ),
-     *     array(
+     *     ],
+     *     [
      *         'code' => '250',
      *         'message' => '8BITMIME'
-     *     ),
+     *     ],
      *     // etc...
-     * )
+     * ]
      * }}}
      *
      * @return array

+ 7 - 7
src/Network/Request.php

@@ -778,39 +778,39 @@ class Request implements \ArrayAccess
      * The callback will receive the request object as its only parameter.
      *
      * e.g `addDetector('custom', function ($request) { //Return a boolean });`
-     * e.g `addDetector('custom', array('SomeClass', 'somemethod'));`
+     * e.g `addDetector('custom', ['SomeClass', 'somemethod']);`
      *
      * ### Environment value comparison
      *
      * An environment value comparison, compares a value fetched from `env()` to a known value
      * the environment value is equality checked against the provided value.
      *
-     * e.g `addDetector('post', array('env' => 'REQUEST_METHOD', 'value' => 'POST'))`
+     * e.g `addDetector('post', ['env' => 'REQUEST_METHOD', 'value' => 'POST'])`
      *
      * ### Pattern value comparison
      *
      * Pattern value comparison allows you to compare a value fetched from `env()` to a regular expression.
      *
-     * e.g `addDetector('iphone', array('env' => 'HTTP_USER_AGENT', 'pattern' => '/iPhone/i'));`
+     * e.g `addDetector('iphone', ['env' => 'HTTP_USER_AGENT', 'pattern' => '/iPhone/i']);`
      *
      * ### Option based comparison
      *
      * Option based comparisons use a list of options to create a regular expression. Subsequent calls
      * to add an already defined options detector will merge the options.
      *
-     * e.g `addDetector('mobile', array('env' => 'HTTP_USER_AGENT', 'options' => array('Fennec')));`
+     * e.g `addDetector('mobile', ['env' => 'HTTP_USER_AGENT', 'options' => ['Fennec']]);`
      *
      * ### Request parameter detectors
      *
      * Allows for custom detectors on the request parameters.
      *
-     * e.g `addDetector('requested', array('param' => 'requested', 'value' => 1)`
+     * e.g `addDetector('requested', ['param' => 'requested', 'value' => 1]`
      *
      * You can also make parameter detectors that accept multiple values
      * using the `options` key. This is useful when you want to check
      * if a request parameter is in a list of options.
      *
-     * `addDetector('extension', array('param' => 'ext', 'options' => array('pdf', 'csv'))`
+     * `addDetector('extension', ['param' => 'ext', 'options' => ['pdf', 'csv']]`
      *
      * @param string $name The name of the detector.
      * @param callable|array $callable A callable or options array for the detector definition.
@@ -1169,7 +1169,7 @@ class Request implements \ArrayAccess
      *
      * Getting input using a decoding function, and additional params:
      *
-     * `$this->request->input('Xml::build', array('return' => 'DOMDocument'));`
+     * `$this->request->input('Xml::build', ['return' => 'DOMDocument']);`
      *
      * Any additional parameters are applied to the callback in the order they are given.
      *

+ 10 - 10
src/Network/Response.php

@@ -578,13 +578,13 @@ class Response
      * e.g `header('Location', 'http://example.com');`
      *
      * ### Multiple headers
-     * e.g `header(array('Location' => 'http://example.com', 'X-Extra' => 'My header'));`
+     * e.g `header(['Location' => 'http://example.com', 'X-Extra' => 'My header']);`
      *
      * ### String header
      * e.g `header('WWW-Authenticate: Negotiate');`
      *
      * ### Array of string headers
-     * e.g `header(array('WWW-Authenticate: Negotiate', 'Content-type: application/pdf'));`
+     * e.g `header(['WWW-Authenticate: Negotiate', 'Content-type: application/pdf']);`
      *
      * Multiple calls for setting the same header name will have the same effect as setting the header once
      * with the last value sent for it
@@ -679,19 +679,19 @@ class Response
      *        between 1 and 5, which defines the class of response the client is to expect.
      *        Example:
      *
-     *        httpCodes(404); // returns array(404 => 'Not Found')
+     *        httpCodes(404); // returns [404 => 'Not Found']
      *
-     *        httpCodes(array(
+     *        httpCodes([
      *            381 => 'Unicorn Moved',
      *            555 => 'Unexpected Minotaur'
-     *        )); // sets these new values, and returns true
+     *        ]); // sets these new values, and returns true
      *
-     *        httpCodes(array(
+     *        httpCodes([
      *            0 => 'Nothing Here',
      *            -1 => 'Reverse Infinity',
      *            12345 => 'Universal Password',
      *            'Hello' => 'World'
-     *        )); // throws an exception due to invalid codes
+     *        ]); // throws an exception due to invalid codes
      *
      *        For more on HTTP status codes see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1
      *
@@ -735,11 +735,11 @@ class Response
      *
      * ### Storing content type definitions
      *
-     * e.g `type(array('keynote' => 'application/keynote', 'bat' => 'application/bat'));`
+     * e.g `type(['keynote' => 'application/keynote', 'bat' => 'application/bat']);`
      *
      * ### Replacing a content type definition
      *
-     * e.g `type(array('jpg' => 'text/plain'));`
+     * e.g `type(['jpg' => 'text/plain']);`
      *
      * @param string|null $contentType Content type key.
      * @return mixed Current content type or false if supplied an invalid content type
@@ -1321,7 +1321,7 @@ class Response
      * e.g `cors($request, '*');`
      *
      * ### Whitelist of URIs
-     * e.g `cors($request, array('http://www.cakephp.org', '*.google.com', 'https://myproject.github.io'));`
+     * e.g `cors($request, ['http://www.cakephp.org', '*.google.com', 'https://myproject.github.io']);`
      *
      * @param \Cake\Network\Request $request Request object
      * @param string|array $allowedDomains List of allowed domains, see method description for more details

+ 4 - 4
src/Routing/RouteBuilder.php

@@ -321,7 +321,7 @@ class RouteBuilder
      *
      * - `pass` is used to define which of the routed parameters should be shifted
      *   into the pass array. Adding a parameter to pass will remove it from the
-     *   regular route array. Ex. `'pass' => array('slug')`.
+     *   regular route array. Ex. `'pass' => ['slug']`.
      * - `routeClass` is used to extend and change how individual routes parse requests
      *   and handle reverse routing, via a custom routing class.
      *   Ex. `'routeClass' => 'SlugRoute'`
@@ -334,7 +334,7 @@ class RouteBuilder
      *
      * Example of using the `_method` condition:
      *
-     * `$routes->connect('/tasks', array('controller' => 'Tasks', 'action' => 'index', '_method' => 'GET'));`
+     * `$routes->connect('/tasks', ['controller' => 'Tasks', 'action' => 'index', '_method' => 'GET']);`
      *
      * The above route will only be matched for GET requests. POST requests will fail to match this route.
      *
@@ -427,12 +427,12 @@ class RouteBuilder
      *
      * Examples:
      *
-     * `$routes->redirect('/home/*', array('controller' => 'posts', 'action' => 'view'));`
+     * `$routes->redirect('/home/*', ['controller' => 'posts', 'action' => 'view']);`
      *
      * Redirects /home/* to /posts/view and passes the parameters to /posts/view. Using an array as the
      * redirect destination allows you to use other routes to define where an URL string should be redirected to.
      *
-     * `$routes-redirect('/posts/*', 'http://google.com', array('status' => 302));`
+     * `$routes-redirect('/posts/*', 'http://google.com', ['status' => 302]);`
      *
      * Redirects /posts/* to http://google.com with a HTTP status of 302
      *

+ 8 - 8
src/TestSuite/TestCase.php

@@ -288,30 +288,30 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
      * attribute that contains 'my-input':
      *
      * {{{
-     * array('input' => array('name', 'id' => 'my-input'))
+     * ['input' => ['name', 'id' => 'my-input']]
      * }}}
      *
      * Checks for two p elements with some text in them:
      *
      * {{{
-     * array(
-     *   array('p' => true),
+     * [
+     *   ['p' => true],
      *   'textA',
      *   '/p',
-     *   array('p' => true),
+     *   ['p' => true],
      *   'textB',
      *   '/p'
-     * )
+     * ]
      * }}}
      *
      * You can also specify a pattern expression as part of the attribute values, or the tag
      * being defined, if you prepend the value with preg: and enclose it with slashes, like so:
      *
      * {{{
-     * array(
-     *   array('input' => array('name', 'id' => 'preg:/FieldName\d+/')),
+     * [
+     *   ['input' => ['name', 'id' => 'preg:/FieldName\d+/']],
      *   'preg:/My\s+field/'
-     * )
+     * ]
      * }}}
      *
      * Important: This function is very forgiving about whitespace and also accepts any

+ 5 - 5
src/Utility/Hash.php

@@ -478,7 +478,7 @@ class Hash
      * Usage:
      *
      * {{{
-     * $result = Hash::format($users, array('{n}.User.id', '{n}.User.name'), '%s : %s');
+     * $result = Hash::format($users, ['{n}.User.id', '{n}.User.name'], '%s : %s');
      * }}}
      *
      * The `$format` string can use any format options that `vsprintf()` and `sprintf()` do.
@@ -615,8 +615,8 @@ class Hash
 
     /**
      * Collapses a multi-dimensional array into a single dimension, using a delimited array path for
-     * each array element's key, i.e. array(array('Foo' => array('Bar' => 'Far'))) becomes
-     * array('0.Foo.Bar' => 'Far').)
+     * each array element's key, i.e. [['Foo' => ['Bar' => 'Far']]] becomes
+     * ['0.Foo.Bar' => 'Far'].)
      *
      * @param array $data Array to flatten
      * @param string $separator String used to separate array key elements in a path, defaults to '.'
@@ -658,8 +658,8 @@ class Hash
      * Expands a flat array to a nested array.
      *
      * For example, unflattens an array that was collapsed with `Hash::flatten()`
-     * into a multi-dimensional array. So, `array('0.Foo.Bar' => 'Far')` becomes
-     * `array(array('Foo' => array('Bar' => 'Far')))`.
+     * into a multi-dimensional array. So, `['0.Foo.Bar' => 'Far']` becomes
+     * `[['Foo' => ['Bar' => 'Far']]]`.
      *
      * @param array $data Flattened array
      * @param string $separator The delimiter used

+ 5 - 5
src/Utility/README.md

@@ -42,7 +42,7 @@ The String class includes convenience methods for creating and manipulating stri
 ```php
 String::insert(
     'My name is :name and I am :age years old.',
-    array('name' => 'Bob', 'age' => '65')
+    ['name' => 'Bob', 'age' => '65']
 );
 // Returns: "My name is Bob and I am 65 years old."
 
@@ -75,13 +75,13 @@ The Xml class allows you to easily transform arrays into SimpleXMLElement or DOM
 and back into arrays again
 
 ```php
-$data = array(
-    'post' => array(
+$data = [
+    'post' => [
         'id' => 1,
         'title' => 'Best post',
         'body' => ' ... '
-    )
-);
+    ]
+];
 $xml = Xml::build($data);
 ```
 

+ 1 - 1
src/Utility/String.php

@@ -132,7 +132,7 @@ class String
     /**
      * Replaces variable placeholders inside a $str with any given $data. Each key in the $data array
      * corresponds to a variable placeholder name in $str.
-     * Example: `String::insert(':name is :age years old.', array('name' => 'Bob', '65'));`
+     * Example: `String::insert(':name is :age years old.', ['name' => 'Bob', '65']);`
      * Returns: Bob is 65 years old.
      *
      * Available $options are:

+ 17 - 17
src/Utility/Xml.php

@@ -37,7 +37,7 @@ class Xml
      *
      * Building XML from string (output DOMDocument):
      *
-     * `$xml = Xml::build('<example>text</example>', array('return' => 'domdocument'));`
+     * `$xml = Xml::build('<example>text</example>', ['return' => 'domdocument']);`
      *
      * Building XML from a file path:
      *
@@ -50,20 +50,20 @@ class Xml
      * Building from an array:
      *
      * {{{
-     *  $value = array(
-     *      'tags' => array(
-     *          'tag' => array(
-     *              array(
+     *  $value = [
+     *      'tags' => [
+     *          'tag' => [
+     *              [
      *                  'id' => '1',
      *                  'name' => 'defect'
-     *              ),
-     *              array(
+     *              ],
+     *              [
      *                  'id' => '2',
      *                  'name' => 'enhancement'
-     *              )
-     *          )
-     *      )
-     *  );
+     *              ]
+     *          ]
+     *      ]
+     *  ];
      * $xml = Xml::build($value);
      * }}}
      *
@@ -157,15 +157,15 @@ class Xml
      * Using the following data:
      *
      * {{{
-     * $value = array(
-     *    'root' => array(
-     *        'tag' => array(
+     * $value = [
+     *    'root' => [
+     *        'tag' => [
      *            'id' => 1,
      *            'value' => 'defect',
      *            '@' => 'description'
-     *         )
-     *     )
-     * );
+     *         ]
+     *     ]
+     * ];
      * }}}
      *
      * Calling `Xml::fromArray($value, 'tags');`  Will generate:

+ 7 - 7
src/Validation/Validation.php

@@ -50,7 +50,7 @@ class Validation
      * Returns true if string contains something other than whitespace
      *
      * $check can be passed as an array:
-     * array('check' => 'valueToCheck');
+     * ['check' => 'valueToCheck'];
      *
      * @param string|array $check Value to check
      * @return bool Success
@@ -73,7 +73,7 @@ class Validation
      * Returns true if string contains only integer or letters
      *
      * $check can be passed as an array:
-     * array('check' => 'valueToCheck');
+     * ['check' => 'valueToCheck'];
      *
      * @param string|array $check Value to check
      * @return bool Success
@@ -111,7 +111,7 @@ class Validation
      * Whitespace characters include Space, Tab, Carriage Return, Newline
      *
      * $check can be passed as an array:
-     * array('check' => 'valueToCheck');
+     * ['check' => 'valueToCheck'];
      *
      * @param string|array $check Value to check
      * @return bool Success
@@ -131,7 +131,7 @@ class Validation
      * @param string|array $check credit card number to validate
      * @param string|array $type 'all' may be passed as a string, defaults to fast which checks format of most major credit cards
      *    if an array is used only the values of the array are checked.
-     *    Example: array('amex', 'bankcard', 'maestro')
+     *    Example: ['amex', 'bankcard', 'maestro']
      * @param bool $deep set to true this will check the Luhn algorithm of the credit card.
      * @param string|null $regex A custom regex can also be passed, this will be used instead of the defined regex values
      * @return bool Success
@@ -202,7 +202,7 @@ class Validation
      * Used to compare 2 numeric values.
      *
      * @param string|array $check1 if string is passed for, a string must also be passed for $check2
-     *    used as an array it must be passed as array('check1' => value, 'operator' => 'value', 'check2' -> value)
+     *    used as an array it must be passed as ['check1' => value, 'operator' => 'value', 'check2' => value]
      * @param string $operator Can be either a word or operand
      *    is greater >, is less <, greater or equal >=
      *    less or equal <=, is less <, equal to ==, not equal !=
@@ -263,7 +263,7 @@ class Validation
      * Used when a custom regular expression is needed.
      *
      * @param string|array $check When used as a string, $regex must also be a valid regular expression.
-     *    As and array: array('check' => value, 'regex' => 'valid regular expression')
+     *    As and array: ['check' => value, 'regex' => 'valid regular expression']
      * @param string|null $regex If $check is passed as a string, $regex must also be set to valid regular expression
      * @return bool Success
      */
@@ -299,7 +299,7 @@ class Validation
      *
      * @param string|\DateTime $check a valid date string/object
      * @param string|array $format Use a string or an array of the keys above.
-     *    Arrays should be passed as array('dmy', 'mdy', etc)
+     *    Arrays should be passed as ['dmy', 'mdy', etc]
      * @param string|null $regex If a custom regular expression is used this is the only validation that will occur.
      * @return bool Success
      */

+ 6 - 6
src/Validation/Validator.php

@@ -272,13 +272,13 @@ class Validator implements \ArrayAccess, \IteratorAggregate, \Countable
      *
      * {{{
      *      $validator
-     *          ->add('title', 'required', array('rule' => 'notEmpty'))
-     *          ->add('user_id', 'valid', array('rule' => 'numeric', 'message' => 'Invalid User'))
+     *          ->add('title', 'required', ['rule' => 'notEmpty'])
+     *          ->add('user_id', 'valid', ['rule' => 'numeric', 'message' => 'Invalid User'])
      *
-     *      $validator->add('password', array(
-     *          'size' => array('rule' => array('between', 8, 20)),
-     *          'hasSpecialCharacter' => array('rule' => 'validateSpecialchar', 'message' => 'not valid')
-     *      ));
+     *      $validator->add('password', [
+     *          'size' => ['rule' => ['between', 8, 20]],
+     *          'hasSpecialCharacter' => ['rule' => 'validateSpecialchar', 'message' => 'not valid']
+     *      ]);
      * }}}
      *
      * @param string $field The name of the field from which the rule will be removed

+ 2 - 2
src/View/Helper.php

@@ -87,8 +87,8 @@ class Helper implements EventListenerInterface
     public $plugin = null;
 
     /**
-     * Holds the fields array('field_name' => array('type' => 'string', 'length' => 100),
-     * primaryKey and validates array('field_name')
+     * Holds the fields ['field_name' => ['type' => 'string', 'length' => 100]],
+     * primaryKey and validates ['field_name']
      *
      * @var array
      */

+ 16 - 16
src/View/Helper/FormHelper.php

@@ -747,19 +747,19 @@ class FormHelper extends Helper
      * Custom attributes:
      *
      * {{{
-     * echo $this->Form->label('published', 'Publish', array(
+     * echo $this->Form->label('published', 'Publish', [
      *   'for' => 'post-publish'
-     * ));
+     * ]);
      * <label for="post-publish">Publish</label>
      * }}}
      *
      * Nesting an input tag:
      *
      * {{{
-     * echo $this->Form->label('published', 'Publish', array(
+     * echo $this->Form->label('published', 'Publish', [
      *   'for' => 'published',
      *   'input' => $this->text('published'),
-     * ));
+     * ]);
      * <label for="post-publish">Publish <input type="text" name="published"></label>
      * }}}
      *
@@ -1424,7 +1424,7 @@ class FormHelper extends Helper
      *
      * ### Usage
      *
-     * `$this->Form->search('User.query', array('value' => 'test'));`
+     * `$this->Form->search('User.query', ['value' => 'test']);`
      *
      * Will make an input like:
      *
@@ -1755,19 +1755,19 @@ class FormHelper extends Helper
      * A simple array will create normal options:
      *
      * {{{
-     * $options = array(1 => 'one', 2 => 'two');
+     * $options = [1 => 'one', 2 => 'two'];
      * $this->Form->select('Model.field', $options));
      * }}}
      *
      * While a nested options array will create optgroups with options inside them.
      * {{{
-     * $options = array(
+     * $options = [
      *  1 => 'bill',
-     *  'fred' => array(
-     *     2 => 'fred',
-     *     3 => 'fred jr.'
-     *  )
-     * );
+     *     'fred' => [
+     *         2 => 'fred',
+     *         3 => 'fred jr.'
+     *     ]
+     * ];
      * $this->Form->select('Model.field', $options);
      * }}}
      *
@@ -1775,10 +1775,10 @@ class FormHelper extends Helper
      * use an array of arrays to express this:
      *
      * {{{
-     * $options = array(
-     *  array('name' => 'United states', 'value' => 'USA'),
-     *  array('name' => 'USA', 'value' => 'USA'),
-     * );
+     * $options = [
+     *     ['name' => 'United states', 'value' => 'USA'],
+     *     ['name' => 'USA', 'value' => 'USA'],
+     * ];
      * }}}
      *
      * @param string $fieldName Name attribute of the SELECT

+ 15 - 15
src/View/Helper/HtmlHelper.php

@@ -148,7 +148,7 @@ class HtmlHelper extends Helper
      *
      * @param string $name Text for link
      * @param string|null $link URL for link (if empty it won't be a link)
-     * @param string|array $options Link attributes e.g. array('id' => 'selected')
+     * @param string|array $options Link attributes e.g. ['id' => 'selected']
      * @return $this
      * @see HtmlHelper::link() for details on $options that can be used.
      * @link http://book.cakephp.org/3.0/en/views/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper
@@ -194,11 +194,11 @@ class HtmlHelper extends Helper
      *
      * Append the meta tag to custom view block "meta":
      *
-     * `$this->Html->meta('description', 'A great page', array('block' => true));`
+     * `$this->Html->meta('description', 'A great page', ['block' => true]);`
      *
      * Append the meta tag to custom view block:
      *
-     * `$this->Html->meta('description', 'A great page', array('block' => 'metaTags'));`
+     * `$this->Html->meta('description', 'A great page', ['block' => 'metaTags']);`
      *
      * Create a custom meta tag:
      *
@@ -376,15 +376,15 @@ class HtmlHelper extends Helper
      *
      * Include multiple CSS files:
      *
-     * `echo $this->Html->css(array('one.css', 'two.css'));`
+     * `echo $this->Html->css(['one.css', 'two.css']);`
      *
      * Add the stylesheet to view block "css":
      *
-     * `$this->Html->css('styles.css', array('block' => true));`
+     * `$this->Html->css('styles.css', ['block' => true]);`
      *
      * Add the stylesheet to a custom block:
      *
-     * `$this->Html->css('styles.css', array('block' => 'layoutCss'));`
+     * `$this->Html->css('styles.css', ['block' => 'layoutCss']);`
      *
      * ### Options
      *
@@ -469,11 +469,11 @@ class HtmlHelper extends Helper
      *
      * Include multiple script files:
      *
-     * `echo $this->Html->script(array('one.js', 'two.js'));`
+     * `echo $this->Html->script(['one.js', 'two.js']);`
      *
      * Add the script file to a custom block:
      *
-     * `$this->Html->script('styles.js', array('block' => 'bodyScript'));`
+     * `$this->Html->script('styles.js', ['block' => 'bodyScript']);`
      *
      * ### Options
      *
@@ -610,7 +610,7 @@ class HtmlHelper extends Helper
      * ### Usage:
      *
      * {{{
-     * echo $this->Html->style(array('margin' => '10px', 'padding' => '10px'), true);
+     * echo $this->Html->style(['margin' => '10px', 'padding' => '10px'], true);
      *
      * // creates
      * 'margin:10px;padding:10px;'
@@ -763,11 +763,11 @@ class HtmlHelper extends Helper
      *
      * Create a regular image:
      *
-     * `echo $this->Html->image('cake_icon.png', array('alt' => 'CakePHP'));`
+     * `echo $this->Html->image('cake_icon.png', ['alt' => 'CakePHP']);`
      *
      * Create an image link:
      *
-     * `echo $this->Html->image('cake_icon.png', array('alt' => 'CakePHP', 'url' => 'http://cakephp.org'));`
+     * `echo $this->Html->image('cake_icon.png', ['alt' => 'CakePHP', 'url' => 'http://cakephp.org']);`
      *
      * ### Options:
      *
@@ -997,7 +997,7 @@ class HtmlHelper extends Helper
      *
      * Using an audio file:
      *
-     * `echo $this->Html->media('audio.mp3', array('fullBase' => true));`
+     * `echo $this->Html->media('audio.mp3', ['fullBase' => true]);`
      *
      * Outputs:
      *
@@ -1005,7 +1005,7 @@ class HtmlHelper extends Helper
      *
      * Using a video file:
      *
-     * `echo $this->Html->media('video.mp4', array('text' => 'Fallback text'));`
+     * `echo $this->Html->media('video.mp4', ['text' => 'Fallback text']);`
      *
      * Outputs:
      *
@@ -1015,8 +1015,8 @@ class HtmlHelper extends Helper
      *
      * {{{
      * echo $this->Html->media(
-     *      array('video.mp4', array('src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'")),
-     *      array('tag' => 'video', 'autoplay')
+     *      ['video.mp4', ['src' => 'video.ogv', 'type' => "video/ogg; codecs='theora, vorbis'"]],
+     *      ['tag' => 'video', 'autoplay']
      * );
      * }}}
      *

+ 1 - 1
src/View/Helper/PaginatorHelper.php

@@ -589,7 +589,7 @@ class PaginatorHelper extends Helper
      * Returns a set of numbers for the paged result set
      * uses a modulus to decide how many numbers to show on each side of the current page (default: 8).
      *
-     * `$this->Paginator->numbers(array('first' => 2, 'last' => 2));`
+     * `$this->Paginator->numbers(['first' => 2, 'last' => 2]);`
      *
      * Using the first and last options you can create links to the beginning and end of the page set.
      *

+ 2 - 2
src/View/JsonView.php

@@ -29,7 +29,7 @@ use Cake\Network\Response;
  *
  * In your controller, you could do the following:
  *
- * `$this->set(array('posts' => $posts, '_serialize' => 'posts'));`
+ * `$this->set(['posts' => $posts, '_serialize' => 'posts']);`
  *
  * When the view is rendered, the `$posts` view variable will be serialized
  * into JSON.
@@ -39,7 +39,7 @@ use Cake\Network\Response;
  *
  * {{{
  * $this->set(compact('posts', 'users', 'stuff'));
- * $this->set('_serialize', array('posts', 'users'));
+ * $this->set('_serialize', ['posts', 'users']);
  * }}}
  *
  * The above would generate a JSON object that looks like:

+ 8 - 8
src/View/View.php

@@ -448,8 +448,8 @@ class View
      * @param string|null $layout Layout to use.
      * @return string|null Rendered content or null if content already rendered and returned earlier.
      * @throws \Cake\Core\Exception\Exception If there is an error in the view.
-     * @triggers View.beforeRender $this, array($viewFileName)
-     * @triggers View.afterRender $this, array($viewFileName)
+     * @triggers View.beforeRender $this, [$viewFileName]
+     * @triggers View.afterRender $this, [$viewFileName]
      */
     public function render($view = null, $layout = null)
     {
@@ -482,8 +482,8 @@ class View
      * @param string|null $layout Layout name
      * @return mixed Rendered output, or false on error
      * @throws \Cake\Core\Exception\Exception if there is an error in the view.
-     * @triggers View.beforeLayout $this, array($layoutFileName)
-     * @triggers View.afterLayout $this, array($layoutFileName)
+     * @triggers View.beforeLayout $this, [$layoutFileName]
+     * @triggers View.afterLayout $this, [$layoutFileName]
      */
     public function renderLayout($content, $layout = null)
     {
@@ -759,8 +759,8 @@ class View
      *   View::$viewVars will be used.
      * @return string Rendered output
      * @throws \LogicException When a block is left open.
-     * @triggers View.beforeRenderFile $this, array($viewFile)
-     * @triggers View.afterRenderFile $this, array($viewFile, $content)
+     * @triggers View.beforeRenderFile $this, [$viewFile]
+     * @triggers View.afterRenderFile $this, [$viewFile, $content]
      */
     protected function _render($viewFile, $data = [])
     {
@@ -1102,8 +1102,8 @@ class View
      * @param array $data Data to render
      * @param array $options Element options
      * @return string
-     * @triggers View.beforeRender $this, array($file)
-     * @triggers View.afterRender $this, array($file, $element)
+     * @triggers View.beforeRender $this, [$file]
+     * @triggers View.afterRender $this, [$file, $element]
      */
     protected function _renderElement($file, $data, $options)
     {

+ 2 - 2
src/View/XmlView.php

@@ -31,7 +31,7 @@ use Cake\Utility\Xml;
  *
  * In your controller, you could do the following:
  *
- * `$this->set(array('posts' => $posts, '_serialize' => 'posts'));`
+ * `$this->set(['posts' => $posts, '_serialize' => 'posts']);`
  *
  * When the view is rendered, the `$posts` view variable will be serialized
  * into XML.
@@ -43,7 +43,7 @@ use Cake\Utility\Xml;
  *
  * {{{
  * $this->set(compact('posts', 'users', 'stuff'));
- * $this->set('_serialize', array('posts', 'users'));
+ * $this->set('_serialize', ['posts', 'users']);
  * }}}
  *
  * The above would generate a XML object that looks like: