Skip to content

Commit 05ea103

Browse files
committed
Fix errors thrown when accessing stack and queue by key
1 parent 8d1df54 commit 05ea103

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Queue.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Ds;
33

4-
use \Error;
4+
use OutOfBoundsException;
55

66
/**
77
* Queue
@@ -127,14 +127,14 @@ public function getIterator()
127127
/**
128128
* @inheritdoc
129129
*
130-
* @throws Error
130+
* @throws OutOfBoundsException
131131
*/
132132
public function offsetSet($offset, $value)
133133
{
134134
if ($offset === null) {
135135
$this->push($value);
136136
} else {
137-
throw new Error();
137+
throw new OutOfBoundsException();
138138
}
139139
}
140140

src/Stack.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace Ds;
33

4-
use Error;
4+
use OutOfBoundsException;
55
use UnderflowException;
66

77
/**
@@ -132,14 +132,14 @@ public function getIterator()
132132
/**
133133
* @inheritdoc
134134
*
135-
* @throws Error
135+
* @throws OutOfBoundsException
136136
*/
137137
public function offsetSet($offset, $value)
138138
{
139139
if ($offset === null) {
140140
$this->push($value);
141141
} else {
142-
throw new Error();
142+
throw new OutOfBoundsException();
143143
}
144144
}
145145

0 commit comments

Comments
 (0)