Run Rector on your code to see what it can do for you:
<?php final class DemoFile { - public mixed $value { - get { + public function __construct(public mixed $value { + get { return $this->value; - } + } set { if ($this->optionUsedInValueSetter) { $this->value = "changed value"; } $this->value = $value; - } - } - - public function __construct( - mixed $value, - bool $optionUsedInValueSetter = false, - ) { - $this->value = $value; + } + }, bool $optionUsedInValueSetter = false) + { } }
Applied Rules:
Not a change you expect?
rector.php