Hacker News new | comments | show | ask | jobs | submit login

You can use this:

But yeah, some syntactic sugar would sure be nice. I'd like to see this in a future version of PHP...


It doesn't even have to be 'sugar' like that.


It could look at the registered methods, then scan for properties of that name that would be closures, then fall back to __call. You could add this to __call with __set() checks for assigned values being closures, but it's rather ugly to have to do that for all class definitions.

Applications are open for YC Winter 2018

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact