Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65524 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67157 invoked from network); 31 Jan 2013 02:36:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2013 02:36:42 -0000 Authentication-Results: pb1.pair.com header.from=swhitemanlistens-software@cypressintegrated.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=swhitemanlistens-software@cypressintegrated.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain cypressintegrated.com designates 173.1.104.101 as permitted sender) X-PHP-List-Original-Sender: swhitemanlistens-software@cypressintegrated.com X-Host-Fingerprint: 173.1.104.101 rproxy2-b-iv.figureone.com Windows 2000 SP2+, XP SP1 (seldom 98 4.10.2222) Received: from [173.1.104.101] ([173.1.104.101:52573] helo=rproxy2-b-iv.figureone.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8E/CC-09318-8B8D9015 for ; Wed, 30 Jan 2013 21:36:41 -0500 Received: from localhost ([216.220.114.66]) by rproxy2-b-iv.figureone.com (Brand New Heavy v1.0) with ASMTP id QDP46137 for ; Wed, 30 Jan 2013 18:36:37 -0800 Date: Wed, 30 Jan 2013 21:36:32 -0500 Reply-To: Sanford Whiteman X-Priority: 3 (Normal) Message-ID: <773658351.20130130213632@cypressintegrated.com> To: Alan Knowles In-Reply-To: <5109A834.6070503@roojs.com> References: <1460659e-237d-4c7c-8cfa-523ec857d646@email.android.com> <51074873.5090600@roojs.com> <51076233.2040507@sugarcrm.com> <5109A834.6070503@roojs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] Deprecate and remove calls from incompatible context (example of real usage that will break) From: swhitemanlistens-software@cypressintegrated.com (Sanford Whiteman) >> If addPreserveText() uses anything from Footer, it should not be called >> from TextRun, but if it does not, it should be in Section. > No, if it was in Section, all the child classes would have to override > it and throw errors. That results in quite a bit of pointless > boilerplate code to solve a problem that has just been created by this > change (and really the original E_STRICT one). If the code path results > in a call to addPreserveText in the other classes, it's a pretty serious > error, and we need to catch that quick... Not going to sound off on other subtopics in this thread, about which my feelings are mixed, but your note here is pretty strange. I agree with Stas and others that you are already using an antipattern, so if a major justification is that you need to manually authorize a subclass to call the super, you don't need to override and throw in every possible subclass, how about something like this instead to "whitelist": interface preservable { public function addPreserveText(); } abstract class section { public function addPreserveText() { if (!isset(class_implements($this)["preservable"])) throw new Exception("can't call super from disallowed subclass"); echo "ready to rumble"; } } class footer extends section implements preservable {} class header extends section {} $myfoot = new footer(); $myfoot->addPreserveText(); // ready to rumble $myhead = new header(); $myhead->addPreserveText(); // error -- Sandy