Hi, you replied to the wrong thread ;)

2015-07-22 19:38 GMT-03:00 S.A.N <ua.san.a...@gmail.com>:
> I am satisfied, the possibility of group declarations, but the that lack:
>
> <?php
>
> use App\RestException\   // name "RestException", not imported to
> current namespace :(
> {
>     Gone,
>     NotFound,
>     BadRequest
> };
>
> ?>
>
> Unfortunately have to write so:
>
> <?php
>
> use App\RestException;
> use App\RestException\{Gone, NotFound, BadRequest};
>
> ?>
>
> It looks ugly and very strange.

There is nothing strange on it (except, possibly, the trailing `\`
which was discussed to death and voted).

Even if we had no trailing '\' it wouldn't make any sense to import
"App\RestException" when "use App\RestException{Gone, NotFound,
BadRequest};" is used.

> My proposition, the imported end name, if end of without slash.
>
> Like this:
>
> <?php
>
> use App\RestException
> {
>     Gone,
>     NotFound,
>     BadRequest
> };
>
> echo RestException::class; // App\RestException
>
> ?>

Importing from within a namespace is not the same thing as importing a
class. I'd be against it.

My 2 cents: why do you have "RestException" with "Exception" suffix
and then don't have the same suffix on the other exception names? This
unpredictable exception hierarchy is the "ugly" part and subtle
alternative syntax won't make it better, IMMO.

Marcio

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to