-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Properties (property hooks) composition #18391
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
Comments
Hi @SerafimArts. As the message says:
Conflict resolution of hooks in traits (meaning, declaring the same property in both trait and target, at least one of them with hooks) is not supported. This was explicitly mentioned in the RFC: https://wiki.php.net/rfc/property-hooks#interaction_with_traits
Hence, this is not a bug, and changing it would likely require an RFC. |
From the user's point of view, there is only one declaration in the code. An abstract property declaration is not a declaration, but a requirement for a declaration. Moreover, the implementation is already defined as a readonly field, not a property (hook). This leaves us with 2 problems (mistakes?):
|
P.S. I do not argue that it does not work correctly. It just seems that this functionality can be implemented without RFC in 8.5, since semantically (depending on the RFC interpretation), fixing this behavior falls within the scope of this same RFC. Since "technically" there are no real property declarations in code above |
Description
There is code that implements behavior other than method declarations:
Methods Behaviour
Methods Result
See: https://3v4l.org/O5lIe#v8.4.6
// Nothing: OK
Properties Behaviour
Properties Result
See: https://3v4l.org/tM9i5#v8.4.6
PHP Version
PHP 8.4.5 (linux, windows); PHP 8.4.6 (from 3v4l.org)
Operating System
Windows, Ubuntu 20.04, Ubuntu 22.04
The text was updated successfully, but these errors were encountered: