The following throws an error stating Exception
can not be redeclared.
namespace \NYTD\ReadingListBackend;
class Exception extends \Exception
{
}
However, removing the \
prefix in the namespace declaration does not:
namespace NYTD\ReadingListBackend;
I recently adopted PHP namespaces. My understanding is that namespaces prefixed with \
represent a fully qualified name.
So why can't I use the prefix in the namespace declaration? I can when referencing (e.g. new \NYTD\ReadingListBackend\Exception
). Would appreciate a full explanation as I couldn't find anything in the docs.