Browse Source

Backport from 4.x: Typos and exceptions.

mscherer 6 years ago
parent
commit
ffb4a5becb

+ 1 - 1
src/Collection/CollectionInterface.php

@@ -255,7 +255,7 @@ interface CollectionInterface extends Iterator, JsonSerializable
      * @param callable|string $callback the callback or column name to use for sorting
      * @param int $type the type of comparison to perform, either SORT_STRING
      * SORT_NUMERIC or SORT_NATURAL
-     * @see \Cake\Collection\CollectionIterface::sortBy()
+     * @see \Cake\Collection\CollectionInterface::sortBy()
      * @return mixed The value of the top element in the collection
      */
     public function max($callback, $type = \SORT_NUMERIC);

+ 1 - 1
src/Console/CommandCollection.php

@@ -62,7 +62,7 @@ class CommandCollection implements IteratorAggregate, Countable
         if (!is_subclass_of($command, Shell::class) && !is_subclass_of($command, Command::class)) {
             $class = is_string($command) ? $command : get_class($command);
             throw new InvalidArgumentException(
-                "Cannot use '$class' for command '$name' it is not a subclass of Cake\Console\Shell or Cake\Console\Command."
+                "Cannot use '$class' for command '$name'. It is not a subclass of Cake\Console\Shell or Cake\Console\Command."
             );
         }
         if (!preg_match('/^[^\s]+(?:(?: [^\s]+){1,2})?$/ui', $name)) {

+ 1 - 1
src/TestSuite/MiddlewareDispatcher.php

@@ -85,7 +85,7 @@ class MiddlewareDispatcher
             $app = $reflect->newInstanceArgs($this->_constructorArgs);
             $this->app = $app;
         } catch (ReflectionException $e) {
-            throw new LogicException(sprintf('Cannot load "%s" for use in integration testing.', $this->_class));
+            throw new LogicException(sprintf('Cannot load `%s` for use in integration testing.', $this->_class));
         }
     }
 

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

@@ -1103,7 +1103,7 @@ class HtmlHelper extends Helper
         if (!empty($options['escape'])) {
             $text = h($text);
         }
-        if ($class && !empty($class)) {
+        if ($class) {
             $options['class'] = $class;
         }
         $tag = 'para';

+ 3 - 3
tests/TestCase/Console/CommandCollectionTest.php

@@ -59,7 +59,7 @@ class CommandCollectionTest extends TestCase
     public function testConstructorInvalidClass()
     {
         $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'nope\' it is not a subclass of Cake\Console\Shell');
+        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'nope\'. It is not a subclass of Cake\Console\Shell');
         new CommandCollection([
             'i18n' => I18nShell::class,
             'nope' => stdClass::class,
@@ -131,7 +131,7 @@ class CommandCollectionTest extends TestCase
     public function testAddInvalidInstance()
     {
         $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\' it is not a subclass of Cake\Console\Shell');
+        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\'. It is not a subclass of Cake\Console\Shell');
         $collection = new CommandCollection();
         $shell = new stdClass();
         $collection->add('routes', $shell);
@@ -177,7 +177,7 @@ class CommandCollectionTest extends TestCase
     public function testInvalidShellClassName()
     {
         $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\' it is not a subclass of Cake\Console\Shell');
+        $this->expectExceptionMessage('Cannot use \'stdClass\' for command \'routes\'. It is not a subclass of Cake\Console\Shell');
         $collection = new CommandCollection();
         $collection->add('routes', stdClass::class);
     }

+ 1 - 1
tests/TestCase/TestSuite/IntegrationTestTraitTest.php

@@ -409,7 +409,7 @@ class IntegrationTestTraitTest extends IntegrationTestCase
     public function testConfigApplication()
     {
         $this->expectException(\LogicException::class);
-        $this->expectExceptionMessage('Cannot load "TestApp\MissingApp" for use in integration');
+        $this->expectExceptionMessage('Cannot load `TestApp\MissingApp` for use in integration');
         $this->configApplication('TestApp\MissingApp', []);
         $this->get('/request_action/test_request_action');
     }