Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49882 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58210 invoked from network); 7 Oct 2010 07:25:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Oct 2010 07:25:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:37039] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/C9-06116-FC57DAC4 for ; Thu, 07 Oct 2010 03:25:03 -0400 Received: by iwn41 with SMTP id 41so536566iwn.29 for ; Thu, 07 Oct 2010 00:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; bh=kHfPpNn2PhG5uikgzjkUlXEDmPgIWT0GKzIbJXhuBpk=; b=D+PwacEpWp/iEICvh7Gl8VtcbXKskS/1UKOdSnV5QiZ650njxWlZaakcb/rPQZcswk QjouVFwJYUfXzIHxADDymJAxbHlYT8FrZ6uAwDi14Zemk3hnBk7vXFhQd6afDJtZXuwS Cf0gjSiUtjlG8ALrmfvluF0dX79t8fsgFiH0U= DomainKey-Signature: a=rsa-sha1; c=nofws; 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; b=E/qJaPABqzB+vA3guBoKI+v8aWLWuniGBdKT/vq+fzQZEfLPy46aFUQ8VvuOErUPzo w1xK0ePA1Rgfiz8JMutlLv8IXfwe/yc5IRUNntaOkRfPq5tJfQnb3tTUq3ntvW7E91C0 PljcQ+OxzMW+qvwx6vBvrryWxeY+FocIVVt5Q= MIME-Version: 1.0 Received: by 10.231.170.79 with SMTP id c15mr430019ibz.82.1286436298684; Thu, 07 Oct 2010 00:24:58 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.231.157.198 with HTTP; Thu, 7 Oct 2010 00:24:56 -0700 (PDT) In-Reply-To: References: Date: Thu, 7 Oct 2010 09:24:56 +0200 X-Google-Sender-Auth: 3eXDNVQspLDPiy27TvLch6FzVn4 Message-ID: To: Nathan Nobbe Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=0016e68f9dae9c6b8b049201ca96 Subject: Re: [PHP-DEV] Using child classes/interfaces as desired type hints From: info@tyrael.hu (Ferenc Kovacs) --0016e68f9dae9c6b8b049201ca96 Content-Type: text/plain; charset=UTF-8 On Thu, Oct 7, 2010 at 7:56 AM, Nathan Nobbe wrote: > Hi, > > Probly rehashing an old conversation here, but I'm wondering why the > following isn't supported > > abstract class AbstractServer {} > class ConcreteServer extends AbstractServer {} > > abstract class AbstractClient { > abstract function doStuff(AbstractServer $o); > } > > class ConcreteClient extends AbstractClient { > function doStuff(ConcreteServer $o) {} > } > ?> > > This results in a fatal > Fatal error: Declaration of ConcreteClient::doStuff() must be compatible > with that of AbstractClient::doStuff() in > /Users/quickshiftin/gitRepos/timberline/php-api-v15-client/testOverride.php > on line 11 > > I was reading a few posts from way back when > > http://marc.info/?t=107774904800001&r=1&w=2 > > yet still find myself wondering. I think it can be said here that if > there's a contract defined by AbstractClient::doStuff, that same contract > is > honored by ConcreteClient::doStuff. I also think changing the language to > support this notion wouldn't raise BC issues for the most part (at all?) > since at the moment you're forced to move to the lowest common denominator > in the tree, in this case > > class ConcreteClient extends AbstractClient { > function doStuff(AbstractServer $o) {} > } > > your feedback appreciated, > > -nathan > It was discussed recently: http://marc.info/?l=php-internals&m=128220433328115&w=2 Tyrael --0016e68f9dae9c6b8b049201ca96--