The application has base classes, for quick access they do not have spaces, they are often used in modules, for example:

namespace module; class MyClass extends \BaseClass { public function __construct() { \TempClass::...; // ... } } 

Writing before each class \гадость doesn’t really look and read

I would like something like this:

 class module\MyClass extends BaseClass { public function __construct() { TempClass::...; // ... } } 

Class MyClass I call only once, and the base at every step. Is there a way to do something about it?

    2 answers 2

    Use the task of aliases using the use statement

     use BaseClass 

      No need to fight. Use the use directive for a one-time declaration of which class to use.

       <?php namespace foo\bar; use some\large\namespace\someclass; ... $obj = new someclass; 

      And other actions are available simply by the name of the class declared in use . If necessary, it is possible to use alias.