diff -u b/core/lib/Drupal/Core/Link.php b/core/lib/Drupal/Core/Link.php --- b/core/lib/Drupal/Core/Link.php +++ b/core/lib/Drupal/Core/Link.php @@ -140,13 +140,13 @@ /** * Generates the HTML for this Link object. * + * It is discouraged to use toString() in any code which renders something in + * an HTML context, instead of ::toRenderable(). There might be use cases like + * tests and non-HTML contexts, in which rendering to a string directly makes + * sense. + * * @return \Drupal\Core\GeneratedLink * The link HTML markup. - * - * Its discouraged to use toString() in any code which renders something in - * context of HTML, instead of ::toRenderable(). There might be usecases like - * tests and non HTML contexts, in which rendering to a string directly makes - * sense. */ public function toString() { return $this->getLinkGenerator()->generateFromLink($this);