Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92480 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7820 invoked from network); 19 Apr 2016 18:13:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Apr 2016 18:13:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.180 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.192.180 mail-pf0-f180.google.com Received: from [209.85.192.180] ([209.85.192.180:33179] helo=mail-pf0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 63/63-22821-76576175 for ; Tue, 19 Apr 2016 14:13:59 -0400 Received: by mail-pf0-f180.google.com with SMTP id 184so9253007pff.0 for ; Tue, 19 Apr 2016 11:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=ZTSvBSvos7dgTYqEkRrozYVwgrT6dFYThT70pmnl6TM=; b=sh9O0zpl1pGei36B+4qrG2V6KhnhWBpoa2XxHgVbmneU7jNozb08rhWkCsstzQ9J5g uHSjVu/JE6n9cYWxkpijK3rO8DPN7gPxgstYVLEaVyKK6yENtCofZWtbiwpKbniSbTJb bbXDEx8P9/OPjy2y55WaH9pf4A7Ea6HZ1D22vnu7Zxdq/4DhhB64KLnIrFZDaqnS85SL UP0XV/ABkFX4enpkMamaPnuQujumqFcZV3BZYE3qNKnB2vsx88oMNLK6DQ3cGFNt7pQ8 77WiVVFZfAdbDvrXhAHx71XICbeS9OIIt6OYX9fPvlIuJeZfE6Csvg4rWSgUPJb0s9TS o+lA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=ZTSvBSvos7dgTYqEkRrozYVwgrT6dFYThT70pmnl6TM=; b=HIub1CZLXxcRmjbo26S84qp1XLpIi/LujRmCwsqnshYZzCh6eNeMDLPZrzonz4A7sF dm1PZglLWg+BJmTihvr4Zqtrd3/2s/8Xx+FlGPMUCiFI+NI3hdR9azVyeKwGGWBu7bcL VwyKxq6nrvv6vMYCzqX6ZaWxLhye3plqmH+tzfyoNTn9wMWpSceIqP5B2ddszYnmT15p 4ADvLeRUXlF46lKd6yUgsqmbmQ1mlb/BWG5lgdd9G3h8r07ZynViClTZSUugkNMvHAsd dhmZwFD/7NJiG0FJurUKpgj24YbBaU6ygv8B0O5E8HGl8TOUPa1GqJiuS08zEry7CU2P fGmw== X-Gm-Message-State: AOPr4FXRDUna37YzLky5qIFDUMPnCPXiorYhWby/ECFbHtDeOoDIpPCMvbBVEMuaafNhqQ== X-Received: by 10.98.93.142 with SMTP id n14mr5885973pfj.37.1461089636506; Tue, 19 Apr 2016 11:13:56 -0700 (PDT) Received: from Stas-Air.local (76-220-46-95.lightspeed.sntcca.sbcglobal.net. [76.220.46.95]) by smtp.gmail.com with ESMTPSA id s64sm92486752pfi.77.2016.04.19.11.13.54 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 19 Apr 2016 11:13:55 -0700 (PDT) To: bishop@php.net References: <571581C7.7010901@gmail.com> <571589AF.3090502@gmail.com> Cc: PHP internals Message-ID: <5716755E.1040807@gmail.com> Date: Tue, 19 Apr 2016 11:13:50 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] Catching Multiple Exception Types From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > namespace Application; > function log(Eloquent\Collection | Haldayne\Map $entity) { > $logger->log($entity->toArray()); > } This is bad design. It assumes that two completely unrelated classes have the same function and it means the same. If it's indeed true, we have a way to express it. It's called "interface". If it's not true, and you are just duck-typing, you should not pretend you use strict types, and drop types completely. You shouldn't try yo sit on both chairs at the same time and pretend you're using strict typing while in fact duck-typing. > "Ugh, this is much easier in multi-catch. If only functions took > multiple types, this would be much simpler to write." And it would be completely wrong, abuse of typing. If you mean to say "anything that has log method", you should either have interface or just get rid of the strictness and duck-type it and rely on PHP to throw exception if anything happens. Otherwise it is just a sloppy design. -- Stas Malyshev smalyshev@gmail.com