Re: Casing of acronyms in class and method names
| From: | Niels Dossche | Date: | Thu, 31 Aug 2023 18:34:20 +0000 |
| Subject: | Re: Casing of acronyms in class and method names | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120967@lists.php.net to get a copy of this message | ||
Hi Tim
On 30/08/2023 13:43, Tim Düsterhus wrote:
> Hi
>
> after suggesting the use of ucfirst(strtolower(...)) casing for acronyms within a classname of
> a draft RFC, I was made aware of previous class naming RFC (June 2017) that required the use of
> PascalCase for class names, with the exception of acronyms which must be completely uppercased:
>
> https://wiki.php.net/rfc/class-naming
>
> I'd like to propose to revisit this earlier decision for the following reasons. Before
> writing an RFC I'd like have some pre-discussion to gauge opinions.
>
> --------------------
>
> 1. It is not consistently applied:
> [...]
I think it's a good idea to change the rules to reality as much as possible.
Especially given that recent additions seem to follow what you're proposing.
>
> 2. It decreases readability.
>
> [...]
Agreed.
>
> 3. Several commonly used userland libraries make a different choice.
>
> - Symfony's HttpFoundation:
> https://github.com/symfony/symfony/tree/6.4/src/Symfony/Component/HttpFoundation
> - Symfony's CssSelector:
> https://github.com/symfony/symfony/tree/6.4/src/Symfony/Component/CssSelector
> - Laravel's HtmlString:
> https://github.com/laravel/framework/blob/10.x/src/Illuminate/Support/HtmlString.php
> - PSR-7: https://www.php-fig.org/psr/psr-7/
> - PSR-18: https://www.php-fig.org/psr/psr-18/
> - ramsey/uuid: https://github.com/ramsey/uuid/tree/4.x/src
> - Flysystem is a little inconsistent, but has 'Ftp':
> https://github.com/thephpleague/flysystem/tree/3.x/src/Ftp
> - PHPUnit is a little inconsistent, but has 'Xml' and 'Json':
> https://github.com/sebastianbergmann/phpunit/tree/main/src/Util
> - Doctrine is also a little inconsistent, but has 'Dsn' and 'Sql' (but also
> 'SQL'):
> https://github.com/doctrine/dbal/tree/3.6.x/src/Schema/Visitor and
> https://github.com/doctrine/dbal/blob/3.6.x/src/Tools/DsnParser.php
>
> Best regards
> Tim Düsterhus
>
Kind regards
Niels