diff --git a/src/Cache/Engine/FileEngine.php b/src/Cache/Engine/FileEngine.php index a5367f373c7..49247cc68c0 100644 --- a/src/Cache/Engine/FileEngine.php +++ b/src/Cache/Engine/FileEngine.php @@ -413,7 +413,7 @@ protected function _setKey($key, $createKey = false) } /** - * Determine is cache directory is writable + * Determine if cache directory is writable * * @return bool */ diff --git a/src/Console/CommandRunner.php b/src/Console/CommandRunner.php index 894c9ae4dd1..9638d7f1820 100644 --- a/src/Console/CommandRunner.php +++ b/src/Console/CommandRunner.php @@ -298,7 +298,7 @@ protected function getShell(ConsoleIo $io, CommandCollection $commands, $name) /** * Resolve the command name into a name that exists in the collection. * - * Apply backwards compatibile inflections and aliases. + * Apply backwards compatible inflections and aliases. * * @param \Cake\Console\CommandCollection $commands The command collection to check. * @param \Cake\Console\ConsoleIo $io ConsoleIo object for errors. diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index a1bf3aac399..a8fc53fc4e1 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -499,7 +499,7 @@ public function enableAutoRender() } /** - * Disbale automatic action rendering. + * Disable automatic action rendering. * * @return $this * @since 3.6.0 diff --git a/src/Database/FunctionsBuilder.php b/src/Database/FunctionsBuilder.php index dbcf84e80d1..22a3b71e14b 100644 --- a/src/Database/FunctionsBuilder.php +++ b/src/Database/FunctionsBuilder.php @@ -205,7 +205,7 @@ public function extract($part, $expression, $types = []) * Add the time unit to the date expression * * @param string $expression Expression to obtain the date part from. - * @param string $value Value to be added. Use negative to substract. + * @param string $value Value to be added. Use negative to subtract. * @param string $unit Unit of the value e.g. hour or day. * @param array $types list of types to bind to the arguments * @return \Cake\Database\Expression\FunctionExpression diff --git a/src/Database/Schema/MysqlSchema.php b/src/Database/Schema/MysqlSchema.php index 5ca25bf9605..52d7fe204a1 100644 --- a/src/Database/Schema/MysqlSchema.php +++ b/src/Database/Schema/MysqlSchema.php @@ -139,7 +139,7 @@ protected function _convertColumn($column) } if (strpos($col, 'blob') !== false || $col === 'binary') { $lengthName = substr($col, 0, -4); - $length = isset(TableSchema::$columnLengths[$lengthName]) ? TableSchema::$columnLengths[$lengthName] : null; + $length = isset(TableSchema::$columnLengths[$lengthName]) ? TableSchema::$columnLengths[$lengthName] : $length; return ['type' => TableSchema::TYPE_BINARY, 'length' => $length]; } diff --git a/src/Database/Schema/SqliteSchema.php b/src/Database/Schema/SqliteSchema.php index ffafb8a3047..b22f2a4c673 100644 --- a/src/Database/Schema/SqliteSchema.php +++ b/src/Database/Schema/SqliteSchema.php @@ -102,8 +102,8 @@ protected function _convertColumn($column) if ($col === 'binary' && $length === 16) { return ['type' => TableSchema::TYPE_BINARY_UUID, 'length' => null]; } - if (in_array($col, ['blob', 'clob'])) { - return ['type' => TableSchema::TYPE_BINARY, 'length' => null]; + if (in_array($col, ['blob', 'clob', 'binary'])) { + return ['type' => TableSchema::TYPE_BINARY, 'length' => $length]; } if (in_array($col, ['date', 'time', 'timestamp', 'datetime'])) { return ['type' => $col, 'length' => null]; diff --git a/src/Datasource/EntityTrait.php b/src/Datasource/EntityTrait.php index f9035174b2b..854936c0b0e 100644 --- a/src/Datasource/EntityTrait.php +++ b/src/Datasource/EntityTrait.php @@ -981,7 +981,7 @@ public function setErrors(array $fields, $overwrite = false) // String messages are appended to the list, // while more complex error structures need their - // keys perserved for nested validator. + // keys preserved for nested validator. if (is_string($error)) { $this->_errors[$f][] = $error; } else { diff --git a/src/Http/Middleware/EncryptedCookieMiddleware.php b/src/Http/Middleware/EncryptedCookieMiddleware.php index 6555cfd258e..dbb4d3f510c 100644 --- a/src/Http/Middleware/EncryptedCookieMiddleware.php +++ b/src/Http/Middleware/EncryptedCookieMiddleware.php @@ -45,7 +45,7 @@ class EncryptedCookieMiddleware protected $cookieNames; /** - * Encrpytion key to use. + * Encryption key to use. * * @var string */ diff --git a/src/Http/ServerRequestFactory.php b/src/Http/ServerRequestFactory.php index f86b66b6cb5..3641a9ed306 100644 --- a/src/Http/ServerRequestFactory.php +++ b/src/Http/ServerRequestFactory.php @@ -79,7 +79,7 @@ public static function createUri(array $server = []) * Build a UriInterface object. * * Add in some CakePHP specific logic/properties that help - * perserve backwards compatibility. + * preserve backwards compatibility. * * @param array $server The server parameters. * @param array $headers The normalized headers diff --git a/src/ORM/Table.php b/src/ORM/Table.php index 3e663ee5223..3848d53e6df 100644 --- a/src/ORM/Table.php +++ b/src/ORM/Table.php @@ -1848,7 +1848,7 @@ public function exists($conditions) * listeners will receive the entity and the options array as arguments. The type * of operation performed (insert or update) can be determined by checking the * entity's method `isNew`, true meaning an insert and false an update. - * - Model.afterSaveCommit: Will be triggered after the transaction is commited + * - Model.afterSaveCommit: Will be triggered after the transaction is committed * for atomic save, listeners will receive the entity and the options array * as arguments. * diff --git a/src/Routing/RouteBuilder.php b/src/Routing/RouteBuilder.php index b160391d255..9409f1bcee3 100644 --- a/src/Routing/RouteBuilder.php +++ b/src/Routing/RouteBuilder.php @@ -1062,7 +1062,7 @@ public function applyMiddleware(...$names) throw new RuntimeException($message); } } - $this->middleware = array_merge($this->middleware, $names); + $this->middleware = array_unique(array_merge($this->middleware, $names)); return $this; } diff --git a/src/Utility/Crypto/Mcrypt.php b/src/Utility/Crypto/Mcrypt.php index b67c72e91f4..7d0b7a3b743 100644 --- a/src/Utility/Crypto/Mcrypt.php +++ b/src/Utility/Crypto/Mcrypt.php @@ -33,7 +33,7 @@ class Mcrypt * @param string $key Key to use as the encryption key for encrypted data. * @param string $operation Operation to perform, encrypt or decrypt * @throws \LogicException When there are errors. - * @return string Encrytped binary string data, or decrypted data depending on operation. + * @return string Encrypted binary string data, or decrypted data depending on operation. * @deprecated 3.3.0 This method will be removed in 4.0.0. */ public static function rijndael($text, $key, $operation) diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index 696f6fe6f0e..72bf6a5ae56 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -1373,7 +1373,7 @@ public static function imageSize($file, $options) * Validates the image width. * * @param array $file The uploaded file data from PHP. - * @param string $operator Comparision operator. + * @param string $operator Comparison operator. * @param int $width Min or max width. * @return bool */ @@ -1391,7 +1391,7 @@ public static function imageWidth($file, $operator, $width) * Validates the image width. * * @param array $file The uploaded file data from PHP. - * @param string $operator Comparision operator. + * @param string $operator Comparison operator. * @param int $height Min or max width. * @return bool */ diff --git a/tests/TestCase/Database/Schema/MysqlSchemaTest.php b/tests/TestCase/Database/Schema/MysqlSchemaTest.php index acc55d51622..f8462b60900 100644 --- a/tests/TestCase/Database/Schema/MysqlSchemaTest.php +++ b/tests/TestCase/Database/Schema/MysqlSchemaTest.php @@ -123,6 +123,10 @@ public static function convertColumnProvider() 'BINARY(16)', ['type' => 'binaryuuid', 'length' => null] ], + [ + 'BINARY(1)', + ['type' => 'binary', 'length' => 1] + ], [ 'TEXT', ['type' => 'text', 'length' => null] diff --git a/tests/TestCase/Database/Schema/SqliteSchemaTest.php b/tests/TestCase/Database/Schema/SqliteSchemaTest.php index 22935a43edb..6f314f73db7 100644 --- a/tests/TestCase/Database/Schema/SqliteSchemaTest.php +++ b/tests/TestCase/Database/Schema/SqliteSchemaTest.php @@ -87,6 +87,10 @@ public static function convertColumnProvider() 'BINARY(16)', ['type' => 'binaryuuid', 'length' => null] ], + [ + 'BINARY(1)', + ['type' => 'binary', 'length' => 1] + ], [ 'BLOB', ['type' => 'binary', 'length' => null] diff --git a/tests/TestCase/Database/Schema/SqlserverSchemaTest.php b/tests/TestCase/Database/Schema/SqlserverSchemaTest.php index 371cd42cd6b..2fb38be7965 100644 --- a/tests/TestCase/Database/Schema/SqlserverSchemaTest.php +++ b/tests/TestCase/Database/Schema/SqlserverSchemaTest.php @@ -198,7 +198,7 @@ public static function convertColumnProvider() 50, null, null, - // Sqlserver returns double lenghts for unicode columns + // Sqlserver returns double lengths for unicode columns ['type' => 'string', 'length' => 25] ], [ diff --git a/tests/TestCase/I18n/I18nTest.php b/tests/TestCase/I18n/I18nTest.php index 332f75e97cc..9255616e466 100644 --- a/tests/TestCase/I18n/I18nTest.php +++ b/tests/TestCase/I18n/I18nTest.php @@ -266,7 +266,7 @@ public function testBasicTranslateFunction() } /** - * Tests the __() functions with explict null params + * Tests the __() functions with explicit null params * * @return void */ diff --git a/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php b/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php index 1a460fffa0a..2d0393ce5e6 100644 --- a/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php +++ b/tests/TestCase/ORM/Behavior/TranslateBehaviorTest.php @@ -173,7 +173,7 @@ public function testFindTranslationsFormatResultsIteration() /** * Tests that fields from a translated model use the I18n class locale - * and that it propogates to associated models + * and that it propagates to associated models * * @return void */ diff --git a/tests/TestCase/ORM/TableTest.php b/tests/TestCase/ORM/TableTest.php index 8a7a52addc2..25d1c06dc6f 100644 --- a/tests/TestCase/ORM/TableTest.php +++ b/tests/TestCase/ORM/TableTest.php @@ -4986,7 +4986,7 @@ public function testReplaceHasManyOnErrorDependentCascadeCallbacks() } /** - * Integration test for replacing entities with HasMany and an empty target list. The transaction must be successfull + * Integration test for replacing entities with HasMany and an empty target list. The transaction must be successful * * @return void */ @@ -5028,7 +5028,7 @@ public function testReplaceHasManyEmptyList() } /** - * Integration test for replacing entities with HasMany and no already persisted entities. The transaction must be successfull. + * Integration test for replacing entities with HasMany and no already persisted entities. The transaction must be successful. * Replace operation should prevent considering 0 changed records an error when they are not found in the table * * @return void @@ -6542,7 +6542,7 @@ public function testSetEntitySource() /** * Tests that passing a coned entity that was marked as new to save() will - * actaully save it as a new entity + * actually save it as a new entity * * @group save * @return void diff --git a/tests/TestCase/Routing/Route/RouteTest.php b/tests/TestCase/Routing/Route/RouteTest.php index 0687d0dc907..d2d979ceafa 100644 --- a/tests/TestCase/Routing/Route/RouteTest.php +++ b/tests/TestCase/Routing/Route/RouteTest.php @@ -582,7 +582,7 @@ public function testComplexRouteCompilingAndParsing() $this->assertRegExp($result, '/source/view'); $this->assertRegExp($result, '/source/view/other/params'); $this->assertNotRegExp($result, '/chaw_test/wiki'); - $this->assertNotRegExp($result, '/source/wierd_action'); + $this->assertNotRegExp($result, '/source/weird_action'); } /** diff --git a/tests/TestCase/Routing/RouteBuilderTest.php b/tests/TestCase/Routing/RouteBuilderTest.php index d763b3e8519..b31cb699cef 100644 --- a/tests/TestCase/Routing/RouteBuilderTest.php +++ b/tests/TestCase/Routing/RouteBuilderTest.php @@ -1081,6 +1081,25 @@ public function testApplyMiddlewareMerges() $this->assertAttributeEquals(['test', 'test2'], 'middleware', $routes); } + /** + * Test that applyMiddleware() uses unique middleware set + * + * @return void + */ + public function testApplyMiddlewareUnique() + { + $func = function () { + }; + $routes = new RouteBuilder($this->collection, '/api'); + $routes->registerMiddleware('test', $func) + ->registerMiddleware('test2', $func); + + $routes->applyMiddleware('test', 'test2'); + $routes->applyMiddleware('test2', 'test'); + + $this->assertAttributeEquals(['test', 'test2'], 'middleware', $routes); + } + /** * Test applying middleware results in middleware attached to the route. * diff --git a/tests/TestCase/Utility/HashTest.php b/tests/TestCase/Utility/HashTest.php index 8cb2ae1e884..814da1507f1 100644 --- a/tests/TestCase/Utility/HashTest.php +++ b/tests/TestCase/Utility/HashTest.php @@ -1189,7 +1189,7 @@ public function testExtractWildcard() } /** - * Test the attribute presense selector. + * Test the attribute presence selector. * * @dataProvider articleDataSets * @return void diff --git a/tests/TestCase/Utility/TextTest.php b/tests/TestCase/Utility/TextTest.php index 1b773bf9946..4f0129c787f 100644 --- a/tests/TestCase/Utility/TextTest.php +++ b/tests/TestCase/Utility/TextTest.php @@ -468,7 +468,7 @@ public function testWrapIndent() } /** - * test wrapBlock() indentical to wrap() + * test wrapBlock() identical to wrap() * * @return void */ diff --git a/tests/TestCase/Validation/ValidationTest.php b/tests/TestCase/Validation/ValidationTest.php index c7f914ea68d..22f6bc4f0c0 100644 --- a/tests/TestCase/Validation/ValidationTest.php +++ b/tests/TestCase/Validation/ValidationTest.php @@ -1978,7 +1978,7 @@ public function testEmail() */ public function testEmailDeep() { - $this->skipIf((bool)gethostbynamel('example.abcd'), 'Your DNS service responds for non-existant domains, skipping deep email checks.'); + $this->skipIf((bool)gethostbynamel('example.abcd'), 'Your DNS service responds for non-existent domains, skipping deep email checks.'); $this->assertTrue(Validation::email('abc.efg@cakephp.org', true)); $this->assertFalse(Validation::email('abc.efg@caphpkeinvalid.com', true)); diff --git a/tests/TestCase/View/Helper/PaginatorHelperTest.php b/tests/TestCase/View/Helper/PaginatorHelperTest.php index b740c522a8d..99122c9e566 100644 --- a/tests/TestCase/View/Helper/PaginatorHelperTest.php +++ b/tests/TestCase/View/Helper/PaginatorHelperTest.php @@ -842,7 +842,7 @@ public function testUrlGenerationResetsToPage1($field, $options, $expected) /** * Returns data sets of: * * the name of the field being sorted on - * * url paramters to pass to paginator sort + * * url parameters to pass to paginator sort * * expected result as a string * * @return array diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index adeb57830c7..765a9d28f16 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -1941,7 +1941,7 @@ public function testExtendMissingElement() } /** - * Test extend() preceeded by an element() + * Test extend() preceded by an element() * * @return void */ @@ -1958,7 +1958,7 @@ public function testExtendWithElementBeforeExtend() } /** - * Test extend() preceeded by an element() + * Test extend() preceded by an element() * * @return void */