Merge "Rename autonym for 'no' from 'norsk bokmål' to 'norsk'"
[lhc/web/wiklou.git] / includes / libs / GenericArrayObject.php
index d77d8ad..f76d9a2 100644 (file)
@@ -33,7 +33,6 @@
  * @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.
         *
@@ -68,7 +67,6 @@ abstract class GenericArrayObject extends ArrayObject {
        }
 
        /**
-        * Constructor.
         * @see ArrayObject::__construct
         *
         * @since 1.20
@@ -78,7 +76,7 @@ abstract class GenericArrayObject extends ArrayObject {
         * @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 ) {
@@ -118,7 +116,7 @@ abstract class GenericArrayObject extends ArrayObject {
         *
         * @param mixed $value
         *
-        * @return boolean
+        * @return bool
         */
        protected function hasValidType( $value ) {
                $class = $this->getObjectType();
@@ -144,7 +142,8 @@ abstract class GenericArrayObject extends ArrayObject {
        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 . '.'
                        );
                }
 
@@ -171,7 +170,7 @@ abstract class GenericArrayObject extends ArrayObject {
         * @param integer|string $index
         * @param mixed $value
         *
-        * @return boolean
+        * @return bool
         */
        protected function preSetElement( $index, $value ) {
                return true;
@@ -198,10 +197,10 @@ abstract class GenericArrayObject extends ArrayObject {
         * @return array
         */
        protected function getSerializationData() {
-               return array(
+               return [
                        'data' => $this->getArrayCopy(),
                        'index' => $this->indexOffset,
-               );
+               ];
        }
 
        /**
@@ -232,10 +231,9 @@ abstract class GenericArrayObject extends ArrayObject {
         *
         * @since 1.20
         *
-        * @return boolean
+        * @return bool
         */
        public function isEmpty() {
                return $this->count() === 0;
        }
-
 }