*
* @file
*
- * @license GNU GPL v2+
+ * @license GPL-2.0-or-later
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
abstract class GenericArrayObject extends ArrayObject {
/**
* @see SiteList::getNewOffset()
* @since 1.20
- * @var integer
+ * @var int
*/
protected $indexOffset = 0;
*
* @since 1.20
*
- * @return integer
+ * @return int
*/
protected function getNewOffset() {
while ( $this->offsetExists( $this->indexOffset ) ) {
}
/**
- * 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 ) {
if ( !$this->hasValidType( $value ) ) {
throw new InvalidArgumentException(
'Can only add ' . $this->getObjectType() . ' implementing objects to '
- . get_called_class() . '.'
+ . static::class . '.'
);
}
*
* @since 1.20
*
- * @param integer|string $index
+ * @param int|string $index
* @param mixed $value
*
* @return bool
* @return array
*/
protected function getSerializationData() {
- return array(
+ return [
'data' => $this->getArrayCopy(),
'index' => $this->indexOffset,
- );
+ ];
}
/**