File tree 2 files changed +7
-13
lines changed
2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -167,14 +167,10 @@ final public static function get($value)
167
167
$ constants = self ::detectConstants ($ class );
168
168
$ name = array_search ($ value , $ constants , true );
169
169
if ($ name === false ) {
170
- if (is_scalar ($ value )) {
171
- throw new InvalidArgumentException ('Unknown value ' . var_export ($ value , true ));
172
- } else {
173
- throw new InvalidArgumentException (sprintf (
174
- 'Invalid value of type %s ' ,
175
- is_object ($ value ) ? get_class ($ value ) : gettype ($ value )
176
- ));
177
- }
170
+ $ message = is_scalar ($ value )
171
+ ? 'Unknown value ' . var_export ($ value , true )
172
+ : 'Invalid value of type ' . (is_object ($ value ) ? get_class ($ value ) : gettype ($ value ));
173
+ throw new InvalidArgumentException ($ message );
178
174
}
179
175
180
176
if (!isset (self ::$ instances [$ class ][$ name ])) {
Original file line number Diff line number Diff line change @@ -49,11 +49,9 @@ public function unserialize($serialized)
49
49
$ constants = self ::getConstants ();
50
50
$ name = array_search ($ value , $ constants , true );
51
51
if ($ name === false ) {
52
- if (is_scalar ($ value )) {
53
- $ message = 'Unknown value ' . var_export ($ value , true );
54
- } else {
55
- $ message = 'Invalid value of type ' . (is_object ($ value ) ? get_class ($ value ) : gettype ($ value ));
56
- }
52
+ $ message = is_scalar ($ value )
53
+ ? 'Unknown value ' . var_export ($ value , true )
54
+ : 'Invalid value of type ' . (is_object ($ value ) ? get_class ($ value ) : gettype ($ value ));
57
55
throw new RuntimeException ($ message );
58
56
}
59
57
You can’t perform that action at this time.
0 commit comments