commit 7afd7c3995f1a94c0f339d454ae4eb9a79a04258 Author: fago Date: Wed Feb 27 12:38:44 2013 +0100 addressing berdir review diff --git a/core/lib/Drupal/Core/Entity/Field/Type/Field.php b/core/lib/Drupal/Core/Entity/Field/Type/Field.php index 730be99..5e4f116 100644 --- a/core/lib/Drupal/Core/Entity/Field/Type/Field.php +++ b/core/lib/Drupal/Core/Entity/Field/Type/Field.php @@ -11,10 +11,6 @@ use Drupal\user\Plugin\Core\Entity\User; use Drupal\Core\TypedData\ContextAwareInterface; use Drupal\Core\TypedData\ItemList; -use Drupal\Core\TypedData\TypedDataInterface; -use ArrayIterator; -use IteratorAggregate; -use InvalidArgumentException; /** * Represents an entity field; that is, a list of field item objects. @@ -27,7 +23,7 @@ * * @see \Drupal\Core\Entity\Field\FieldInterface */ -class Field extends ItemList implements IteratorAggregate, FieldInterface { +class Field extends ItemList implements FieldInterface { /** * Numerically indexed array of field items, implementing the @@ -88,7 +84,7 @@ public function setValue($values) { // Set the values. foreach ($values as $delta => $value) { if (!is_numeric($delta)) { - throw new InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); + throw new \InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); } elseif (!isset($this->list[$delta])) { $this->list[$delta] = $this->createItem($delta, $value); diff --git a/core/lib/Drupal/Core/TypedData/ItemList.php b/core/lib/Drupal/Core/TypedData/ItemList.php index 997a4de..d5a3bcc 100644 --- a/core/lib/Drupal/Core/TypedData/ItemList.php +++ b/core/lib/Drupal/Core/TypedData/ItemList.php @@ -9,7 +9,6 @@ use ArrayIterator; use IteratorAggregate; -use InvalidArgumentException; /** * A generic list class. @@ -51,7 +50,7 @@ public function setValue($values) { } else { if (!is_array($values)) { - throw new InvalidArgumentException('Cannot set a list with a non-array value.'); + throw new \InvalidArgumentException('Cannot set a list with a non-array value.'); } // Clear the values of properties for which no value has been passed. @@ -62,7 +61,7 @@ public function setValue($values) { // Set the values. foreach ($values as $delta => $value) { if (!is_numeric($delta)) { - throw new InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); + throw new \InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); } elseif (!isset($this->list[$delta])) { $this->list[$delta] = $this->createItem($delta, $value); @@ -116,7 +115,7 @@ public function offsetUnset($offset) { */ public function offsetGet($offset) { if (!is_numeric($offset)) { - throw new InvalidArgumentException('Unable to get a value with a non-numeric delta in a list.'); + throw new \InvalidArgumentException('Unable to get a value with a non-numeric delta in a list.'); } // Allow getting not yet existing items as well. // @todo: Maybe add a public createItem() method in addition? @@ -158,7 +157,7 @@ public function offsetSet($offset, $value) { $this->offsetGet($offset)->setValue($value); } else { - throw new InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); + throw new \InvalidArgumentException('Unable to set a value with a non-numeric delta in a list.'); } }