Can you import a namespace into a class that doesn't have a name space?
I tried it by using "use (NAMESPACE)" in a class without a namespace but by IDE said this wasn't valid. I tried it anyway, but got an error.
Namespaces in non name-spaced class
Moderator: General Moderators
Re: Namespaces in non name-spaced class
What did the error say? Maybe post some of the relevant code?
Re: Namespaces in non name-spaced class
Literally in a class? As in
Because I copied that code from the "Illegal importing rule" example in the documentation.
Code: Select all
<?php
namespace Languages;
class Greenlandic
{
use Languages\Danish;
...
}
?>