type hint throwing exceptions?
Posted: Sat Oct 04, 2008 4:42 pm
Is it possible to have PHP throw an exception when a type hint fails? It seems to only raise an error and ideally I'd like to catch an exception.
I've Googled and found some interesting projects like PHPTypeSafe as well as a similar class on PHP comments but preferably I'd like to just flip a switch or upgrade to a newer version of PHP that supported type hinting with exceptions???
EDIT | I believe I could catch the error by overriding the error reporting method (which I have already done) and throw the exception there...but again I'd prefer if there was a PHP version which just threw exceptions by default.
I've Googled and found some interesting projects like PHPTypeSafe as well as a similar class on PHP comments but preferably I'd like to just flip a switch or upgrade to a newer version of PHP that supported type hinting with exceptions???
EDIT | I believe I could catch the error by overriding the error reporting method (which I have already done) and throw the exception there...but again I'd prefer if there was a PHP version which just threw exceptions by default.