@@ -56,16 +56,16 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * @var bool |
| 58 | 58 | */ |
| 59 | - private $disabledConstructor ; |
|
| 59 | + private $disabledConstructor; |
|
| 60 | 60 | |
| 61 | 61 | public function __construct(bool $publicOnly = true, bool $disabledConstructor = false) |
| 62 | 62 | { |
| 63 | 63 | $this->methodFlags = $publicOnly |
| 64 | 64 | ? ReflectionMethod::IS_PUBLIC |
| 65 | - : (ReflectionMethod::IS_PUBLIC|ReflectionMethod::IS_PROTECTED|ReflectionMethod::IS_PRIVATE); |
|
| 65 | + : (ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED | ReflectionMethod::IS_PRIVATE); |
|
| 66 | 66 | $this->propertyFlags = $publicOnly |
| 67 | 67 | ? ReflectionProperty::IS_PUBLIC |
| 68 | - : (ReflectionProperty::IS_PUBLIC|ReflectionProperty::IS_PROTECTED|ReflectionProperty::IS_PRIVATE); |
|
| 68 | + : (ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_PROTECTED | ReflectionProperty::IS_PRIVATE); |
|
| 69 | 69 | $this->disabledConstructor = $disabledConstructor; |
| 70 | 70 | $this->phpDocExtractor = new PhpDocExtractor(); |
| 71 | 71 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | protected function sort(array& $options) |
| 79 | 79 | { |
| 80 | - usort($options, function (PriorityAwareInterface $a, PriorityAwareInterface $b) { |
|
| 80 | + usort($options, function(PriorityAwareInterface $a, PriorityAwareInterface $b) { |
|
| 81 | 81 | return $b->getPriority() <=> $a->getPriority(); |
| 82 | 82 | }); |
| 83 | 83 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function getGetterMapping(ReflectionClass $reflectionClass): array |
| 104 | 104 | { |
| 105 | - $className= $reflectionClass->getName(); |
|
| 105 | + $className = $reflectionClass->getName(); |
|
| 106 | 106 | if (isset($this->getterCache[$className])) { |
| 107 | 107 | return $this->getterCache[$className]; |
| 108 | 108 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | protected function getSetterMapping(ReflectionClass $reflectionClass): array |
| 142 | 142 | { |
| 143 | - $className= $reflectionClass->getName(); |
|
| 143 | + $className = $reflectionClass->getName(); |
|
| 144 | 144 | if (isset($this->setterCache[$className])) { |
| 145 | 145 | return $this->setterCache[$className]; |
| 146 | 146 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } else { |
| 387 | 387 | $res = $this->getGetterTypes($reflectionClass, $parameter->name); |
| 388 | 388 | } |
| 389 | - return reset($res) ? : null; |
|
| 389 | + return reset($res) ?: null; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | return $this->cacheCheck( |
| 40 | 40 | __FUNCTION__ . ',' . $reflectionClass->name, |
| 41 | - function (ReflectionClass $reflectionClass) { |
|
| 41 | + function(ReflectionClass $reflectionClass) { |
|
| 42 | 42 | return $this->internal->getGetterFields($reflectionClass); |
| 43 | 43 | }, |
| 44 | 44 | $reflectionClass |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | return $this->cacheCheck( |
| 54 | 54 | __FUNCTION__ . ',' . $reflectionClass->name, |
| 55 | - function (ReflectionClass $reflectionClass) { |
|
| 55 | + function(ReflectionClass $reflectionClass) { |
|
| 56 | 56 | return $this->internal->getSetterFields($reflectionClass); |
| 57 | 57 | }, |
| 58 | 58 | $reflectionClass |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | { |
| 67 | 67 | return $this->cacheCheck( |
| 68 | 68 | __FUNCTION__ . ',' . $reflectionClass->name . ',' . $fieldName, |
| 69 | - function (ReflectionClass $reflectionClass, string $fieldName) { |
|
| 69 | + function(ReflectionClass $reflectionClass, string $fieldName) { |
|
| 70 | 70 | return $this->internal->getGetterTypes($reflectionClass, $fieldName); |
| 71 | 71 | }, |
| 72 | 72 | $reflectionClass, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 82 | return $this->cacheCheck( |
| 83 | 83 | __FUNCTION__ . ',' . $reflectionClass->name . ',' . $fieldName, |
| 84 | - function (ReflectionClass $reflectionClass, string $fieldName) { |
|
| 84 | + function(ReflectionClass $reflectionClass, string $fieldName) { |
|
| 85 | 85 | return $this->internal->getSetterTypes($reflectionClass, $fieldName); |
| 86 | 86 | }, |
| 87 | 87 | $reflectionClass, |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | return $this->cacheCheck( |
| 98 | 98 | __FUNCTION__ . ',' . $reflectionClass->name, |
| 99 | - function (ReflectionClass $reflectionClass) { |
|
| 99 | + function(ReflectionClass $reflectionClass) { |
|
| 100 | 100 | return $this->internal->getConstructorArguments($reflectionClass); |
| 101 | 101 | }, |
| 102 | 102 | $reflectionClass |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | { |
| 135 | 135 | return $this->cacheCheck( |
| 136 | 136 | __FUNCTION__ . ',' . $reflectionClass->name . ',' . $fieldName . ',' . json_encode($preferGetters), |
| 137 | - function (ReflectionClass $reflectionClass, string $fieldName, bool $preferGetters) { |
|
| 137 | + function(ReflectionClass $reflectionClass, string $fieldName, bool $preferGetters) { |
|
| 138 | 138 | return $this->internal->getDescription($reflectionClass, $fieldName, $preferGetters); |
| 139 | 139 | }, |
| 140 | 140 | $reflectionClass, |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | { |
| 151 | 151 | return $this->cacheCheck( |
| 152 | 152 | __FUNCTION__ . ',' . $reflectionClass->name, |
| 153 | - function (ReflectionClass $reflectionClass) { |
|
| 153 | + function(ReflectionClass $reflectionClass) { |
|
| 154 | 154 | if ($this->internal instanceof ObjectAccessSupportedInterface) { |
| 155 | 155 | return $this->internal->isSupported($reflectionClass); |
| 156 | 156 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | return $this->cacheCheck( |
| 170 | 170 | __FUNCTION__ . ',' . $method->name . ',' . ($reflectionClass ? $reflectionClass->name : '(null)'), |
| 171 | - function (ReflectionMethod $method, ?ReflectionClass $reflectionClass = null) { |
|
| 171 | + function(ReflectionMethod $method, ?ReflectionClass $reflectionClass = null) { |
|
| 172 | 172 | return $this->internal->getMethodArguments($method, $reflectionClass); |
| 173 | 173 | }, |
| 174 | 174 | $method, |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function getGetterFields(ReflectionClass $reflectionClass): array |
| 39 | 39 | { |
| 40 | 40 | $result = $this->objectAccess->getGetterFields($reflectionClass); |
| 41 | - return array_values(array_filter($result, function (string $fieldName) { |
|
| 41 | + return array_values(array_filter($result, function(string $fieldName) { |
|
| 42 | 42 | return isset($this->filteredFields[$fieldName]); |
| 43 | 43 | })); |
| 44 | 44 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | public function getSetterFields(ReflectionClass $reflectionClass): array |
| 50 | 50 | { |
| 51 | 51 | $result = $this->objectAccess->getSetterFields($reflectionClass); |
| 52 | - return array_values(array_filter($result, function (string $fieldName) { |
|
| 52 | + return array_values(array_filter($result, function(string $fieldName) { |
|
| 53 | 53 | return isset($this->filteredFields[$fieldName]); |
| 54 | 54 | })); |
| 55 | 55 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | bool $publicOnly = true, |
| 14 | 14 | bool $disabledConstructor = false |
| 15 | 15 | ) { |
| 16 | - $conversionFn = static function ($locale) { |
|
| 16 | + $conversionFn = static function($locale) { |
|
| 17 | 17 | return $locale === null ? 'en' : ((string) $locale); |
| 18 | 18 | }; |
| 19 | 19 | parent::__construct($localizationAware, $conversionFn, $publicOnly, $disabledConstructor); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | protected function getGetterMapping(ReflectionClass $reflectionClass): array |
| 43 | 43 | { |
| 44 | - $className= $reflectionClass->getName(); |
|
| 44 | + $className = $reflectionClass->getName(); |
|
| 45 | 45 | if (isset($this->getterCache[$className])) { |
| 46 | 46 | return $this->getterCache[$className]; |
| 47 | 47 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | protected function getSetterMapping(ReflectionClass $reflectionClass): array |
| 73 | 73 | { |
| 74 | - $className= $reflectionClass->getName(); |
|
| 74 | + $className = $reflectionClass->getName(); |
|
| 75 | 75 | if (isset($this->setterCache[$className])) { |
| 76 | 76 | return $this->setterCache[$className]; |
| 77 | 77 | } |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | public function getErrors(?Closure $callback = null): array |
| 111 | 111 | { |
| 112 | 112 | if (!$callback) { |
| 113 | - $callback = function (ErrorBagField $field) { |
|
| 113 | + $callback = function(ErrorBagField $field) { |
|
| 114 | 114 | return $field->getMessage(); |
| 115 | 115 | }; |
| 116 | 116 | } |
| 117 | 117 | return array_map( |
| 118 | - function (array $errors) use (&$callback) { |
|
| 118 | + function(array $errors) use (&$callback) { |
|
| 119 | 119 | return array_map($callback, $errors); |
| 120 | 120 | }, |
| 121 | 121 | $this->errors |
@@ -131,9 +131,9 @@ discard block |
||
| 131 | 131 | public function getExceptions(): array |
| 132 | 132 | { |
| 133 | 133 | return array_map( |
| 134 | - function (array $errors) { |
|
| 134 | + function(array $errors) { |
|
| 135 | 135 | return array_filter(array_map( |
| 136 | - function (ErrorBagField $field) { |
|
| 136 | + function(ErrorBagField $field) { |
|
| 137 | 137 | return $field->getSource(); |
| 138 | 138 | }, |
| 139 | 139 | $errors |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $this->exceptions = $this->errors->getExceptions(); |
| 34 | 34 | $tmp = reset($this->exceptions); |
| 35 | 35 | if ($tmp) { |
| 36 | - $previous = reset($tmp) ? : null; |
|
| 36 | + $previous = reset($tmp) ?: null; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | parent::__construct(422, 'A validation error occurred', $previous); |
@@ -257,7 +257,7 @@ |
||
| 257 | 257 | $result = []; |
| 258 | 258 | foreach ($objectAccess->getGetterFields($reflectionClass) as $denormalizedFieldName) { |
| 259 | 259 | $fieldName = $this->nameConverter->normalize($denormalizedFieldName, $reflectionClass->name, $format, $context); |
| 260 | - $value = $objectAccess->getValue($object, $denormalizedFieldName); |
|
| 260 | + $value = $objectAccess->getValue($object, $denormalizedFieldName); |
|
| 261 | 261 | // circular reference |
| 262 | 262 | if (is_object($value) && in_array($value, $context['object_hierarchy'], true)) { |
| 263 | 263 | continue; |