@@ -24,31 +24,31 @@ composer require linna/typed-array
24
24
use Linna\TypedArray;
25
25
26
26
//correct, only int passed to constructor.
27
- $array = new TypedArray('int', [1, 2, 3, 4]);
27
+ $intArray = new TypedArray('int', [1, 2, 3, 4]);
28
28
29
29
//correct, int assigned
30
- $array [] = 5;
30
+ $intArray [] = 5;
31
31
32
32
//throw InvalidArgumentException, string assigned.
33
- $array [] = 'a';
33
+ $intArray [] = 'a';
34
34
35
35
//throw InvalidArgumentException, mixed array passed to constructor.
36
- $array = new TypedArray('int', [1, 'a', 3, 4]);
36
+ $otherIntArray = new TypedArray('int', [1, 'a', 3, 4]);
37
37
38
38
//correct, only Foo class instances passed to constructor.
39
- $array = new TypedArray(Foo::class, [
39
+ $fooArray = new TypedArray(Foo::class, [
40
40
new Foo(),
41
41
new Foo()
42
42
]);
43
43
44
44
//correct, Foo() instance assigned.
45
- $array [] = new Foo();
45
+ $fooArray [] = new Foo();
46
46
47
47
//throw InvalidArgumentException, Bar() instance assigned.
48
- $array [] = new Bar();
48
+ $fooArray [] = new Bar();
49
49
50
50
//throw InvalidArgumentException, mixed array of instances passed to constructor.
51
- $array = new TypedArray(Foo::class, [
51
+ $otherFooArray = new TypedArray(Foo::class, [
52
52
new Foo(),
53
53
new Bar()
54
54
]);
0 commit comments