File tree Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Expand file tree Collapse file tree 3 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8
8
9
9
## [ Unrelased ] [ v1.0.3 ] (https://github.com/linna/typed-array/compare/v1.0.1...v1.0.3 ) - 2017-XX-XX
10
10
11
+ ### Changed
12
+ * ` Linna\TypedArray ` exception messages updated
13
+ * ` Linna\TypedObjectArray ` exception messages updated
14
+
11
15
### Fixed
12
16
* ` CHANGELOG.md ` links url
13
17
@@ -24,5 +28,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
24
28
## [ v1.0.0] ( https://github.com/linna/typed-array/compare/v1.0.0...master ) - 2017-06-07
25
29
26
30
### Added
27
- * ` Linna\TypedArray ` for create arrays that accept only values of the user defined type.
28
- * ` Linna\TypedObjectArray ` for create arrays that accept only class instances of the user defined type.
31
+ * ` Linna\TypedArray ` for create arrays that accept only values of the user defined type
32
+ * ` Linna\TypedObjectArray ` for create arrays that accept only class instances of the user defined type
Original file line number Diff line number Diff line change @@ -51,13 +51,13 @@ public function __construct(string $type, array $array = [])
51
51
{
52
52
//single class, multi type support :)
53
53
if (!isset ($ this ->allowedTypes [$ type ])) {
54
- throw new InvalidArgumentException ($ type .' type passed to ' .__CLASS__ .' not supported ' );
54
+ throw new InvalidArgumentException (__CLASS__ . ' : ' . $ type .' type passed to ' .__METHOD__ .' not supported. ' );
55
55
}
56
56
57
57
//for not utilize foreach, compare sizes of array
58
58
//before and after apply a filter :)
59
59
if (count ($ array ) > count (array_filter ($ array , 'is_ ' .$ type ))) {
60
- throw new InvalidArgumentException (' Elements passed to ' .__CLASS__ .' must be of the type ' .$ type );
60
+ throw new InvalidArgumentException (__CLASS__ . ' : Elements passed to ' .__METHOD__ .' must be of the type ' .$ type. ' . ' );
61
61
}
62
62
63
63
//call parent constructor
@@ -86,6 +86,6 @@ public function offsetSet($index, $newval)
86
86
87
87
return ;
88
88
}
89
- throw new InvalidArgumentException (' Elements passed to ' .__CLASS__ .' must be of the type ' .$ this ->type );
89
+ throw new InvalidArgumentException (__CLASS__ . ' : Elements passed to ' .__CLASS__ .' must be of the type ' .$ this ->type . ' . ' );
90
90
}
91
91
}
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ class TypedObjectArray extends ArrayObject
36
36
public function __construct (string $ type , array $ array = [])
37
37
{
38
38
if (!class_exists ($ type )) {
39
- throw new InvalidArgumentException (' Type passed to ' .__CLASS__ .' must be an existing class ' );
39
+ throw new InvalidArgumentException (__CLASS__ . ' : Type passed to ' .__METHOD__ .' must be an existing class ' );
40
40
}
41
41
42
42
//check elements of passed array
@@ -45,7 +45,7 @@ public function __construct(string $type, array $array = [])
45
45
if ($ element instanceof $ type ) {
46
46
continue ;
47
47
}
48
- throw new InvalidArgumentException (' Elements passed to ' .__CLASS__ .' must be of the type ' .$ type );
48
+ throw new InvalidArgumentException (__CLASS__ . ' : Elements passed to ' .__METHOD__ .' must be of the type ' .$ type. ' . ' );
49
49
}
50
50
51
51
//call parent constructor
@@ -71,6 +71,6 @@ public function offsetSet($index, $newval)
71
71
72
72
return ;
73
73
}
74
- throw new InvalidArgumentException (' Elements passed to ' .__CLASS__ .' must be of the type ' .$ this ->type );
74
+ throw new InvalidArgumentException (__CLASS__ . ' : Elements passed to ' .__CLASS__ .' must be of the type ' .$ this ->type . ' . ' );
75
75
}
76
76
}
You can’t perform that action at this time.
0 commit comments