php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #54949 provide interface ReadOnlyArrayAccess
Submitted: 2011-05-29 12:08 UTC Modified: 2018-03-25 12:31 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: giorgio dot liscio at email dot it Assigned:
Status: Suspended Package: SPL related
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-05-29 12:08 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-11-21 17:45 UTC] 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).
 [2018-03-25 12:31 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2018-03-25 12:31 UTC] cmb@php.net
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>
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun May 26 09:01:25 2019 UTC