Edit report at https://bugs.php.net/bug.php?id=54949&edit=1
ID: 54949
Comment by: morrison dot levi at gmail dot com
Reported by: giorgio dot liscio at email dot it
Summary: provide interface ReadOnlyArrayAccess
Status: Open
Type: Feature/Change Request
Package: SPL related
Operating System: Irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
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).
Previous Comments:
------------------------------------------------------------------------
[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