diff --git a/core/lib/Drupal/Core/Controller/HtmlControllerBase.php b/core/lib/Drupal/Core/Controller/HtmlControllerBase.php index 87d7956..88e0efe 100644 --- a/core/lib/Drupal/Core/Controller/HtmlControllerBase.php +++ b/core/lib/Drupal/Core/Controller/HtmlControllerBase.php @@ -49,7 +49,7 @@ public function __construct(TitleResolverInterface $title_resolver, RenderHtmlRe /** * Converts a render array into an HtmlFragment object. * - * @param array|\Drupal\Core\Page\HtmlFragment|\Symfony\Component\HttpFoundation\Response $page_content + * @param array|\Drupal\Core\Page\HtmlFragmentInterface|\Symfony\Component\HttpFoundation\Response $page_content * The page content area to display. * @param \Symfony\Component\HttpFoundation\Request $request * The request object. @@ -58,6 +58,7 @@ public function __construct(TitleResolverInterface $title_resolver, RenderHtmlRe * A page object. * * @throws \InvalidArgumentException + * Thrown if the controller returns a string. */ protected function createHtmlFragment($page_content, Request $request) { // Allow controllers to return a HtmlFragment or a Response object directly. @@ -66,7 +67,7 @@ protected function createHtmlFragment($page_content, Request $request) { } if (is_string($page_content)) { - throw new \InvalidArgumentException('_content controllers may not return strings.'); + throw new \InvalidArgumentException('_content controllers are not allowed to return strings. You can return a render array, a html fragment or a response object.'); } $fragment = $this->renderHtmlRenderer->render($page_content); diff --git a/core/modules/system/src/Tests/Routing/RouterTest.php b/core/modules/system/src/Tests/Routing/RouterTest.php index 4fd44bf..c9e70ca 100644 --- a/core/modules/system/src/Tests/Routing/RouterTest.php +++ b/core/modules/system/src/Tests/Routing/RouterTest.php @@ -44,7 +44,7 @@ public function testDefaultController() { $this->assertRaw('', 'Page markup was found.'); // In some instances, the subrequest handling may get confused and render - // a page inception style. This test verifies that is not happening. + // a page inception style. This test verifies that is not happening $this->assertNoPattern('#.*#s', 'There was no double-page effect from a misrendered subrequest.'); }