diff --git a/lib/Cake/Model/Datasource/Database/Driver/Mysql.php b/lib/Cake/Model/Datasource/Database/Driver/Mysql.php index 20539d77bae..21dcf6b5b99 100644 --- a/lib/Cake/Model/Datasource/Database/Driver/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Driver/Mysql.php @@ -12,7 +12,7 @@ class Mysql extends \Cake\Model\Datasource\Database\Driver { * * @var array */ - protected $_baseConfig = array( + protected $_baseConfig = [ 'persistent' => true, 'host' => 'localhost', 'login' => 'root', @@ -21,7 +21,7 @@ class Mysql extends \Cake\Model\Datasource\Database\Driver { 'port' => '3306', 'flags' => array(), 'encoding' => 'utf8' - ); + ]; /** * Establishes a connection to the databse server @@ -31,12 +31,12 @@ class Mysql extends \Cake\Model\Datasource\Database\Driver { **/ public function connect(array $config) { $config += $this->_baseConfig; - $flags = array( + $flags = [ PDO::ATTR_PERSISTENT => $config['persistent'], PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ' . $config['encoding'] - ) + $config['flags']; + ] + $config['flags']; if (empty($config['unix_socket'])) { $dsn = "mysql:host={$config['host']};port={$config['port']};dbname={$config['database']}"; diff --git a/lib/Cake/Model/Datasource/Database/Statement.php b/lib/Cake/Model/Datasource/Database/Statement.php index 5f5a3d51338..d135f977915 100644 --- a/lib/Cake/Model/Datasource/Database/Statement.php +++ b/lib/Cake/Model/Datasource/Database/Statement.php @@ -33,10 +33,10 @@ class Statement implements \IteratorAggregate, \Countable { * * @var array **/ - protected $_fetchMap = array( + protected $_fetchMap = [ 'num' => PDO::FETCH_NUM, 'assoc' => PDO::FETCH_ASSOC - ); + ]; /** * Constructor @@ -185,7 +185,7 @@ public function fetch($type = 'num') { * {{{ * $statement = $connection->prepare('SELECT id, title from articles'); * $statement->execute(); - * print_r($statement->fetchAll('assoc')); // will show array(0 => array('id' => 1, 'title' => 'a title')) + * print_r($statement->fetchAll('assoc')); // will show [0 => ['id' => 1, 'title' => 'a title']] * }}} * * @param string $type num for fetching columns as positional keys or assoc for column names as keys @@ -263,7 +263,7 @@ protected function _cast($value, $type) { $value = $type->toDatabase($value, $this->_driver); $type = $type->toStatement($value, $this->_driver); } - return array($value, $type); + return [$value, $type]; } } diff --git a/lib/Cake/Model/Datasource/Database/Type.php b/lib/Cake/Model/Datasource/Database/Type.php index 66003809206..59f2788f0f8 100644 --- a/lib/Cake/Model/Datasource/Database/Type.php +++ b/lib/Cake/Model/Datasource/Database/Type.php @@ -19,13 +19,13 @@ class Type { * * @var array **/ - protected static $_types = array( + protected static $_types = [ 'boolean' => '\Cake\Model\Datasource\Database\Type\BooleanType', 'binary' => '\Cake\Model\Datasource\Database\Type\BinaryType', 'date' => '\Cake\Model\Datasource\Database\Type\DateType', 'datetime' => '\Cake\Model\Datasource\Database\Type\DateTimeType', 'time' => '\Cake\Model\Datasource\Database\Type\TimeType' - ); + ]; /** * List of basic type mappings, used to avoid having to instantiate a class @@ -33,19 +33,19 @@ class Type { * * @var array **/ - protected static $_basicTypes = array( - 'float' => array('php' => 'floatval'), - 'integer' => array('php' => 'intval', 'pdo' => PDO::PARAM_INT), - 'string' => array('php' => 'strval'), - 'text' => array('php' => 'strval'), - ); + protected static $_basicTypes = [ + 'float' => ['php' => 'floatval'], + 'integer' => ['php' => 'intval', 'pdo' => PDO::PARAM_INT], + 'string' => ['php' => 'strval'], + 'text' => ['php' => 'strval'], + ]; /** * Contains a map of type object instances to be reused if needed * * @var array **/ - protected static $_builtTypes = array(); + protected static $_builtTypes = []; /** * Identifier name for this type @@ -113,8 +113,8 @@ public static function map($type = null, $className = null) { * @return void **/ public static function clear() { - self::$_types = array(); - self::$_builtTypes = array(); + self::$_types = []; + self::$_builtTypes = []; } /**