You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is considered an error now, but should be possible, the same way it works with methods, so that also the new property hooks would work.
trait TestTrait {
publicint$Var = 1;
publicfunctionFunc():int {return1;}
}
class TestClass {
use TestTrait;
publicint$Var = 2; // this is not allowedpublicfunctionFunc():int {return2;} // this is ok
}
The text was updated successfully, but these errors were encountered:
Properties are considered incompatible if they differ in their definition. This means, they differ in the applied modifiers (static, public, protected, private) or their initial value.
I don't really see a technical reason why it needs to be this way, but since this was a community decision, changing it will require an RFC.
I understand that with hooks shadowing of trait properties becomes more reasonable. That said, I believe it's a complex enough topic to warrant an RFC. For example, it's unclear whether the shadowing property adopts unlisted hooks from the trait, or whether it needs to repeat the hook in full.
Description
This is considered an error now, but should be possible, the same way it works with methods, so that also the new property hooks would work.
The text was updated successfully, but these errors were encountered: