File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ All notable changes to this project will be documented in this file.
6
6
The format is based on [ Keep a Changelog] ( http://keepachangelog.com/ )
7
7
and this project adheres to [ Semantic Versioning] ( http://semver.org/ ) .
8
8
9
+ ## [ unrelased] [ v1.0.2 ] (https://github.com/s3b4stian/linna-array/compare/v1.0.0...v1.0.2 ) - 2017-XX-XX
10
+
11
+ ### Changed
12
+ * ` Linna\TypedArray->__construct() ` for better performance when object is created
13
+
9
14
## [ v1.0.1] ( https://github.com/s3b4stian/linna-array/compare/v1.0.0...v1.0.1 ) - 2017-06-11
10
15
11
16
### Fixed
Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ class TypedArray extends ArrayObject
23
23
* @var array Types supported by class
24
24
*/
25
25
protected $ allowedTypes = [
26
- 'array ' ,
27
- 'bool ' ,
28
- 'callable ' ,
29
- 'float ' ,
30
- 'int ' ,
31
- 'object ' ,
32
- 'string ' ,
26
+ 'array ' => 1 ,
27
+ 'bool ' => 1 ,
28
+ 'callable ' => 1 ,
29
+ 'float ' => 1 ,
30
+ 'int ' => 1 ,
31
+ 'object ' => 1 ,
32
+ 'string ' => 1
33
33
];
34
34
35
35
/**
@@ -50,7 +50,7 @@ class TypedArray extends ArrayObject
50
50
public function __construct (string $ type , array $ array = [])
51
51
{
52
52
//single class, multi type support :)
53
- if (!in_array ( $ type , $ this ->allowedTypes )) {
53
+ if (!isset ( $ this ->allowedTypes [ $ type ] )) {
54
54
throw new InvalidArgumentException ($ type .' type passed to ' .__CLASS__ .' not supported ' );
55
55
}
56
56
You can’t perform that action at this time.
0 commit comments