website/errors/property.hooksNotSupported.md
<?php declare(strict_types = 1);
class Foo
{
public string $name {
get => $this->name;
set => $this->name = $value;
}
}
Property hooks (get/set hooks) are only supported on PHP 8.4 and later. The analysed code uses property hooks, but the project's configured PHP version is older than 8.4.
If your project needs to support PHP versions older than 8.4, use getter and setter methods instead:
<?php declare(strict_types = 1);
class Foo
{
- public string $name {
- get => $this->name;
- set => $this->name = $value;
- }
+ private string $name;
+
+ public function getName(): string
+ {
+ return $this->name;
+ }
+
+ public function setName(string $value): void
+ {
+ $this->name = $value;
+ }
}
Or update the PHP version requirement for your project to PHP 8.4 or later.