Re: Pre-RFC Discussion: Support for String Literals as Object Properties and Named Parameters in PHP
| From: | Anton Smirnov | Date: | Tue, 03 Sep 2024 11:48:57 +0000 |
| Subject: | Re: Pre-RFC Discussion: Support for String Literals as Object Properties and Named Parameters in PHP | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125408@lists.php.net to get a copy of this message | ||
On 02/09/2024 19:42, Christoph M. Becker wrote:
On 02.09.2024 at 16:51, Mike Schinkel wrote:And it works with methods too, you just can't define them but can catch with __call: <?php class AAA {Generally I am one who welcomes new feature ideas, but I fear that string literals as object properties would break a valuable assumption that all properties must be a valid identifier. Without that assumption I fear many things that would become more complex.Is that so? See <https://3v4l.org/bZTFi>.
public function __call(string $name, array $arguments)
{
var_dump($name);
}
}
[new AAA, '123AnyChars%%!@#']();