-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed as not planned
Description
Description
@iluuu1994 hell again! I brought a little more on the properties, again)
Possibly related with #15419
https://3v4l.org/EbvOM/rfc#vgit.master
The following code:
<?php
final class Example1
{
public string $name = 'asd' {
set(string $value) {
$this->name = $value;
}
}
}
final class Example2
{
public string $name = 'asd' {
set(string $value) {
throw new \Exception('Cannot update value');
$this->name; // lel)
}
}
}
final class Example3
{
public string $name = 'asd' {
set(string $value) {
// $this->name = $value;
}
}
}
final class Example4
{
public string $name = 'asd' {
set(string $value) {
throw new \Exception('Cannot update value');
}
}
}
Resulted in this output:
Example1: OK
Example2: OK
Example3: Cannot specify default value for virtual hooked property Example3::$name
Example4: Cannot specify default value for virtual hooked property Example4::$name
Example3
and Example4
throws an exeption
But I expected this output instead:
Example1: OK
Example2: OK
Example3: OK
Example4: OK
PHP Version
PHP 8.4.1 (+ current master)
Operating System
No response