Skip to content

[PropertyInfo] Not compatible with phpDocumentor v5 #36049

@ghost

Description

Symfony version(s) affected: v5.0.5 (all?)

Description
Using the property-info component in combination with phpDocumentor v5 (phpdocumentor/reflection-docblock 5.1.0) results in exceptions being thrown when unknown/invald tags are parsed. Looks like in the latest version og phpDocumentor these tags are not skipped, but an instance of InvalidTag is returned.

Error: Call to undefined method phpDocumentor\Reflection\DocBlock\Tags\InvalidTag::getType()

.../vendor/symfony/property-info/Extractor/PhpDocExtractor.php:145

How to reproduce

<?php

include 'vendor/autoload.php';

use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;

class SomeClass {
    /** @var  */
    public $foo;
}

$phpDocExtractor = new PhpDocExtractor();
$phpDocExtractor->getTypes(\SomeClass::class, 'foo');

Possible Solution
Check for the value type of all values returned by $docBlock->getTagsByName($tag)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions