[php-src] Issue #10377: Unable to have an anonymous readonly class
| From: | claudepache | Date: | Thu, 19 Jan 2023 11:16:32 +0000 |
| Subject: | [php-src] Issue #10377: Unable to have an anonymous readonly class | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243499@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10377
Author: claudepache
### Description
The following code:
```php
<?php
$a = new readonly class {
public int $x;
function __construct() {
$this->x = 2;
}
};
var_dump($a->x);
```
Resulted in this output:
```
Parse error: syntax error, unexpected token "readonly" in /in/3uciU on line 3
```
But I expected this output instead:
```
int(2)
```
### PHP Version
PHP 8.2.1
### Operating System
_No response_