I would like to Use
the same class Helper
, located at App\Helpers\Helper
, in two different files within the same namespace.
For example:
Class A:
<?php
namespace App\Services;
Use Helper;
class A {...}
Class B:
<?php
namespace App\Services;
Use Helper;
class B {...}
However, this is not allowed. The error is:
Cannot use App\Helpers\Helper as Helper because the name is already in use
I could rename the Helper
class in my second file and say Use Helper as SomethingElse
, but this seems like a messy solution especially if I want to use this Helper
in many more than two classes.
Is there a workaround for this?