1--TEST--
2Can override readonly property with attributes
3--FILE--
4<?php
5
6#[Attribute]
7class FooAttribute {}
8
9class A {
10    public readonly int $prop;
11
12    public function __construct() {
13        $this->prop = 42;
14    }
15}
16class B extends A {
17    #[FooAttribute]
18    public readonly int $prop;
19}
20
21var_dump((new ReflectionProperty(B::class, 'prop'))->getAttributes()[0]->newInstance());
22
23?>
24--EXPECT--
25object(FooAttribute)#1 (0) {
26}
27