Skip to content

Generic tag description 0 is not being parsed as expected #166

Closed
@filecage

Description

@filecage

Issue

Parsing a generic doc-block tag that has a body with contents 0 will not be interpreted as actual tag.

Affected versions

Can reproduce in:

  • 4.3.0 (latest stable)
  • 5.0.0-alpha3 (latest release)
  • current master (90ae750)

Reproduction

    /**
     * @arbitrary-tag 0
     */
    class Foo {
    }

    $reflection = new \ReflectionClass(\Foo::class);
    $docComment = $reflection->getDocComment();

    $factory = phpDocumentor\Reflection\DocBlockFactory::createInstance();
    $docblock = $factory->create($docComment);

    echo '>';
    echo (string) $docblock->getTags()[0];
    echo '<';

Output

><

Expected behaviour

The tag description should be treated as string with contents 0.

Actual behaviour

The tag description is being treated as null.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions