Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48826 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66045 invoked from network); 18 Jun 2010 14:13:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jun 2010 14:13:31 -0000 Authentication-Results: pb1.pair.com header.from=cyberspice@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=cyberspice@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.158.45.55 as permitted sender) X-PHP-List-Original-Sender: cyberspice@php.net X-Host-Fingerprint: 85.158.45.55 elf.thecommune.org.uk Linux 2.4/2.6 Received: from [85.158.45.55] ([85.158.45.55:37248] helo=elf.thecommune.org.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/D0-59924-A0F7B1C4 for ; Fri, 18 Jun 2010 10:13:31 -0400 Received: from localhost ([127.0.0.1] helo=[IPv6:::1] ident=1002) by elf.thecommune.org.uk with esmtp (Exim 4.42) id 1OPcSa-0008GJ-Kv; Fri, 18 Jun 2010 15:22:20 +0100 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii In-Reply-To: <4C1A7400.6010800@sugarcrm.com> Date: Fri, 18 Jun 2010 15:13:21 +0100 Cc: Christian Kaps , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <16FA8F9A-E36B-4057-BBCC-D6CC9C8D6D8B@php.net> References: <4C1A6B47.4060702@mohiva.com> <4C1A7400.6010800@sugarcrm.com> To: Stas Malyshev X-Mailer: Apple Mail (2.1081) X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Rcpt-To: smalyshev@sugarcrm.com, christian.kaps@mohiva.com, internals@lists.php.net X-SA-Exim-Mail-From: cyberspice@php.net X-SA-Exim-Scanned: No (on elf.thecommune.org.uk); SAEximRunCond expanded to false Subject: Re: [PHP-DEV] Type hinting From: cyberspice@php.net (Melanie Rhianna Lewis) On 17 Jun 2010, at 20:14, Stas Malyshev wrote: > Hi! >=20 >> I know the discussion is about scalar type hints. But what is with a >> object type hint as base for all objects? >=20 > When it makes sense to accept any object, regardless of the class, but = not other types? I wonder if it's really a common use-case. Its useful in some patterns. For example suppose you have a pattern = where a class wraps another class. The wrapped class could be *any* = class if you're modify the behaviour of some default methods (say doing = something like a decorator pattern). Having a type hint that recognises = object vs non objects is useful. Melanie