Re: [RFC] Asymmetric Visibility, with readonly
| From: | Claude Pache | Date: | Wed, 30 Nov 2022 18:10:18 +0000 |
| Subject: | Re: [RFC] Asymmetric Visibility, with readonly | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-119064@lists.php.net to get a copy of this message | ||
Hi,
What is the behaviour of the following code?
```php
class Foo {
public private(set) array $bar = [ ];
}
$foo = new Foo;
$foo->bar['x'] = 'y'; // error?
var_dump(isset($foo->bar['x'])); // true?, false?
```
I think that modification of an array should require write access? (That should be clarified in the
RFC.)
—Claude