Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DocBlockFactory.php

function DocBlockFactory::stripDocComment

Strips the asterisks from the DocBlock comment.

Parameters

string $comment String containing the comment text.:

1 call to DocBlockFactory::stripDocComment()
DocBlockFactory::create in vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php

File

vendor/phpdocumentor/reflection-docblock/src/DocBlockFactory.php, line 166

Class

DocBlockFactory

Namespace

phpDocumentor\Reflection

Code

private function stripDocComment(string $comment) : string {
    $comment = preg_replace('#[ \\t]*(?:\\/\\*\\*|\\*\\/|\\*)?[ \\t]?(.*)?#u', '$1', $comment);
    Assert::string($comment);
    $comment = trim($comment);
    // reg ex above is not able to remove */ from a single line docblock
    if (substr($comment, -2) === '*/') {
        $comment = trim(substr($comment, 0, -2));
    }
    return str_replace([
        "\r\n",
        "\r",
    ], "\n", $comment);
}
RSS feed
Powered by Drupal