[php-src] Issue #12909: Phpdoc vs. attribute declaration inconsistency with anonymous class

From: Date: Fri, 08 Dec 2023 23:02:33 +0000
Subject: [php-src] Issue #12909: Phpdoc vs. attribute declaration inconsistency with anonymous class
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246017@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/12909
Author: mvorisek

### Description

repro: https://3v4l.org/v7YBE

When an attribute is declared like the phpdoc, ie. before the assignment: https://3v4l.org/phOAR, the code cannot be parsed.

I would expect the "phpdoc" to be parsed the same way as "attributes" are, ie.
if one is allowed to be declared before the assignment, both should be allowed. Or neither allowed,
ie. both must be declared after the new keyword - probably preferred.

### PHP Version

any

### Operating System

any


Thread (1 message)

  • mvorisek
« previous php.bugs (#246017) next »