Namespace declarations cannot be nested¶
Description¶
Namespace declaration, with blocks, cannot be nested one into the other. Namespaces must be one next to each other.
Usually, there is only one namespace per file, without a block.
Example¶
<?php
namespace A {
namespace B {
}
}
?>
Solutions¶
Make the namespaces next to each other; concatenate the names to create deep namespaces:
namespace A\B {..}
.Split the code into several files, each with only one namespace.