* @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 {
* @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;
}
/**
* @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() . '.'
);
}