ID: 42251 Updated by: [EMAIL PROTECTED] Reported By: mattsch at gmail dot com -Status: Open +Status: Bogus Bug Type: Feature/Change Request Operating System: Gentoo Linux PHP Version: 5.2.4RC1 New Comment:
While the current Exception system was designed it was decided not having that syntax. Please search the archives of the internals list for more. Previous Comments: ------------------------------------------------------------------------ [2007-08-08 22:40:48] mattsch at gmail dot com Description: ------------ It just came to my attention today that there is a function-based Exception syntax in Java that would be very beneficial to have in php: Example in Java: public boolean foo(String bar) throws Exception { //Run commands that may throw exceptions } Proposal in PHP: public function foo($bar) throws Exception { //Run commands that may throw exceptions } This will ensure that the function is only called within a try/catch block and if it's not, it can throw an uncaught exception or throw an error of some sort. This would be very helpful because when someone who didn't develop the function (a different developer) trys to use the function outside of a try/catch block, he or she will be warned immediately. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42251&edit=1