Skip to content

Commit ec7df1c

Browse files
Throw Symfony OutOfBounds exception instead of default one
1 parent 949a518 commit ec7df1c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ConstraintViolationList.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator;
1313

14+
use Symfony\Component\Validator\Exception\OutOfBoundsException;
15+
1416
/**
1517
* Default implementation of {@ConstraintViolationListInterface}.
1618
*
@@ -77,7 +79,7 @@ public function addAll(ConstraintViolationListInterface $otherList)
7779
public function get(int $offset): ConstraintViolationInterface
7880
{
7981
if (!isset($this->violations[$offset])) {
80-
throw new \OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset));
82+
throw new OutOfBoundsException(sprintf('The offset "%s" does not exist.', $offset));
8183
}
8284

8385
return $this->violations[$offset];

ConstraintViolationListInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator;
1313

14+
use Symfony\Component\Validator\Exception\OutOfBoundsException;
15+
1416
/**
1517
* A list of constraint violations.
1618
*
@@ -42,7 +44,7 @@ public function addAll(self $otherList);
4244
*
4345
* @param int $offset The offset of the violation
4446
*
45-
* @throws \OutOfBoundsException if the offset does not exist
47+
* @throws OutOfBoundsException if the offset does not exist
4648
*/
4749
public function get(int $offset): ConstraintViolationInterface;
4850

0 commit comments

Comments
 (0)