Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60083 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4757 invoked from network); 17 Apr 2012 15:20:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 15:20:30 -0000 X-Host-Fingerprint: 208.107.13.98 host-98-13-107-208.midco.net Date: Tue, 17 Apr 2012 11:20:29 -0400 Received: from [208.107.13.98] ([208.107.13.98:25454] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/66-03996-D3A8D8F4 for ; Tue, 17 Apr 2012 11:20:29 -0400 Message-ID: <28.66.03996.D3A8D8F4@pb1.pair.com> To: internals@lists.php.net References: <4F89D4F1.8070009@ralphschindler.com> <4F8D843D.8070706@ralphschindler.com> User-Agent: slrn/pre1.0.0-18 (Linux) X-Posted-By: 208.107.13.98 Subject: Re: [PHP-DEV] New Feature: Fully qualified class name resolution as scalar with class keyword From: weierophinney@php.net (Matthew Weier O'Phinney) On 2012-04-17, Ralph Schindler wrote: > Hi Nikita, > > > A quick note on the patch: As the class name is compile-time > > resolvable it should in my eyes also be available as a > > `static_scalar`, so that it can be used in initialization lists: > > > > public function doFoo($withClass = ABC::class) { > > new $withClass; // or whatever > > } > > > > To be available as both a `static_scalar` and a general `scalar` one > > should put the rule in the `common_scalar` section. > > > > What do you think? > > I've added this to the patch and Zend/tests: > > * > https://github.com/ralphschindler/php-src/compare/master...feature/class-name-scalar > > I've also added an RFC page, any thoughts on improving the RFC? > > * https://wiki.php.net/rfc/class_name_scalars In the examples, you mix case: Boo::class Moo::Class \Moo::CLASS Make sure you note that this is intentional, and that the keyword is case insensitive -- i.e., changing the case does not alter the use cases presented. Also, I'd note why you're selecting "class" as the keyword (basically, because it _is_ a keyword, and thus will never conflict with any class constants or method names). Otherwise, very straight-forward. -- Matthew Weier O'Phinney Project Lead | matthew@zend.com Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc