views:

47

answers:

1

When I call self::$parameter = 1; the __set is not called.

Is there a way to workaround?

+4  A: 

From the manual:

Property overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods should not be declared static. As of PHP 5.3.0, a warning is issued if one of the magic overloading methods is declared static.

So, I'm afraid not.

deceze
Do you think it reasonable?
@user Let's say that I haven't come across a situation where I'd have needed this functionality, so I don't mind either way. It certainly *is* a missing feature though, and it's odd that there's a `__callStatic` function but no `__setStatic` function. It just goes to show once more that OO was an afterthought in PHP. Actually, modern PHP was an afterthought in PHP. ;)
deceze