Re: Re: New Feature: Fully qualified class name resolution as scalar with class keyword

From: Date: Tue, 17 Apr 2012 17:07:46 +0000
Subject: Re: Re: New Feature: Fully qualified class name resolution as scalar with class keyword
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-60087@lists.php.net to get a copy of this message
On Tue, Apr 17, 2012 at 6:58 PM, Stas Malyshev <smalyshev@sugarcrm.com> wrote: > Hi! > >> May I suggest using foo::__CLASS__ instead of foo::class ? It's longer, but >> closer to what already exists for this semantic (class name as string), >> don't you think ? > > I like this. __CLASS__ is already being used as class name, and little > chance of colliding with some code since you're not supposed to be using > __ prefix in your names. From the collisions point of view class and __CLASS__ are equally safe. They both are lexer keywords, so it's not possible to declare constants with them as name. Imho ClassName::class reads nicer and also looks similar to the similar ClassName.class syntax in Java. Nikita

« previous php.internals (#60087) next »