php-fig / per-coding-style

PER coding style
262 stars 26 forks source link

Namespace limitation confusion in PSR-12 #51

Closed JordanRL closed 1 year ago

JordanRL commented 2 years ago

Leaving this on @Crell's request:

The PSR-12 documentation has this section: https://www.php-fig.org/psr/psr-12/#3-declare-statements-namespace-and-import-statements

Compound namespaces with a depth of more than two MUST NOT be used. Therefore the following is the maximum compounding depth allowed:

While it should be clear that this restriction of two namespaces is specific to the use of grouping, I was confused for a bit whether it was meant to limit all namespaces to a depth of 4 total, 2 beyond the package namespace. This was because "compounding" is not what I've ever heard that called (always heard it called grouping instead), and because all the examples in that section, even those that do not have grouping, are limited to a total depth of 4, except the example of what is not allowed.

samdark commented 1 year ago

Yes. That's a good thing to re-word.