Re: Whitespace around Paamayim Nekudotayim (double colon)
| From: | Matthew Brown | Date: | Mon, 15 Feb 2021 14:52:49 +0000 |
| Subject: | Re: Whitespace around Paamayim Nekudotayim (double colon) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113181@lists.php.net to get a copy of this message | ||
There are plenty of places where PHP doesn't allow whitespace currently.
The most comparable example is between namespace separators:
Ns \ bar();
Ns \ SOME_CONST;
are both syntax errors.
MyClass::bar() and MyClass::SOME_CONST are often used in place of
Ns\bar() and Ns\SOME_CONST because the former invokes the autoloader in
a way the latter does not. My gut tells me they should behave the same way
with respect to whitespace, too.
In some situations PHP _does_ treat the identifier "Foo::bar" differently
to "Foo :: bar":
class A {
public static function b() {
return 5;
}
}
echo "A::b"(); // works
echo "A :: b"(); // fatal error