From: mattsch at gmail dot com Operating system: Gentoo Linux PHP version: 5.2.4RC1 PHP Bug Type: Feature/Change Request Bug description: Add functionName throws Exception syntax
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 bug report at http://bugs.php.net/?id=42251&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42251&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42251&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42251&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42251&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42251&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42251&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=42251&r=needscript Try newer version: http://bugs.php.net/fix.php?id=42251&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42251&r=support Expected behavior: http://bugs.php.net/fix.php?id=42251&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42251&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42251&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42251&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42251&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42251&r=dst IIS Stability: http://bugs.php.net/fix.php?id=42251&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42251&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42251&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42251&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=42251&r=mysqlcfg