Skip to content

Anonymous class phpdoc is not parsed #7345

@mvorisek

Description

@mvorisek

Bug report

#[\AllowDynamicProperties]
class Cl {}

/**
 * @property int $prop
 */
$a = new class() extends Cl {};

$a->prop = 10;
var_dump($a->prop);
var_dump((new \ReflectionClass($a))->getDocComment());

the php recognizes the phpdoc class comment correctly and all code that relies on phpdoc annotation too, so I submit it as a bug

https://3v4l.org/W4cjH

real usecase/testcase https://github.com/mvorisek/atk4-hintable-mirror/blob/24951ac3d1a0a4a9beb7a8ed6c5790ea76a4176e/tests/Data/HintableModelArrayTest.php#L62-L84

Code snippet that reproduces the problem

https://phpstan.org/r/02bc0432-1c81-4868-95ae-cd1d4b276578

Expected output

no error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions