::class docs says it resolves to fully qualified namespace but actually only qualified namespace
Nobody has claimed this yet.
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
From manual page: https://php.net/language.oop5.constants it says...
The special ::class constant allows for fully qualified class name resolution at compile time, this is useful for namespaced classes:
With https://www.php.net/manual/en/language.namespaces.rules.php saying that a fully qualified namespace 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
However using ::class on a namespaced class doesn't include the initial namespace separator in its output.
[root@TPS-NUCI5-DEMO1 ~]# php -a
Interactive shell
php > require_once("vendor/autoload.php");
php > var_dump(\Twig\Loader\FilesystemLoader::class);
php shell code:1:
string(28) "Twig\Loader\FilesystemLoader"
Either ::class is behaving wrong or the documentation shouldn't say it resolves to a fully qualified class name.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the class constants page at language.oop5.constants and compare its wording with the namespace naming rules page at language.namespaces.rules.php. Confirm the documented ::class output for namespaced classes, then clarify the terminology so the statement matches the behavior and the namespace definition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100