Classes - Example #17 Object name resolution
Open
Nobody has claimed this yet.
bug
good first issue
Status: Verified
- Dominant language
- XML
- Stars
- 596
- Forks
- 890
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 55
Description
Hello!
When testing example 17:
<?php
namespace NS {
class ClassName {
}
}
$c = new ClassName();
print $c::class;
?>
I get the error
"Fatal error: No code may exist outside of namespace {} in..."
on the page https://www.php.net/manual/en/language.oop5.basic.php .
I have version 8.1.
Sincerely, George.
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
Open the PHP manual page at language.oop5.basic.php and inspect Classes example #17, then reproduce it with PHP 8.1. Correct the example so it runs without the reported namespace error and verify the resulting object-name resolution behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100