|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-08-09 07:42 UTC] johannes@php.net
[2007-08-10 21:19 UTC] mattsch at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 04:00:01 2025 UTC |
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.