Re: [RFC] Access to aliases definition by reflection

From: Date: Mon, 13 Oct 2014 14:29:56 +0000
Subject: Re: [RFC] Access to aliases definition by reflection
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-77927@lists.php.net to get a copy of this message
On Mon, Oct 13, 2014 at 4:21 PM, Andrea Faulds <ajf@ajf.me> wrote: > > On 13 Oct 2014, at 15:14, Marco Pivetta <ocramius@gmail.com> wrote: > > > On 13 October 2014 16:12, Andrea Faulds <ajf@ajf.me> wrote: > > 2. Shouldn’t it return fully-qualified class names beginning with a > backslash? > > > > When in string context, we are typically always talking about FQCNs, so > the leading backslash is not needed and should be omitted. > > I disagree. It shouldn’t be implicitly fully-qualified. If there’s no > leading backslash, then you have to add one to actually use it. If it’s a > FQCN it should have a \. If and only if it is not a FQCN, it should lack a > \. > There is nothing here to disagree over, it's not a matter of opinion. Canonical class names in PHP do not use a leading backslash. If you do Foo::class you will get back "Foo" and not "\Foo" or any such nonsense. A leading backslash is only used for literal class name references in the source code. String class names should not be used with a leading backslash (even though we usually tolerate it). Nikita

« previous php.internals (#77927) next »