Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60456 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19906 invoked from network); 5 May 2012 09:26:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 May 2012 09:26:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.215.42 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.215.42 mail-lpp01m010-f42.google.com Received: from [209.85.215.42] ([209.85.215.42:63510] helo=mail-lpp01m010-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/D1-18322-952F4AF4 for ; Sat, 05 May 2012 05:26:50 -0400 Received: by lahd3 with SMTP id d3so1343192lah.29 for ; Sat, 05 May 2012 02:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=iRNJoQaCGfzJstJIFFB3NqU4Wywd1EimB4a8f1Vgrm8=; b=ZxN4y4LZjkaVREN7La8FNSp5QH0uQk3xSaUMoVuYhpQ1bLeW3waKIP/rzVKBkyqHS5 FBjCaQLGE2hDrBTv0MBh+daPvCKBxiIRIheh30V66KSA5sENYsKUtUE7ATbXp64MGJaV ntUC/qHyo6SBcA0LWZTlgNHNUcdQ341KrUDWjQuQE2D0Zdm75BCOVqPhcw1umo2RIh/X WOuhkLJjpT4w1soR4KcnQ8v/28YmQqW8sVzPbsnghM/9Kr/g30h5v5WFPsMUwztExWuj KotZH7QXsgHXOFanD7tgUlAEF3CmqjaNbjT+tnRvIbPL4XaNBqbwDKuibxF2Rn7huU85 HZkg== MIME-Version: 1.0 Received: by 10.112.49.100 with SMTP id t4mr4307208lbn.10.1336210007142; Sat, 05 May 2012 02:26:47 -0700 (PDT) Received: by 10.152.1.196 with HTTP; Sat, 5 May 2012 02:26:47 -0700 (PDT) In-Reply-To: <2F98BD6D-618A-4AC2-A8F3-F43F4EE59CCA@stefan-marr.de> References: <9652E99E-97FF-4D62-99CE-EE3B5E27503E@macvicar.net> <2F98BD6D-618A-4AC2-A8F3-F43F4EE59CCA@stefan-marr.de> Date: Sat, 5 May 2012 11:26:47 +0200 Message-ID: To: Stefan Marr Cc: Hannes Magnusson , Scott MacVicar , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Enforcing final in traits From: nikita.ppv@googlemail.com (Nikita Popov) On Sat, May 5, 2012 at 1:38 AM, Stefan Marr wrote: > > On 04 May 2012, at 21:46, Hannes Magnusson wrote: > >> On Fri, May 4, 2012 at 8:30 PM, Scott MacVicar wrote: >>> This caused a few bugs for us / confusion. The final keyword is accepted inside a trait but it the class also defines a method without the final keyword this takes precedence. > > The methods in the class always take precedency. > > However, the final keyword might just be something I overlooked. > It sounds sensible that if the final is not explicitly removed during composition to treat it as what final was meant for and check it against the methods defined in the class body as well. > > Scott, could you elaborate a bit of the use case of final in a trait? Here is an example: http://stackoverflow.com/questions/7104957/building-a-singleton-trait-with-php-5-4 Not the best things to use traits for, but probably something people *will* try to do. Nikita