commit 7f17aca9eebc837caca239ed8c6d4f8b2083f330 Author: xjm Date: Wed Jul 16 13:12:14 2014 +0100 Minor cleanups for #261. diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 522d468..236e56a 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -964,9 +964,11 @@ function drupal_set_message($message = NULL, $type = 'status', $repeat = FALSE) * intact. Defaults to TRUE. * * @return array - * The messages returned are limited to the type specified in the $type - * parameter, if any. If there are no messages of the specified type, an - * empty array is returned. See drupal_set_message() for the array structure. + * An associative, nested array of messages grouped by message type, with + * the top-level keys as the message type. The messages returned are + * limited to the type specified in the $type parameter, if any. If there + * are no messages of the specified type, an empty array is returned. See + * drupal_set_message() for the array structure of indivdual messages. * * @see drupal_set_message() * @see theme_status_messages() diff --git a/core/lib/Drupal/Component/Utility/SafeMarkup.php b/core/lib/Drupal/Component/Utility/SafeMarkup.php index d3844f0..dc0a6a1 100644 --- a/core/lib/Drupal/Component/Utility/SafeMarkup.php +++ b/core/lib/Drupal/Component/Utility/SafeMarkup.php @@ -19,7 +19,7 @@ * marked safe, as are markup strings created from render arrays via * drupal_render(). * - * This class should be limited to interal use only. Module developers should + * This class should be limited to internal use only. Module developers should * instead use the appropriate * @link sanitization sanitization functions @endlink or the * @link theme_render theme and render systems @endlink so that the output can diff --git a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php index bb82c90..cd0ee1d 100644 --- a/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php +++ b/core/tests/Drupal/Tests/Component/Utility/SafeMarkupTest.php @@ -91,6 +91,7 @@ public function testSetMultiple() { $this->assertTrue(SafeMarkup::isSafe($string), 'The value has been marked as safe for html'); } } + /** * Tests SafeMarkup::setMultiple(). * diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index d325d86..912cea8 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -188,7 +188,7 @@ function twig_without($element) { /** * Overrides twig_escape_filter(). * - * Replacement function for twig's escape filter. + * Replacement function for Twig's escape filter. * * @param Twig_Environment $env * A Twig_Environment instance. @@ -198,40 +198,40 @@ function twig_without($element) { * The escaping strategy. Defaults to 'html'. * @param string $charset * The charset. - * @param Boolean $autoescape + * @param bool $autoescape * Whether the function is called by the auto-escaping feature (TRUE) or by * the developer (FALSE). * * @return string|null * The escaped, rendered output, or NULL if there is no valid output. */ -function twig_drupal_escape_filter(\Twig_Environment $env, $arg, $strategy = 'html', $charset = NULL, $autoescape = FALSE) { +function twig_drupal_escape_filter(\Twig_Environment $env, $string, $strategy = 'html', $charset = NULL, $autoescape = FALSE) { // Check for a numeric zero. - if ($arg === 0) { + if ($string === 0) { return 0; } // Return early for NULL or an empty array. - if ($arg == NULL) { + if ($string == NULL) { return NULL; } // Keep Twig_Markup objects intact to support autoescaping. - if ($autoescape && $arg instanceOf \Twig_Markup) { - return $arg; + if ($autoescape && $string instanceOf \Twig_Markup) { + return $string; } $return = NULL; - if (is_scalar($arg)) { - $return = (string) $arg; + if (is_scalar($string)) { + $return = (string) $string; } - elseif (is_object($arg)) { - if (method_exists($arg, '__toString')) { - $return = (string) $arg; + elseif (is_object($string)) { + if (method_exists($string, '__toString')) { + $return = (string) $string; } else { - throw new \Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($arg)))); + throw new \Exception(t('Object of type "@class" cannot be printed.', array('@class' => get_class($string)))); } } @@ -251,7 +251,7 @@ function twig_drupal_escape_filter(\Twig_Environment $env, $arg, $strategy = 'ht } // This is a normal render array, which is safe by definition. - return render($arg); + return render($string); } /**