The Exception class is resolved to your scripts namespace (PHP Manual) as it starts with:
namespace abc;
You can specifically tell the script which exception to use then:
namespace abc;
use Exception;
class AbcException extends Exception {
// blah blah
}
With this variant you see on top of the file which classes you "import". Additionally you can later on more easily change/alias each Exception class in the file. See also Name resolution rules in the PHP Manual.
Alternatively you can specify the concrete namespace whenever you specify a classname. The root namespace is \
, so the fully qualified classname for exception is \Exception
:
namespace abc;
class AbcException extends \Exception {
// blah blah
}
This just works ever where, however, it makes your code more bound to concrete classnames which might not be wanted if the codebase grows and you start to refactor your code.