doc-en icon indicating copy to clipboard operation
doc-en copied to clipboard

language.namespaces.rationale first example doesn't actually explain what it is showing

Open mvl22 opened this issue 1 year ago • 1 comments

On manual page: https://php.net/language.namespaces.rationale

This starts with an opening example Example #1 Namespace syntax example as defined in the docs code here.

However, this example block is hard to understand, and at present comes across as a bit of a dump of random examples without explanation. I think few newcomers to namespaces would understand what is being portrayed.

Issues are:

  • The title is 'Namespace syntax example' which implies a complete example how to create a namespace
  • It is unclear whether this is showing a range of examples, or whether this is intended to form a single script showing typical usage
  • Several of the sections in it have no description, so the reader is expected to figure out what is being shown despite the purpose of the page being an introduction
  • Some of the variables, e.g. $a, are reused within this block, implying that they are related.
  • The comment about global space isn't obviously referring to the starting \ character

Basically I think this section would be better rewritten for each example to have a comment on the line before summarising that language feature, and then the demonstration of the feature, and no re-use of variables, to avoid confusion.

Thank you to all contributors for the otherwise excellent documentation throughout the manual.

mvl22 avatar Jan 30 '24 16:01 mvl22

Agreed, a lot of this section could use a rewording. Marking this as a QA issue.

If you have ideas how you think it should be worded feel free to submit a PR :)

Girgias avatar Jan 31 '24 01:01 Girgias