@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | case is_array($var): |
36 | 36 | return 'array_'.md5(serialize($var)); |
37 | 37 | case is_resource($var): |
38 | - preg_match('/#([0-9]+)$/', (string)$var, $matches); |
|
38 | + preg_match('/#([0-9]+)$/', (string) $var, $matches); |
|
39 | 39 | return 'resource_'.$matches[1]; |
40 | 40 | case $var instanceof Generator: |
41 | 41 | return 'generator_'.spl_object_id($var); |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | case is_object($var): |
45 | 45 | return 'object_'.($strict ? spl_object_id($var) : md5(serialize($var))); |
46 | 46 | case gettype($var) === 'boolean': |
47 | - return 'boolean_'.(int)$var; |
|
47 | + return 'boolean_'.(int) $var; |
|
48 | 48 | case $strict: |
49 | 49 | return gettype($var).'_'.$var; |
50 | 50 | case !$var: |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | case strval($var) === '1': |
53 | 53 | return 'boolean_1'; |
54 | 54 | case is_numeric($var): |
55 | - return 'numeric_'.(float)$var; |
|
55 | + return 'numeric_'.(float) $var; |
|
56 | 56 | default: |
57 | 57 | return 'scalar_'.$var; |
58 | 58 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function get($container, string $key, $defaultValue = null) |
19 | 19 | { |
20 | - switch(true) { |
|
20 | + switch (true) { |
|
21 | 21 | case is_array($container): |
22 | 22 | return static::getFromArray($container, $key, $defaultValue); |
23 | 23 | case $container instanceof ArrayAccess: |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public static function exists($container, string $key): bool |
38 | 38 | { |
39 | - switch(true) { |
|
39 | + switch (true) { |
|
40 | 40 | case is_array($container): |
41 | 41 | return static::existsInArray($container, $key); |
42 | 42 | case $container instanceof ArrayAccess: |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | protected static function getFromArray(array $container, string $key, $defaultValue) |
58 | 58 | { |
59 | - if(static::existsInArray($container, $key)) { |
|
59 | + if (static::existsInArray($container, $key)) { |
|
60 | 60 | return $container[$key]; |
61 | 61 | } |
62 | 62 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | protected static function getFromArrayAccess(ArrayAccess $container, string $key, $defaultValue) |
85 | 85 | { |
86 | - if(static::existsInArrayAccess($container, $key)) { |
|
86 | + if (static::existsInArrayAccess($container, $key)) { |
|
87 | 87 | return $container[$key]; |
88 | 88 | } |
89 | 89 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | */ |
110 | 110 | protected static function getFromObject(object $container, string $key, $defaultValue) |
111 | 111 | { |
112 | - if(ObjectAccessor::hasAccessibleProperty($container, $key)) { |
|
112 | + if (ObjectAccessor::hasAccessibleProperty($container, $key)) { |
|
113 | 113 | return ObjectAccessor::getPropertyValue($container, $key); |
114 | 114 | } |
115 | 115 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public static function getPropertyValue(object $object, string $propertyName) |
22 | 22 | { |
23 | - if(static::hasPublicProperty($object, $propertyName)) { |
|
23 | + if (static::hasPublicProperty($object, $propertyName)) { |
|
24 | 24 | return $object->{$propertyName}; |
25 | 25 | } |
26 | 26 |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public static function cast(object $sourceObject, string $destinationClass) |
21 | 21 | { |
22 | - if(!class_exists($destinationClass)) { |
|
22 | + if (!class_exists($destinationClass)) { |
|
23 | 23 | throw new TypeError("Class '{$destinationClass}' does not exist"); |
24 | 24 | } |
25 | 25 | |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | // Unfortunately PHPstan has a problem with function is_subclass_of(). So: |
29 | 29 | // @phpstan-ignore-next-line |
30 | - if(!is_subclass_of($sourceClass, $destinationClass) && !is_subclass_of($destinationClass, $sourceClass)) { |
|
30 | + if (!is_subclass_of($sourceClass, $destinationClass) && !is_subclass_of($destinationClass, $sourceClass)) { |
|
31 | 31 | throw new TypeError("Classes '{$sourceClass}' and '{$destinationClass}' must be relatives"); |
32 | 32 | } |
33 | 33 |