diff --git a/src/Database/Driver/Sqlite.php b/src/Database/Driver/Sqlite.php index b6aa524b33f..00121fdd4f8 100644 --- a/src/Database/Driver/Sqlite.php +++ b/src/Database/Driver/Sqlite.php @@ -72,7 +72,6 @@ public function connect() * * @return bool true if it is valid to use this driver */ - public function enabled() { return in_array('sqlite', PDO::getAvailableDrivers()); diff --git a/src/Model/Behavior/TranslateBehavior.php b/src/Model/Behavior/TranslateBehavior.php index 27d3cd90465..2a290b42313 100644 --- a/src/Model/Behavior/TranslateBehavior.php +++ b/src/Model/Behavior/TranslateBehavior.php @@ -188,10 +188,10 @@ public function beforeFind(Event $event, Query $query, $options) $select ); - if ($changeFilter) { - $filter = $options['filterByCurrentLocale'] ? 'INNER' : 'LEFT'; - $contain[$alias . '_' . $field . '_translation']['joinType'] = $filter; - } + if ($changeFilter) { + $filter = $options['filterByCurrentLocale'] ? 'INNER' : 'LEFT'; + $contain[$alias . '_' . $field . '_translation']['joinType'] = $filter; + } } $query->contain($contain); diff --git a/src/Network/Request.php b/src/Network/Request.php index b0f3ae78f00..5689aaa927b 100644 --- a/src/Network/Request.php +++ b/src/Network/Request.php @@ -1014,7 +1014,7 @@ public function accepts($type = null) * Generally you want to use Cake\Network\Request::accept() to get a simple list * of the accepted content types. * - * @return array An array of prefValue => array(content/types) + * @return array An array of prefValue => [content/types] */ public function parseAccept() { diff --git a/src/Utility/Hash.php b/src/Utility/Hash.php index d924a22cf3f..4074f6b250c 100644 --- a/src/Utility/Hash.php +++ b/src/Utility/Hash.php @@ -160,11 +160,12 @@ public static function extract(array $data, $path) } return $context[$_key]; } + /** * Split token conditions * * @param string $token the token being splitted. - * @return array array(token, conditions) with token splitted + * @return array [token, conditions] with token splitted */ protected static function _splitConditions($token) { diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index 038923b6f88..d40fc5f2fec 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -155,23 +155,21 @@ public static function cc($check, $type = 'fast', $deep = false, $regex = null) } $cards = array( 'all' => array( - 'amex' => '/^3[4|7]\\d{13}$/', - 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/', - 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/', - 'disc' => '/^(?:6011|650\\d)\\d{12}$/', - 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/', - 'enroute' => '/^2(?:014|149)\\d{11}$/', - 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/', - 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/', - 'mc' => '/^5[1-5]\\d{14}$/', - 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/', - 'switch' => - '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/', - 'visa' => '/^4\\d{12}(\\d{3})?$/', - 'voyager' => '/^8699[0-9]{11}$/' + 'amex' => '/^3[4|7]\\d{13}$/', + 'bankcard' => '/^56(10\\d\\d|022[1-5])\\d{10}$/', + 'diners' => '/^(?:3(0[0-5]|[68]\\d)\\d{11})|(?:5[1-5]\\d{14})$/', + 'disc' => '/^(?:6011|650\\d)\\d{12}$/', + 'electron' => '/^(?:417500|4917\\d{2}|4913\\d{2})\\d{10}$/', + 'enroute' => '/^2(?:014|149)\\d{11}$/', + 'jcb' => '/^(3\\d{4}|2100|1800)\\d{11}$/', + 'maestro' => '/^(?:5020|6\\d{3})\\d{12}$/', + 'mc' => '/^5[1-5]\\d{14}$/', + 'solo' => '/^(6334[5-9][0-9]|6767[0-9]{2})\\d{10}(\\d{2,3})?$/', + 'switch' => '/^(?:49(03(0[2-9]|3[5-9])|11(0[1-2]|7[4-9]|8[1-2])|36[0-9]{2})\\d{10}(\\d{2,3})?)|(?:564182\\d{10}(\\d{2,3})?)|(6(3(33[0-4][0-9])|759[0-9]{2})\\d{10}(\\d{2,3})?)$/', + 'visa' => '/^4\\d{12}(\\d{3})?$/', + 'voyager' => '/^8699[0-9]{11}$/' ), - 'fast' => - '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/' + 'fast' => '/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6011[0-9]{12}|3(?:0[0-5]|[68][0-9])[0-9]{11}|3[47][0-9]{13})$/' ); if (is_array($type)) { diff --git a/src/View/Helper/FormHelper.php b/src/View/Helper/FormHelper.php index d22822627d3..ab5a1cfcc25 100644 --- a/src/View/Helper/FormHelper.php +++ b/src/View/Helper/FormHelper.php @@ -363,18 +363,24 @@ public function create($model = null, array $options = []) case 'get': $htmlAttributes['method'] = 'get'; break; + // Set enctype for form case 'file': $htmlAttributes['enctype'] = 'multipart/form-data'; $options['type'] = ($isCreate) ? 'post' : 'put'; + // Move on case 'post': + // Move on case 'put': + // Move on case 'delete': + // Set patch method case 'patch': $append .= $this->hidden('_method', array( 'name' => '_method', 'value' => strtoupper($options['type']), 'secure' => static::SECURE_SKIP )); + // Default to post method default: $htmlAttributes['method'] = 'post'; } diff --git a/tests/TestCase/Network/SocketTest.php b/tests/TestCase/Network/SocketTest.php index e8034300f8d..b72ad6d454b 100644 --- a/tests/TestCase/Network/SocketTest.php +++ b/tests/TestCase/Network/SocketTest.php @@ -57,11 +57,11 @@ public function testConstruct() $this->Socket = new Socket(); $config = $this->Socket->config(); $this->assertSame($config, array( - 'persistent' => false, - 'host' => 'localhost', - 'protocol' => 'tcp', - 'port' => 80, - 'timeout' => 30 + 'persistent' => false, + 'host' => 'localhost', + 'protocol' => 'tcp', + 'port' => 80, + 'timeout' => 30 )); $this->Socket->reset(); diff --git a/tests/TestCase/ORM/TableTest.php b/tests/TestCase/ORM/TableTest.php index d34ecdb4952..042d1515ffb 100644 --- a/tests/TestCase/ORM/TableTest.php +++ b/tests/TestCase/ORM/TableTest.php @@ -3261,7 +3261,7 @@ function ($article) { public function testInitializeEvent() { $count = 0; - $cb = function ($event) use (&$count){ + $cb = function ($event) use (&$count) { $count++; }; EventManager::instance()->attach($cb, 'Model.initialize'); @@ -3294,7 +3294,7 @@ public function testHasFinder() public function testBuildValidatorEvent() { $count = 0; - $cb = function ($event) use (&$count){ + $cb = function ($event) use (&$count) { $count++; }; EventManager::instance()->attach($cb, 'Model.buildValidator'); diff --git a/tests/test_app/config/acl.php b/tests/test_app/config/acl.php index f567341ab6f..b7caf661066 100644 --- a/tests/test_app/config/acl.php +++ b/tests/test_app/config/acl.php @@ -18,30 +18,30 @@ // Roles // ------------------------------------- $config['roles'] = array( - 'Role/admin' => null, - 'Role/data_acquirer' => null, - 'Role/accounting' => null, - 'Role/database_manager' => null, - 'Role/sales' => null, - 'Role/data_analyst' => 'Role/data_acquirer, Role/database_manager', - 'Role/reports' => 'Role/data_analyst', + 'Role/admin' => null, + 'Role/data_acquirer' => null, + 'Role/accounting' => null, + 'Role/database_manager' => null, + 'Role/sales' => null, + 'Role/data_analyst' => 'Role/data_acquirer, Role/database_manager', + 'Role/reports' => 'Role/data_analyst', // allow inherited roles to be defined as an array or comma separated list - 'Role/manager' => array( + 'Role/manager' => array( 'Role/accounting', 'Role/sales', ), - 'Role/accounting_manager' => 'Role/accounting', + 'Role/accounting_manager' => 'Role/accounting', // managers - 'User/hardy' => 'Role/accounting_manager, Role/reports', - 'User/stan' => 'Role/manager', + 'User/hardy' => 'Role/accounting_manager, Role/reports', + 'User/stan' => 'Role/manager', // accountants - 'User/peter' => 'Role/accounting', - 'User/jeff' => 'Role/accounting', + 'User/peter' => 'Role/accounting', + 'User/jeff' => 'Role/accounting', // admins - 'User/jan' => 'Role/admin', + 'User/jan' => 'Role/admin', // database - 'User/db_manager_1' => 'Role/database_manager', - 'User/db_manager_2' => 'Role/database_manager', + 'User/db_manager_1' => 'Role/database_manager', + 'User/db_manager_2' => 'Role/database_manager', ); //-------------------------------------