Skip to content

PHP 8.4 future release and support to property hooks #279

Open
@peregrinodeti

Description

@peregrinodeti

Is your feature request related to a problem? Please describe.
PHP 8.4 it's schedule to be release at november 2024. But your alpha's will be release in July. It's any planning to support property hooks at Eclipse 2024-09 release or to build nights to current version?

Is this feature require new UI elements or modify existing?
No.

Describe the solution you'd like
One of the most anticipated features of PHP 8.4 is property hooks. This feature allows developers to define custom "get" and "set" behaviors of class properties. Inspired by languages like Kotlin and Swift, property hooks simplify the creation of accessors and mutators, reducing boilerplate code and making the codebase cleaner and more maintainable.

Example:

class Foo
{
    private int $runs = 0;
 
    public function getRuns(): int { return $this->runs; }
 
    public function setRuns(int $runs): void
    {
      if ($runs <= 0) throw new Exception();
      $this->runs = $runs;
    }
}
 
$f = new Foo();
 
$f->setRuns($f->getRuns() + 1);

Describe alternatives you've considered
Implement support this language feature, in next or actual Eclipse version. If need help to test or something @zulus please let me know.

Additional context
Reference about this feature in this RFC: https://wiki.php.net/rfc/property-hooks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions