Skip to content

Hooks on constructor promoted properties without visibility are ignored #15438

Closed
@iluuu1994

Description

@iluuu1994

Description

The following code:

class C {
    public function __construct(
        $prop { set => $value * 2; },
    ) {}
}

$c = new C(42);
var_dump($c);

Resulted in this output:

object(C)#1 (0) {
}

But I expected this output instead:

object(C)#1 (1) {
  ["prop"]=>
  int(84)
}

Or compile error

PHP Version

master

Operating System

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions