eloquent / typhoon

Simple, flexible type-checking for PHP.
MIT License
5 stars 0 forks source link

Check command should expect static call on __wakeup() type methods #89

Closed ezzatron closed 11 years ago

jmalloc commented 11 years ago

You'll also need to ignore the call on __destruct if you're not already, because if the constructor args are invalid $this->typeCheck will never get assigned.

jmalloc commented 11 years ago

And when I say ignore, I mean truly ignore, not just expect static call - because throwing in a destructor is not valid.

jmalloc commented 11 years ago

So thinking about this some more, a destructor being called by PHP internals is NEVER going to pass parameters, and hence it will never throw and everything is OK. It's possible that someone will explicitly call __destruct inside another class's destructor, but this case is no different to calling any other method that may throw. That said, it still feels dirty being forced to add code that is especially designed to throw to a destructor!

Anyway, I think if you decide that the check should ignore them, it should probably go so far as to warn against it.

ezzatron commented 11 years ago

Yeah, mkay.