CommentLexer

namespace

bhenk\doc2rst\process

predicates

Cloneable | Instantiable

implements

Stringable

extends

AbstractLexer

hierarchy

CommentLexer -> AbstractLexer

Reads and processes DocComments

According to PSR-5 Definitions a “DocComment” is a special type of comment which MUST

  • start with the character sequence /** followed by a whitespace character

  • end with */ and

  • have zero or more lines in between.

This CommentLexer reads summary lines up to the first period or the first white line is encountered. The rest of the PHPdoc comment is treated as description.

Inline tags are treated as such and rendered at their original location in the text. Inline tags begin with {@ and end with a }. Non-inline tags that are not at the start of a line, will not be rendered. (For instance @link http://whatever.com whatever.)

Tags at the start of a line are filtered out, rendered and appear in a predefined order and location in the documentation. @todo link to comment and tag order


Constructor

CommentLexer::__construct

predicates

public | constructor

Constructs a new CommentLexer

public function __construct(
      Parameter #0 [ <required> string $docComment ]
      Parameter #1 [ <optional> bool $ignoreInheritdoc = false ]
 )
param string $docComment - string that starts with /** followed by a whitespace character
param bool $ignoreInheritdoc

Methods

CommentLexer::getCommentOrganizer

predicates

public

public function getCommentOrganizer(): CommentOrganizer

CommentLexer::lex

predicates

public

public function lex(): void
return void

CommentLexer::markupSummary

predicates

public

public function markupSummary(
      Parameter #0 [ <required> array $processed ]
 ): array
param array $processed
return array

CommentLexer::preserveMarkup

predicates

public | static

Preserve markup in an otherwise strong line

Example:

before: "Preserves italic *null* and ticks ``true`` markup"

after:  "**Preserves italic** *null* **and ticks** ``true`` **markup**"
public static function preserveMarkup(
      Parameter #0 [ <required> string $line ]
 ): string
param string $line - any string
return string - string with bold markup and other markup preserved

CommentLexer::__toString

predicates

public

implements

Stringable::__toString

inherited from

AbstractLexer::__toString

see also

Stringable

public function __toString(): string
return string

CommentLexer::getSegments

predicates

public

inherited from

AbstractLexer::getSegments

public function getSegments(): array
return array

CommentLexer::setSegments

predicates

public

inherited from

AbstractLexer::setSegments

public function setSegments(
      Parameter #0 [ <required> array $segments ]
 ): void
param array $segments
return void

CommentLexer::addSegment

predicates

public

inherited from

AbstractLexer::addSegment

public function addSegment(
      Parameter #0 [ <required> Stringable|string $segment ]
 ): void
param Stringable | string $segment
return void

CommentLexer::resolveReflectionType

predicates

protected

inherited from

AbstractLexer::resolveReflectionType

protected function resolveReflectionType(
      Parameter #0 [ <required> ReflectionType $reflectionType ]
 ): string
param ReflectionType $reflectionType
return string

CommentLexer::checkParameters

predicates

protected

inherited from

AbstractLexer::checkParameters

protected function checkParameters(
      Parameter #0 [ <required> bhenk\doc2rst\process\CommentLexer $lexer ]
      Parameter #1 [ <required> array $params ]
 ): void
param CommentLexer $lexer
param array $params
return void

Fri, 31 Mar 2023 13:22:46 +0000