rector
rector copied to clipboard
[php 8.4] Add property hooks upgrade - optional rule
class Product {
- private string $name;
-
- public function getName(): string {
- return $this->name;
- }
-
- public function setName(string $name): void {
- $this->name = ucfirst($name);
- }
+ public string $name {
+ get { return $this->name; }
+ set { $this->name = ucfirst($value); }
+ }
}