Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55490 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 28768 invoked from network); 17 Sep 2011 20:28:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2011 20:28:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:39286] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 88/A8-05466-9D2057E4 for ; Sat, 17 Sep 2011 16:28:10 -0400 Received: by bkar4 with SMTP id r4so4311065bka.29 for ; Sat, 17 Sep 2011 13:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=vwjtbhtW1/0CE3TODwUyrO7dKgfi+OfXLUBFoYD1BmQ=; b=CjpHKoFMOh3zflb0HSYnCRL9QnpZhU8N4mSd4gfDeMueIQDajcIkcRvvQdrvVg2gNg pk91MQKKHrveZPmFqrG4z0PX/Hm75p6CYPNKQ6MOT0qfBI2aeUxqtngIzM+wugFAs17M fGwIZFmX211sxi80cQVRpRkkRhKznNKm0IFMQ= MIME-Version: 1.0 Received: by 10.204.141.147 with SMTP id m19mr502601bku.339.1316291286391; Sat, 17 Sep 2011 13:28:06 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.59.68 with HTTP; Sat, 17 Sep 2011 13:28:06 -0700 (PDT) In-Reply-To: <4E74E22F.1070203@sugarcrm.com> References: <4E74E22F.1070203@sugarcrm.com> Date: Sat, 17 Sep 2011 22:28:06 +0200 X-Google-Sender-Auth: 2tIlkxMs0jV85H7Otxrmzqw_6pw Message-ID: To: Stas Malyshev Cc: Laruence , "devis@lucato.it" , "internals@lists.php.net" , "RQuadling@gmail.com" , Nikita Popov Content-Type: multipart/alternative; boundary=0015174789088bdd6604ad28f251 Subject: Re: [PHP-DEV] __constructor parameter limitations. From: colder@php.net (Etienne Kneuss) --0015174789088bdd6604ad28f251 Content-Type: text/plain; charset=UTF-8 On Sat, Sep 17, 2011 at 20:08, Stas Malyshev wrote: > Hi! > > On Sat, Sep 17, 2011 at 17:08, Laruence wrote: >> >>> class A { public function init($a, $b) { } } >>>> >>>> class B extends A { public function init($a) { } } >>>> >>>> => PHP Strict Standards: Declaration of B::init() should be compatible >>>> >>> with >>> >>>> that of A::init() >>>> >>> do you know any reason for this? >>> >>> >> The reason for this is simply that B must act like A since every B object >> is >> also an object of A. >> > > This is not a real reason, it's just repeating it. All B is saying in fact > "I'm going to ignore everything but the first parameter", and there's no > real reason not to allow it to do that. There's no "act" that makes B > incompatible with A here, this warning is completely useless. > Right, In this very specific case the error should not be outputted, the check could be refined to let that pass. Just it it may be refined to handle contravariant typehints correctly > > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > -- Etienne Kneuss http://www.colder.ch --0015174789088bdd6604ad28f251--