Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97486 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 20650 invoked from network); 29 Dec 2016 14:44:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Dec 2016 14:44:14 -0000 Authentication-Results: pb1.pair.com smtp.mail=ocramius@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ocramius@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.180 as permitted sender) X-PHP-List-Original-Sender: ocramius@gmail.com X-Host-Fingerprint: 209.85.210.180 mail-wj0-f180.google.com Received: from [209.85.210.180] ([209.85.210.180:35072] helo=mail-wj0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/15-04761-D3125685 for ; Thu, 29 Dec 2016 09:44:13 -0500 Received: by mail-wj0-f180.google.com with SMTP id v7so360016657wjy.2 for ; Thu, 29 Dec 2016 06:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=LSd1CkMBbTYMziK4HcZ/cHCVf1UziS97T6Vs8lEdGm8=; b=gK1rYMZiAKwNNDq4RblFnJ5cIZuyrxEaghj5NO2tH604L9DtLPIghcM0W4uVwQPQ2M KR3qaO0SvtIzdveKxAv/mhNfIorJUZwe0Tcs9Fj58w3YGpMUZNgboscUeUWEep7zNfZs 02m00jOkwaCJ47tJwk5lP1DuiCAAD4r9+ExjiYhS46/zUV7re0YyKE/QbpyY28Q2LmK4 j4yfFT7bj5MOs8awByAdgCis1NJoXMvDgvqncAD0fGDNS0g3JKuot249ZXj5Ugk2MLE1 Ptt/SpgYdmL4C99ogtrD5f9yLxsJyxAXA6bMxAzbGMsKVYrufEbnDOmGsN/sVxHs1f65 B7WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=LSd1CkMBbTYMziK4HcZ/cHCVf1UziS97T6Vs8lEdGm8=; b=pUCFUigRR5YhGZ7LGkb0YYE9SuNJ5yS0BTGWyoiplX9dLcLrzymGms1YddUz2dWxI/ T4UB5ocYT+o8/Q2vMiyEldff8BtINSQSAZIzG+Zjn08IcVM2CxiO8bSYif8NCfaH/ClR d8g+MBC1FSUpbzOxvQTxA4qdaZfCQHMk0zNj+4GV6KNljdA8MFK76G3xU/LeceY2IbPK ITlOh9wlDLzy0Ef7dXb2w6ftS3CLv4XBLrTINgpjpdO9Fe+fdLvBJgU2wcgETbOxKCwr c+WFFGlBF7pk0QurKShiX4jnd2MJ5M+4MaLoGL8PDm1BHNEENsmrpPAeyqf1gMmxD1mx boPA== X-Gm-Message-State: AIkVDXLx9ty/F4M1g68taOOcAqSrxKGVgJBRmDpGo0+aohnSwwTrmlC4la0VzboQtC8ZFU9ElHaX06DrLoec0A== X-Received: by 10.194.96.135 with SMTP id ds7mr36902972wjb.29.1483022650389; Thu, 29 Dec 2016 06:44:10 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.173.106 with HTTP; Thu, 29 Dec 2016 06:43:49 -0800 (PST) In-Reply-To: <4a5e4cd4-9414-ebef-d5a7-739bb4df34dd@rochette.cc> References: <2aecc3f2-5e9d-907f-029b-5c60eb134b33@rochette.cc> <4a5e4cd4-9414-ebef-d5a7-739bb4df34dd@rochette.cc> Date: Thu, 29 Dec 2016 15:43:49 +0100 Message-ID: To: Mathieu Rochette Cc: PHP internals Content-Type: multipart/alternative; boundary=089e0103e04e453e8a0544cd1e67 Subject: Re: [PHP-DEV] Decorator classes From: ocramius@gmail.com (Marco Pivetta) --089e0103e04e453e8a0544cd1e67 Content-Type: text/plain; charset=UTF-8 On Thu, Dec 29, 2016 at 3:27 PM, Mathieu Rochette wrote: > yeah it's mostly syntactic sugar, I think it would encourage developer to > use this pattern instead of inheritance when appropriate. > I also think that most of the time using the decorator pattern helps > following the single responsibility principle > Meh, just `final` as much as possible, combined with interfaces :-) > also, this would add one more benefit : methods that are not override > could probably be optimized by the PHP engine (avoid one userland proxy > call) > That's probably something that opcache could do anyway. Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ --089e0103e04e453e8a0544cd1e67--