Permalink
Browse files

merged branch Tobion/formincon (PR #5355)

Commits
-------

7e8ab54 [Form] raise OutOfBoundsException instead of InvalidArgumentException for inexistent form childs to be in line with PropertyPath

Discussion
----------

[Form] raise OutOfBoundsException instead of InvalidArgumentException in Form::get

BC break: yes

Raise OutOfBoundsException instead of InvalidArgumentException in Form::get for inexistent form childs to be in line with PropertyPath, which also uses OutOfBoundsException for invalid indexes. OutOfBoundsException fits much better as it extends RuntimeException instead of LogicException and this error can typically not be detected at compile time.

---------------------------------------------------------------------------

by bschussek at 2012-08-29T11:01:01Z

👍

---------------------------------------------------------------------------

by stloyd at 2012-08-29T11:07:51Z

Shouldn't this change be noted in upgrade file ?

---------------------------------------------------------------------------

by stof at 2012-08-29T11:23:04Z

it should (and in the changelog of the component)
  • Loading branch information...
2 parents 4e62d3e + 65db978 commit a8c34c1cda37c414d3ae5dbaf90624b2703afd88 @fabpot fabpot committed Aug 29, 2012
Showing with 3 additions and 3 deletions.
  1. +2 −2 Form.php
  2. +1 −1 FormInterface.php
View
4 Form.php
@@ -903,7 +903,7 @@ public function get($name)
return $this->children[$name];
}
- throw new \InvalidArgumentException(sprintf('Child "%s" does not exist.', $name));
+ throw new \OutOfBoundsException(sprintf('Child "%s" does not exist.', $name));
}
/**
@@ -925,7 +925,7 @@ public function offsetExists($name)
*
* @return FormInterface The child form
*
- * @throws \InvalidArgumentException If the named child does not exist.
+ * @throws \OutOfBoundsException If the named child does not exist.
*/
public function offsetGet($name)
{
View
2 FormInterface.php
@@ -57,7 +57,7 @@ public function add(FormInterface $child);
*
* @return FormInterface The child form
*
- * @throws \InvalidArgumentException If the named child does not exist.
+ * @throws \OutOfBoundsException If the named child does not exist.
*/
public function get($name);

0 comments on commit a8c34c1

Please sign in to comment.