Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95421 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33717 invoked from network); 23 Aug 2016 18:20:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Aug 2016 18:20:08 -0000 Authentication-Results: pb1.pair.com header.from=lauri.kentta@gmail.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=lauri.kentta@gmail.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain gmail.com does not designate 188.117.41.47 as permitted sender) X-PHP-List-Original-Sender: lauri.kentta@gmail.com X-Host-Fingerprint: 188.117.41.47 mailgateway.locotech.fi Linux 2.6 Received: from [188.117.41.47] ([188.117.41.47:40929] helo=mailgateway.locotech.fi) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/04-10212-6D39CB75 for ; Tue, 23 Aug 2016 14:20:07 -0400 Received: from localhost (mailgateway [127.0.0.1]) by mailgateway.locotech.fi (Postfix) with ESMTP id 2F8E6A36571; Tue, 23 Aug 2016 21:20:03 +0300 (EEST) X-Virus-Scanned: amavisd-new at locotech.fi X-Spam-Flag: NO X-Spam-Score: -1.998 X-Spam-Level: X-Spam-Status: No, score=-1.998 tagged_above=-9998 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9] autolearn=no autolearn_force=no Received: from mailgateway.locotech.fi ([127.0.0.1]) by localhost (mailgateway.locotech.fi [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5xxk42iMbopz; Tue, 23 Aug 2016 21:19:48 +0300 (EEST) Received: from posti.fimnet.fi (posti.fimnet.fi [172.16.1.44]) by mailgateway.locotech.fi (Postfix) with ESMTP id BA8BFA3653D; Tue, 23 Aug 2016 21:19:47 +0300 (EEST) Received: from k-piste.dy.fi (unknown [172.16.1.39]) by posti.fimnet.fi (Postfix) with ESMTPSA id 83A00102387; Tue, 23 Aug 2016 21:19:47 +0300 (EEST) Received: from localhost.localdomain ([::1] helo=k-piste.dy.fi) by k-piste.dy.fi with esmtp (Exim 4.87) (envelope-from ) id 1bcGIZ-0003Xo-88; Tue, 23 Aug 2016 21:19:43 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 23 Aug 2016 21:19:43 +0300 To: Alexander Lisachenko Cc: Julien Pauli , "Christoph M. Becker" , Levi Morrison , Rowan Collins , PHP internals list In-Reply-To: References: <031a2bf1-1996-1144-2b85-e10a40be9514@gmail.com> <7b81c830-1d05-a4ac-4713-1bb67cbec12c@gmx.de> Message-ID: X-Sender: lauri.kentta@gmail.com User-Agent: Roundcube Webmail/1.2.1 Subject: Re: [PHP-DEV] BC break: ReflectionMethod::invoke() expects parameter1to be object, string given From: lauri.kentta@gmail.com (=?UTF-8?Q?Lauri_Kentt=C3=A4?=) On 2016-08-23 18:45, Alexander Lisachenko wrote: > 2016-08-23 18:05 GMT+03:00 Lauri Kenttä : > >> Could you do it without reflection, then? I don't think so. >> Thus, I think your "use case" is broken by design. > > FYI: This use case is used by Go! AOP Framework and AspectMock > libraries that can mock even static methods in the classes, allowing > testing legacy code and singletons. If you are interested in how it > works, then you could look at this example: https://3v4l.org/TbS5V Ok, so I was wrong about it being impossible. Sorry about that. However, if you look at that example, does it look good and solid? It looks more like a weird hack to me. So I stand by my words: if there's a legitimate use for calling parent static methods with child context, there should also be simpler ways than reflection or strange closure hacks for doing it. There should be a syntax like ChildClass::ParentClass::method(), or at least call_user_func(["ChildClass", "ParentClass", "method"]), or call_user_func(["ChildClass", "ParentClass::method"]), since the ParentClass can be considered a qualifier for the method name. -- Lauri Kenttä