Troubleshooting "The use statement with non-compound name"
The error "The use statement with non-compound name" usually indicates that you are trying to use a namespace in a use
statement, but you did not provide a compound name.
A compound name is a namespace followed by a class or function name. For example:
use \My\Namespace\MyClass;
This error can also occur if you have a syntax error in your use
statement. Make sure that you are using the correct syntax and that you have not left out any part of the compound name.
Watch a video course
Learn object oriented PHP
For example, the following use
statement is missing the compound name and would trigger this error:
use \My\Namespace; // Missing class or function name
To fix this error, make sure to include the class or function name in the use
statement:
use \My\Namespace\MyClass; // Correct