Page 1 of 1

Namespaces in non name-spaced class

Posted: Fri Aug 01, 2014 8:37 pm
by Markto
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.

Re: Namespaces in non name-spaced class

Posted: Fri Aug 01, 2014 8:44 pm
by Celauran
What did the error say? Maybe post some of the relevant code?

Re: Namespaces in non name-spaced class

Posted: Fri Aug 01, 2014 11:44 pm
by requinix
Literally in a class? As in

Code: Select all

<?php
namespace Languages;

class Greenlandic
{
    use Languages\Danish;

    ...
}
?>
Because I copied that code from the "Illegal importing rule" example in the documentation.