@@ -60,7 +60,7 @@ |
||
60 | 60 | if (!method_exists(\ReflectionClass::class, $method)) |
61 | 61 | throw new \InvalidArgumentException('Cannot create closure from method ReflectionClass::' . $method . ', it does not exist'); |
62 | 62 | |
63 | - return function ($value) use ($method, $arguments) |
|
63 | + return function($value) use ($method, $arguments) |
|
64 | 64 | { |
65 | 65 | if (!Types::string()($value)) |
66 | 66 | return false; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function invert(\Closure $closure): \Closure |
19 | 19 | { |
20 | - return function ($value) use ($closure) |
|
20 | + return function($value) use ($closure) |
|
21 | 21 | { |
22 | 22 | return !$closure($value); |
23 | 23 | }; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function merge(\Closure $closure1, \Closure $closure2): \Closure |
33 | 33 | { |
34 | - return function ($value) use ($closure1, $closure2) |
|
34 | + return function($value) use ($closure1, $closure2) |
|
35 | 35 | { |
36 | 36 | return $closure1($value) || $closure2($value); |
37 | 37 | }; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public static function both(\Closure $closure1, \Closure $closure2): \Closure |
47 | 47 | { |
48 | - return function ($value) use ($closure1, $closure2) |
|
48 | + return function($value) use ($closure1, $closure2) |
|
49 | 49 | { |
50 | 50 | return $closure1($value) && $closure2($value); |
51 | 51 | }; |
@@ -73,7 +73,7 @@ |
||
73 | 73 | */ |
74 | 74 | public static function instanceof(string $class): \Closure |
75 | 75 | { |
76 | - return function ($value) use ($class) |
|
76 | + return function($value) use ($class) |
|
77 | 77 | { |
78 | 78 | return $value instanceof $class; |
79 | 79 | }; |
@@ -71,7 +71,7 @@ |
||
71 | 71 | */ |
72 | 72 | public static function numeric(): \Closure |
73 | 73 | { |
74 | - return \Closure::fromCallable('is_numeric'); |
|
74 | + return \Closure::fromCallable('is_numeric'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function intBetween(int $minimum, int $maximum): \Closure |
38 | 38 | { |
39 | - if ($maximum <= $minimum) |
|
40 | - throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
39 | + if ($maximum <= $minimum) |
|
40 | + throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
41 | 41 | |
42 | 42 | return function ($value) use ($minimum, $maximum) |
43 | 43 | { |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public static function intBetweenExclusive(int $minimum, int $maximum): \Closure |
55 | 55 | { |
56 | - if ($maximum <= $minimum) |
|
57 | - throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
56 | + if ($maximum <= $minimum) |
|
57 | + throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
58 | 58 | |
59 | - return function ($value) use ($minimum, $maximum) |
|
60 | - { |
|
61 | - return Types::int()($value) && ($value > $minimum && $value < $maximum); |
|
62 | - }; |
|
59 | + return function ($value) use ($minimum, $maximum) |
|
60 | + { |
|
61 | + return Types::int()($value) && ($value > $minimum && $value < $maximum); |
|
62 | + }; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public static function floatBetween(float $minimum, float $maximum): \Closure |
72 | 72 | { |
73 | - if ($maximum <= $minimum) |
|
74 | - throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
73 | + if ($maximum <= $minimum) |
|
74 | + throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
75 | 75 | |
76 | 76 | return function ($value) use ($minimum, $maximum) |
77 | 77 | { |
@@ -87,13 +87,13 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public static function floatBetweenExclusive(float $minimum, float $maximum): \Closure |
89 | 89 | { |
90 | - if ($maximum <= $minimum) |
|
91 | - throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
90 | + if ($maximum <= $minimum) |
|
91 | + throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
|
92 | 92 | |
93 | - return function ($value) use ($minimum, $maximum) |
|
94 | - { |
|
95 | - return Types::float()($value) && ($value > $minimum && $value < $maximum); |
|
96 | - }; |
|
93 | + return function ($value) use ($minimum, $maximum) |
|
94 | + { |
|
95 | + return Types::float()($value) && ($value > $minimum && $value < $maximum); |
|
96 | + }; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if ($maximumLength < 0 || $maximumLength < 1) |
23 | 23 | throw new \InvalidArgumentException('Minimum length cannot be below 0, maximum length cannot be below 1'); |
24 | 24 | |
25 | - return function ($value) use ($minimumLength, $maximumLength) |
|
25 | + return function($value) use ($minimumLength, $maximumLength) |
|
26 | 26 | { |
27 | 27 | return Types::string()($value) && static::intBetween($minimumLength, $maximumLength)(strlen($value)); |
28 | 28 | }; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if ($maximum <= $minimum) |
40 | 40 | throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
41 | 41 | |
42 | - return function ($value) use ($minimum, $maximum) |
|
42 | + return function($value) use ($minimum, $maximum) |
|
43 | 43 | { |
44 | 44 | return Types::int()($value) && ($value >= $minimum && $value <= $maximum); |
45 | 45 | }; |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | if ($maximum <= $minimum) |
57 | 57 | throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
58 | 58 | |
59 | - return function ($value) use ($minimum, $maximum) |
|
59 | + return function($value) use ($minimum, $maximum) |
|
60 | 60 | { |
61 | 61 | return Types::int()($value) && ($value > $minimum && $value < $maximum); |
62 | 62 | }; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | if ($maximum <= $minimum) |
74 | 74 | throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
75 | 75 | |
76 | - return function ($value) use ($minimum, $maximum) |
|
76 | + return function($value) use ($minimum, $maximum) |
|
77 | 77 | { |
78 | 78 | return Types::float()($value) && ($value >= $minimum && $value <= $maximum); |
79 | 79 | }; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | if ($maximum <= $minimum) |
91 | 91 | throw new \InvalidArgumentException('Maximum can not be lesser than or equal to minimum.'); |
92 | 92 | |
93 | - return function ($value) use ($minimum, $maximum) |
|
93 | + return function($value) use ($minimum, $maximum) |
|
94 | 94 | { |
95 | 95 | return Types::float()($value) && ($value > $minimum && $value < $maximum); |
96 | 96 | }; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public static function enum(...$allowedValues): \Closure |
105 | 105 | { |
106 | - return function ($value) use ($allowedValues) |
|
106 | + return function($value) use ($allowedValues) |
|
107 | 107 | { |
108 | 108 | return in_array($value, $allowedValues, true); |
109 | 109 | }; |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function typeEnum(...$allowedTypes): \Closure |
118 | 118 | { |
119 | - return function ($value) use ($allowedTypes) |
|
119 | + return function($value) use ($allowedTypes) |
|
120 | 120 | { |
121 | 121 | return in_array(gettype($value), $allowedTypes, true); |
122 | 122 | }; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | if (!Utils::validateArray(Types::string(), $allowedValues)) |
133 | 133 | throw new \InvalidArgumentException('Ranges::stringOneOf expects arguments of type string only'); |
134 | 134 | |
135 | - return function ($value) use ($allowedValues) |
|
135 | + return function($value) use ($allowedValues) |
|
136 | 136 | { |
137 | 137 | return Types::string() && in_array($value, $allowedValues); |
138 | 138 | }; |