Skip to content

[php 8.4] Add property hooks upgrade - optional rule #9152

@TomasVotruba

Description

@TomasVotruba
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); }
+    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions