Re: Namespace problem?
| From: | Hannes Magnusson | Date: | Wed, 16 Jul 2008 07:34:53 +0000 |
| Subject: | Re: Namespace problem? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-39000@lists.php.net to get a copy of this message | ||
On Wed, Jul 16, 2008 at 08:50, Alexey Zakhlestin <indeyets@gmail.com> wrote:
> On Tue, Jul 15, 2008 at 8:08 PM, Stefan Priebsch <info@e-novative.de> wrote:
>> Hi list,
>>
>> I was playing around with namespaces and stumbled across this:
>>
>> #!/home/steve/php5.3-200807070430/sapi/cli/php
>> <?php
>>
>> namespace Foo;
>>
>> use Foo::Bar as Something;
>>
>> class Bar { }
>>
>> ?>
>>
>> works fine, whereas
>>
>> #!/home/steve/php5.3-200807070430/sapi/cli/php
>> <?php
>>
>> namespace Foo;
>> {
>> use Foo::Bar as Something;
>>
>> class Bar { }
>> }
>>
>> ?>
>>
>> yields: Parse error: syntax error, unexpected T_USE
>> in /home/steve/namespaces/code/with_braces.php on line 6
>
> "use" is a file-level construct, as far as I remember, so you can't
> put it into block
I thought the only argument against using curly braces for namespaces
was exactly his example "you can use namespace foo; {} if you really
want to"?
-Hannes