* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
abstract class GenericArrayObject extends ArrayObject {
-
/**
* Returns the name of an interface/class that the element should implement/extend.
*
}
/**
- * Constructor.
* @see ArrayObject::__construct
*
* @since 1.20
* @param string $iterator_class
*/
public function __construct( $input = null, $flags = 0, $iterator_class = 'ArrayIterator' ) {
- parent::__construct( array(), $flags, $iterator_class );
+ parent::__construct( [], $flags, $iterator_class );
if ( !is_null( $input ) ) {
foreach ( $input as $offset => $value ) {
*
* @param mixed $value
*
- * @return boolean
+ * @return bool
*/
protected function hasValidType( $value ) {
$class = $this->getObjectType();
protected function setElement( $index, $value ) {
if ( !$this->hasValidType( $value ) ) {
throw new InvalidArgumentException(
- 'Can only add ' . $this->getObjectType() . ' implementing objects to ' . get_called_class() . '.'
+ 'Can only add ' . $this->getObjectType() . ' implementing objects to '
+ . static::class . '.'
);
}
* @param integer|string $index
* @param mixed $value
*
- * @return boolean
+ * @return bool
*/
protected function preSetElement( $index, $value ) {
return true;
* @return array
*/
protected function getSerializationData() {
- return array(
+ return [
'data' => $this->getArrayCopy(),
'index' => $this->indexOffset,
- );
+ ];
}
/**
*
* @since 1.20
*
- * @return boolean
+ * @return bool
*/
public function isEmpty() {
return $this->count() === 0;
}
-
}