Hey Matt.

Am 15.02.21 um 06:14 schrieb Matthew Brown:
> Hey all,
> 
> Is there interest in prohibiting whitespace around double colons in the
> next major PHP version?
> 
> I was surprised to learn that PHP treats :: similar to ->, allowing double
> colons like
> 
> A::
> b();
> 
> Looking at the top 2,000 packages in Packagist I can't find any evidence of
> people using a double colon with whitespace around, and my suspicion is
> that the use of it is basically non-existent.
> 
> I wonder if there's a benefit to removing a small potential footgun from
> the language? I can't really see any benefit to _keeping_ it (unless it
> turns out my analysis is wrong, and it's actually wildly popular).

Additional whitespace means *any* whitespace. Not just line ends. And
I've seen far too many codebases that use spaces around double colons
(or arrows or a lot of other things) like this:

A :: b();

Not allowing that on a language level just to avoid people shooting
their own foot while we have enough userland tools to at least make
people aware of such issues (like php_codesniffer, php-cs-fix or –
perhaps even better – phpunit) feels a bit drastic to me.

Cheers

Andreas
-- 
                                                              ,,,
                                                             (o o)
+---------------------------------------------------------ooO-(_)-Ooo-+
| Andreas Heigl                                                       |
| mailto:andr...@heigl.org                  N 50°22'59.5" E 08°23'58" |
| https://andreas.heigl.org                                           |
+---------------------------------------------------------------------+
| https://hei.gl/appointmentwithandreas                               |
+---------------------------------------------------------------------+

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to