for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Shrikeh\Collection;
use Shrikeh\Collection\Exception\ImmutableCollection as ImmutableCollectionException;
/**
* Trait ImmutableArrayAccessTrait
* @package Shrikeh\Collection
*/
trait ImmutableArrayAccessTrait
{
* Immutable collections should not have setters or unsetters.
*
* @param $offset
* @param $data
* @throws ImmutableCollectionException
final public function offsetSet($offset, $data)
$offset
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.
$data
$msg = 'Collection %s is immutable and values cannot be set.';
$this->throwImmutable(sprintf($msg, static::class));
}
final public function offsetUnset($offset)
$msg = 'Collection %s is immutable and values cannot be unset.';
* @param string $msg
protected function throwImmutable($msg, $errorCode = null)
throw new ImmutableCollectionException($msg, $errorCode);
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.