@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | private function read(string $file): string |
| 108 | 108 | { |
| 109 | - if (! \is_readable($file)) { |
|
| 110 | - throw new \InvalidArgumentException('Unable to read file "' . $file . '"'); |
|
| 109 | + if (!\is_readable($file)){ |
|
| 110 | + throw new \InvalidArgumentException('Unable to read file "'.$file.'"'); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return \file_get_contents($file); |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | { |
| 125 | 125 | $eval = new ConstExprEvaluator($this->evaluator($file, $context)); |
| 126 | 126 | |
| 127 | - foreach ($groups as $group) { |
|
| 128 | - foreach ($group->attrs as $attr) { |
|
| 127 | + foreach ($groups as $group){ |
|
| 128 | + foreach ($group->attrs as $attr){ |
|
| 129 | 129 | $arguments = $this->parseAttributeArguments($attr, $file, $eval); |
| 130 | 130 | |
| 131 | 131 | yield new AttributePrototype($attr->name->toString(), $arguments); |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | private function evaluator(string $file, array $context): \Closure |
| 142 | 142 | { |
| 143 | 143 | return static function (Expr $expr) use ($file, $context) { |
| 144 | - switch (\get_class($expr)) { |
|
| 144 | + switch (\get_class($expr)){ |
|
| 145 | 145 | case Scalar\MagicConst\File::class: |
| 146 | 146 | return $file; |
| 147 | 147 | |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | $namespace = $context[self::CTX_NAMESPACE] ?? ''; |
| 156 | 156 | $function = $context[self::CTX_FUNCTION] ?? ''; |
| 157 | 157 | |
| 158 | - return \ltrim($namespace . '\\' . $function, '\\'); |
|
| 158 | + return \ltrim($namespace.'\\'.$function, '\\'); |
|
| 159 | 159 | |
| 160 | 160 | case Expr\ClassConstFetch::class: |
| 161 | - $constant = $expr->class->toString() . '::' . $expr->name->toString(); |
|
| 161 | + $constant = $expr->class->toString().'::'.$expr->name->toString(); |
|
| 162 | 162 | |
| 163 | - if (! \defined($constant)) { |
|
| 163 | + if (!\defined($constant)){ |
|
| 164 | 164 | $exception = new \ParseError(\sprintf(self::ERROR_BAD_CONSTANT, $constant)); |
| 165 | 165 | throw Exception::withLocation($exception, $file, $expr->getStartLine()); |
| 166 | 166 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | return \constant($constant); |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | - if ($expr instanceof Scalar\MagicConst) { |
|
| 171 | + if ($expr instanceof Scalar\MagicConst){ |
|
| 172 | 172 | return $context[$expr->getName()] ?? ''; |
| 173 | 173 | } |
| 174 | 174 | |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | $hasNamedArguments = false; |
| 191 | 191 | $arguments = []; |
| 192 | 192 | |
| 193 | - foreach ($attr->args as $argument) { |
|
| 193 | + foreach ($attr->args as $argument){ |
|
| 194 | 194 | $value = $eval->evaluateDirectly($argument->value); |
| 195 | 195 | |
| 196 | - if ($argument->name === null) { |
|
| 196 | + if ($argument->name === null){ |
|
| 197 | 197 | $arguments[] = $value; |
| 198 | 198 | |
| 199 | - if ($hasNamedArguments) { |
|
| 199 | + if ($hasNamedArguments){ |
|
| 200 | 200 | $exception = new \ParseError(self::ERROR_NAMED_ARGUMENTS_ORDER); |
| 201 | 201 | throw Exception::withLocation($exception, $file, $argument->getStartLine()); |
| 202 | 202 | } |