On Mon, Oct 13, 2014 at 4:21 PM, Andrea Faulds <a...@ajf.me> wrote:

>
> On 13 Oct 2014, at 15:14, Marco Pivetta <ocram...@gmail.com> wrote:
>
> > On 13 October 2014 16:12, Andrea Faulds <a...@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

Reply via email to