nullException
nullException

Reputation: 1122

Importing all predefined PHP classes to my namespace

namespace externalServices\Service;
class FirstService  extends Exception {



}

now Exception is not defined. I know I can do use \Exception AS Exception; But how can I import all native classes to the namespace

Upvotes: 1

Views: 113

Answers (1)

Jani Hartikainen
Jani Hartikainen

Reputation: 43243

Can't be done.

The solution is to either manually import...

use Exception; //Notice leading \ is not needed

Or use an absolute path...

class FirstService extends \Exception {

Upvotes: 4

Related Questions