Skip to content

Commit 6a893c9

Browse files
committed
Merge pull request #11 to b2.0.0
1 parent 881a921 commit 6a893c9

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"php": "^7.0"
1919
},
2020
"require-dev": {
21-
"infection/infection": "^0.9",
21+
"infection/infection": "^0.10",
2222
"phpstan/phpstan": "^0.10",
2323
"phpunit/phpunit": "^7.0"
2424
},
@@ -28,6 +28,8 @@
2828
}
2929
},
3030
"autoload-dev": {
31-
"classmap": ["tests/"]
31+
"psr-4": {
32+
"Linna\\Tests\\": "tests/"
33+
}
3234
}
3335
}

src/TypedArray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function __construct(string $type, array $array = [])
9393
}
9494

9595
//single class, multi type support :)
96-
if (!isset($this->allowedTypes[$type])) {
96+
if (empty($this->allowedTypes[$type])) {
9797
throw new InvalidArgumentException(__CLASS__.': '.$type.' type passed to '.__METHOD__.' not supported.');
9898
}
9999

tests/TypedArrayTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
*/
1010
declare(strict_types=1);
1111

12+
namespace Linna\Tests;
13+
1214
use Linna\TypedArray;
15+
use ArrayObject;
16+
use SplStack;
1317
use PHPUnit\Framework\TestCase;
1418

1519
/**
@@ -283,9 +287,7 @@ public function testIteratorClass()
283287
$arrayAsParam = ['a','b','c','d','e','f','g','h','i'];
284288
$array = new TypedArray('string', $arrayAsParam);
285289

286-
foreach ($array as $key => $value) {
287-
$this->assertEquals($value, $arrayAsParam[$key]);
288-
}
290+
$this->assertEquals($arrayAsParam, iterator_to_array($array));
289291
}
290292

291293
/**

0 commit comments

Comments
 (0)