Req #54949 [Opn->Sus]: provide interface ReadOnlyArrayAccess

From: Date: Sun, 25 Mar 2018 12:31:06 +0000
Subject: Req #54949 [Opn->Sus]: provide interface ReadOnlyArrayAccess
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214467@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54949&edit=1 ID: 54949 Updated by: cmb@php.net Reported by: giorgio dot liscio at email dot it Summary: provide interface ReadOnlyArrayAccess -Status: Open +Status: Suspended Type: Feature/Change Request Package: SPL related Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Apparently, this feature request is controversial, and as such would require discussion on the internals@ mailing list, at least, and maybe the RFC process[1]. For the time being, I'm suspending this ticket. [1] <https://wiki.php.net/rfc/howto> Previous Comments: ------------------------------------------------------------------------ [2011-11-21 17:45:34] morrison dot levi at gmail dot com I completely disagree. Further, ArrayAccess would not 'extend' ReadOnlyArrayAccess. I would simply implement offsetSet and offsetUnset to do nothing then raise a warning or throw an exception (I'd throw the exception, myself). ------------------------------------------------------------------------ [2011-05-29 12:08:55] giorgio dot liscio at email dot it Description: ------------ hi, what about an interface like this? interface ReadOnlyArrayAccess { abstract public boolean offsetExists ( mixed $offset ) abstract public mixed offsetGet ( mixed $offset ) } interface ArrayAccess extends ReadOnlyArrayAccess { abstract public void offsetSet ( mixed $offset , mixed $value ) abstract public void offsetUnset ( mixed $offset ) } it is easier to implement when objects must be immutable thank you ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=54949&edit=1

« previous php.bugs (#214467) next »