Re: Re: Voting choice for language changes (Was: "Re: [PHP-DEV][RFC][DISCUSSION] Strict Argument Count")
| From: | David Muir | Date: | Sun, 26 Jul 2015 05:57:56 +0000 |
| Subject: | Re: Re: Voting choice for language changes (Was: "Re: [PHP-DEV][RFC][DISCUSSION] Strict Argument Count") | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87297@lists.php.net to get a copy of this message | ||
> On 24 Jul 2015, at 2:33 am, "S.A.N" <ua.san.alex@gmail.com> wrote:
>
> 2015-07-23 18:10 GMT+03:00 Marcio Almada <marcio.web2@gmail.com>:
>> Hi, you replied to the wrong thread ;)
>>
>> 2015-07-22 19:38 GMT-03:00 S.A.N <ua.san.alex@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