File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ public function offsetGet($offset) {
5454 return $ this ->container [$ offset ];
5555 }
5656
57- return $ this ->undefinedOffsetAction ($ this ->container , $ offset );
57+ return ( $ this ->undefinedOffsetAction ) ($ this ->container , $ offset );
5858 }
5959
6060 public function offsetSet ($ offset , $ value ) {
Original file line number Diff line number Diff line change 33namespace Sevavietl \Arrays \Tests \Unit ;
44
55use Sevavietl \Arrays \BaseArray ;
6+ use Sevavietl \Arrays \UndefinedOffsetException ;
67
78class BaseArrayTest extends \TestCase
89{
@@ -40,4 +41,12 @@ public function instantiationThrowsExceptionDataProvider()
4041 [new \StdClass ],
4142 ];
4243 }
44+
45+ public function testThrowsExceptionOnUndefinedOffset ()
46+ {
47+ $ this ->expectException (UndefinedOffsetException::class);
48+
49+ $ arr = new BaseArray ([1 , 2 , 3 ]);
50+ $ arr [3 ];
51+ }
4352}
You can’t perform that action at this time.
0 commit comments