Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104497 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 88650 invoked from network); 21 Feb 2019 23:24:59 -0000 Received: from unknown (HELO mail-oi1-f176.google.com) (209.85.167.176) by pb1.pair.com with SMTP; 21 Feb 2019 23:24:59 -0000 Received: by mail-oi1-f176.google.com with SMTP id e7so2447457oia.8 for ; Thu, 21 Feb 2019 12:10:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NjZLaPhuYCMQ6szKQ4CHLu2Dk6Zz1b8VMhpZ/ThhyB0=; b=htYAyqIl9i9ah5AowckP3N2+dV1SCp7DxjnNfyWdXx+3yljWPHNt1vf6tNFRZp6M/s PisoGtvD7aK3SCYFdpqq45JVdeRD+vtDerP3zQ/EJ+UsK3VRCk4LOVC9tkd65k/wU9Aq V1ieDgU5oe/Hw4bNWsyLiJsvpjJZEwjr6nHn572xde496lJdTcyRsPoow97H6ZEDGyRh WXgXbs+RstaOrbhO8P18Q4+B1NIdfaV9M9OxBysREVl+/VGnDab6awsekYgrpF4IVnQA m0s5dNanWPcZipaFuqv9XDa7XU1NH1a83FJ/cPlDl79SV4v6t5EfXvOA5ML5asrL7ehj so6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NjZLaPhuYCMQ6szKQ4CHLu2Dk6Zz1b8VMhpZ/ThhyB0=; b=bmIxHY7zxMVwj6lfShQj0n9tZtsZql3aA3IrvfgQCjIEtXLzhVpihTPjNJ3BtTmFv0 ewarF+1w35CsIhD48R9WhpUfuqF3NgLlU2K9EAVcq7/JUxpLaaq3imvJSxxpdQemdaWQ hCSVJNfN8assYTv6yf7ZplCnvTxZV+eudyGR7wKxRpnVXOZlAZEQBWWLz1xf8FsLNhId FsBqfhMwppslAWigefeP08Xh48SXpWWmWWs/GPnyPCHjJeezNmYBothxGSLdwoj5zy3m FjG57elxfkjr6yzdwwyv/JrVnHuNITG3W1RND03xaMhZRTuSqrSc7GEj7bRj2mIOxRrm ptbQ== X-Gm-Message-State: AHQUAubHAmpiNAxluV0B9ti1ewwN/xZBuD/u9Smadd65W9XvPv4gP/57 LjtNwYkp/srJ75Lg/wrJGttMJNx8lCd7WQyU1Jw= X-Google-Smtp-Source: AHgI3IZzNzUxo1S+hTifoTDYxsAd037Wsd8IvvmL/IPbjjje5uVTPuEZGChOXkN9UPQ5L2E2kBAgqG2KLz2QUSzf6zY= X-Received: by 2002:aca:5456:: with SMTP id i83mr205779oib.106.1550779253014; Thu, 21 Feb 2019 12:00:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 21 Feb 2019 21:00:41 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: multipart/alternative; boundary="0000000000008043ab05826cee36" Subject: Re: [PHP-DEV] Optional catch binding From: franssen.roland@gmail.com (Roland Franssen) --0000000000008043ab05826cee36 Content-Type: text/plain; charset="UTF-8" > it produces a warning - and it should, since what is being done is what usually should not be done I didn't want to turn this into an "error handling best practices" discussion. Exceptions might not be recommended to use for flow-control, yet this is possible today and really depends on the exception type itself and it's fallback handling: try { $o = $container->get('id'); } catch (ServiceNotFoundException) { $o = $container->get('other_id'); } Leaving out the $e variable makes the lack of error handler more explicit. Roland, Op do 21 feb. 2019 om 20:35 schreef Stanislav Malyshev : > Hi! > > > Allthough global exception catching might not be a good practice per se, > I > > don't see a real reason to forbid it. However, these are 2 independent > > features that can be voted for I guess. > > It's not forbidden now. But there's no reason to encourage it and > develop a dedicated syntax for it. Current syntax works just fine. Yes, > it produces a warning - and it should, since what is being done is what > usually should not be done - ignoring exceptions. > > -- > Stas Malyshev > smalyshev@gmail.com > --0000000000008043ab05826cee36--