phpDocumentor/fig-standards — pull request #32 by AmyStephen (2013-10-11 23:42:46+00:00)
Title: Unqualified, qualified and fully qualified

It could help reduce confusion if PHP's term definitions were used and referred. (Quoting and linking to the text would be good, IMO.)

1.A. Unqualified, qualified and fully qualified.

Each has a specific meaning and should be used in that sense. However, it's important to understand when those meanings are relevant and to what process.

From the [good book](http://php.net/manual/en/language.namespaces.rules.php):

Unqualified name

This is an identifier without a namespace separator, such as Foo

Qualified name

This is an identifier with a namespace separator, such as Foo\Bar
Fully qualified name

This is an identifier with a namespace separator that begins with a namespace separator, such as \Foo\Bar. The namespace \Foo is also a fully qualified name.

- If we are talking about a `FQCN`, it MUST have a leading namespace separator, as per PHP's definition. Otherwise, it is a `QCN`.

1. B. Namespace separator

Should be called such, rather than calling it a slash.

There are three points in the process that the leading (or lack of leading) namespace separator are relevant:

1. When fed to an `spl_autoloader` to be stored in a class map for later matching.

The leading namespace separator should be removed internally by the Autoloader when stored since it will be compared to compared to the value PHP provides in #step 3, below.

2. When PHP resolves the Class name (Name Resolution Rules)

This is not relevant to PSR-4. It's internal to PHP using [these rules](http://php.net/manual/en/language.namespaces.rules.php).

3. When the `spl_autoloader` is invoked and passed a class name request by PHP.

This QCN is passed into the spl_autoloader by PHP. The FQCN is not.

[Gist illustrating these points](https://gist.github.com/AmyStephen/6943532)

*The points*

- Use terms defined by PHP as PHP defines them.
FQCN has a leading namespace separator. That's inherent in the term.

- PHP calls the slash a 'namespace separator' - best to stick to the term used by PHP.

- There is no reason, IMO, to make any rule about the leading namespace separator. If the autoloader stores the leading namespace separator -- and appends a leading namespace separator on the value provided by PHP -- it can match to a class file and include it. IF the autoloader does not store the leading namespace separator -- and compares to the classname requested by PHP -- it can match to a class file and include it. If the autoloader stores the leading separator and matches to the classname provided by PHP, IT WILL FAIL. So, leave it to PHP, it does not matter to PSR-4. Let's simplify to the rules that make a difference.

I created this [gist] for testing these points. Put all three files into the same folder and fire up the browser.

2. The Leading Namespace Slash