Merge "doxygen now recognizes README and .txt files"
[lhc/web/wiklou.git] / includes / libs / GenericArrayObject.php
index d4cc525..9b3e796 100644 (file)
@@ -28,9 +28,8 @@
  * @since 1.20
  *
  * @file
- * @ingroup Diff
  *
- * @licence GNU GPL v2+
+ * @license GNU GPL v2+
  * @author Jeroen De Dauw < jeroendedauw@gmail.com >
  */
 abstract class GenericArrayObject extends ArrayObject {
@@ -61,13 +60,11 @@ abstract class GenericArrayObject extends ArrayObject {
         * @return integer
         */
        protected function getNewOffset() {
-               while ( true ) {
-                       if ( !$this->offsetExists( $this->indexOffset ) ) {
-                               return $this->indexOffset;
-                       }
-
+               while ( $this->offsetExists( $this->indexOffset ) ) {
                        $this->indexOffset++;
                }
+
+               return $this->indexOffset;
        }
 
        /**
@@ -142,11 +139,11 @@ abstract class GenericArrayObject extends ArrayObject {
         * @param mixed $index
         * @param mixed $value
         *
-        * @throws Exception
+        * @throws InvalidArgumentException
         */
        protected function setElement( $index, $value ) {
                if ( !$this->hasValidType( $value ) ) {
-                       throw new Exception(
+                       throw new InvalidArgumentException(
                                'Can only add ' . $this->getObjectType() . ' implementing objects to ' . get_called_class() . '.'
                        );
                }