- Output for 8.4.10
- int(0) int(1)
<?php
class Foo {
public int $bar {
get => $this->bar;
set => empty($this->bar) ? $this->bar = $value : throw new LogicException("nope");
}
}
$foo = new Foo;
$foo->bar = 0;
var_dump($foo->bar);
$foo->bar = 1; // no error !
var_dump($foo->bar);