Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.4 future release and support to property hooks #279

Open
peregrinodeti opened this issue Jun 26, 2024 · 1 comment
Open

PHP 8.4 future release and support to property hooks #279

peregrinodeti opened this issue Jun 26, 2024 · 1 comment

Comments

@peregrinodeti
Copy link

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

@peregrinodeti
Copy link
Author

Well, PHP 8.4 Alpha 1 was released last week. I tried to use it in Eclipse PDT 2024-06, but when you go to the Eclipse IDE menu: Window -> Preferences -> Installed PHPs and try to point to the new PHP 8.4, the IDE throws an exception (Selected location doesn't refer to a valid PHP executable). The problem is not the location of the file, but the new version of PHP. I test on Windows 11. PHP 8.3.9 works fine when using the same directory name; in my case, c:\php. In both cases, the PHP executable stays in the same directory, but 8.4 doesn't work at the IDE, the IDE does not recognize the new version of the PHP executable.

If not difficult, I suggest a new IDE UI option to generate property hooks, like get and set. When you click on the source code and a sub-menu appears, go to the source option and put the new option: "Property Hooks Get and Set", for example. 

@zulus If you need any help to testing this new feature, let me know. And thanks for your great work at IDE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant