Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:42169 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43739 invoked from network); 8 Dec 2008 17:12:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Dec 2008 17:12:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:35141] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D0/AB-21579-F655D394 for ; Mon, 08 Dec 2008 12:12:17 -0500 Received: from MBOERGER-ZRH (unknown [193.142.125.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 2352111F870; Mon, 8 Dec 2008 18:12:13 +0100 (CET) Date: Mon, 8 Dec 2008 18:12:08 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <843441483.20081208181208@marcus-boerger.de> To: Rodrigo Saboya CC: internals@lists.php.net In-Reply-To: References: <493D425C.6010104@zend.com> <938983775.20081208172740@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Problem with (namespaced) code extending ReflectionProperty - possible bug? From: helly@php.net (Marcus Boerger) Hello Rodrigo, Monday, December 8, 2008, 5:48:00 PM, you wrote: >> Which reminds me that we still have no way to do that in userland. >> In userland you cannot write: >> function foo(Object $bla = NULL). >> The missing part is 'Object' as a type hint. I once long ago suggested >> using 'class' as in 'any class member'. But people felt it wouldn't be >> self explanatory enough. And unfortunately we cannot use 'Object' for >> obvious reasons. We simply cannot turn that into a reserved word not >> can we expect no one to have a class named Object already. >> >> So my suggestion holds: Let's add type hint 'class' to allow hints for >> objects. >> >> marcus >> >>>> This is my test code: >>>> ---- snip ---- >>>> >>> class PropertyReflection extends ReflectionProperty { >>>> public function getValue(stdclass $object) {} >>>> } >>>> ?> >> >>> Use public function getValue($object = null) {} instead. >>> -- >>> Stanislav Malyshev, Zend Software Architect >>> stas@zend.com http://www.zend.com/ >>> (408)253-8829 MSN: stas@zend.com >> >> >> >> >> Best regards, >> Marcus >> > I don't think having a Object class built in is such a big issue with > namespaces around. Anyone using object type-hinting should have a clue. I am not speaking of a built-in object class. Because that is not what the internal parsing does. The internal parsing checks whether a passed-in argument is an instance of any class or not. And we can never have one base class. The engine simply would not allow that becasue it can take instances created from classes provided by different back-ends including other lanugae runtimes. > -- > Rodrigo Saboya Best regards, Marcus