> On 24 Jul 2015, at 2:33 am, "S.A.N" <ua.san.a...@gmail.com> wrote: > > 2015-07-23 18:10 GMT+03:00 Marcio Almada <marcio.w...@gmail.com>: >> 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 > > RestException is the base class for classes Gone, NotFound, BadRequest... > He needed to catch all RestExceptions class. > > We do not use suffixes for names of exception classes, simple clear > named classes of exceptions, this is our agreement. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >
Then why not put the base class in the namespace of which it is a base class for? Cheers, David -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php