Reputation: 10674
I have the following legacy file (can't edit):
class Test {
public $abc=1;
}
I need to extend this class from a name-spaced file:
use mynamespace;
class MyClass extends Test {
}
However my auto-load function attempts to include mynamespace\Test. How to specify that un-namespaced version of Test should be used?
Upvotes: 2
Views: 91
Reputation: 36562
Prefix the class name with a \
:
class MyClass extends \Test {
...
}
From the manual on namespaces: "Note that to access any global class, function or constant, a fully qualified name can be used, such as \strlen()
or \Exception
or \INI_ALL
."
Upvotes: 1