note 52705 deleted from language.oop5.typehinting by derick

From: Date: Sat, 06 Aug 2005 17:55:24 +0000
Subject: note 52705 deleted from language.oop5.typehinting by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-93171@lists.php.net to get a copy of this message
Note Submitter: ---- If wrong object is given, error points to method definition instead of place where method has been called. Because of that type hinting is not really useful. Instead use: <?php function($foo) { assert('$foo instanceof ClassRequired'); // ... } ?> and use your custom error handler that dumps debug_backtrace() -- this will allow you to find caller that passes wrong object. Works in PHP4 as well.

« previous php.notes (#93171) next »