@@ -118,8 +118,8 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $eval = new ConstExprEvaluator($this->evaluator($file, $context)); |
| 120 | 120 | |
| 121 | - foreach ($groups as $group) { |
|
| 122 | - foreach ($group->attrs as $attr) { |
|
| 121 | + foreach ($groups as $group){ |
|
| 122 | + foreach ($group->attrs as $attr){ |
|
| 123 | 123 | $arguments = $this->parseAttributeArguments($attr, $file, $eval); |
| 124 | 124 | |
| 125 | 125 | yield new AttributePrototype($attr->name->toString(), $arguments); |
@@ -143,8 +143,8 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function read(string $file): string |
| 145 | 145 | { |
| 146 | - if (!\is_readable($file)) { |
|
| 147 | - throw new \InvalidArgumentException('Unable to read file "' . $file . '"'); |
|
| 146 | + if (!\is_readable($file)){ |
|
| 147 | + throw new \InvalidArgumentException('Unable to read file "'.$file.'"'); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | return \file_get_contents($file); |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | private function evaluator(string $file, array $context): \Closure |
| 159 | 159 | { |
| 160 | 160 | return static function (Expr $expr) use ($file, $context) { |
| 161 | - switch (\get_class($expr)) { |
|
| 161 | + switch (\get_class($expr)){ |
|
| 162 | 162 | case Scalar\MagicConst\File::class: |
| 163 | 163 | return $file; |
| 164 | 164 | |
@@ -172,19 +172,19 @@ discard block |
||
| 172 | 172 | $namespace = $context[self::CTX_NAMESPACE] ?? ''; |
| 173 | 173 | $function = $context[self::CTX_FUNCTION] ?? ''; |
| 174 | 174 | |
| 175 | - return \ltrim($namespace . '\\' . $function, '\\'); |
|
| 175 | + return \ltrim($namespace.'\\'.$function, '\\'); |
|
| 176 | 176 | |
| 177 | 177 | case Expr\ClassConstFetch::class: |
| 178 | 178 | $constant = $expr->name->toString(); |
| 179 | 179 | $class = $expr->class->toString(); |
| 180 | 180 | |
| 181 | - if (\strtolower($constant) === 'class') { |
|
| 181 | + if (\strtolower($constant) === 'class'){ |
|
| 182 | 182 | return $class; |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - $definition = $class . '::' . $constant; |
|
| 185 | + $definition = $class.'::'.$constant; |
|
| 186 | 186 | |
| 187 | - if (!\defined($definition)) { |
|
| 187 | + if (!\defined($definition)){ |
|
| 188 | 188 | $exception = new \ParseError(\sprintf(self::ERROR_BAD_CONSTANT, $definition)); |
| 189 | 189 | throw Exception::withLocation($exception, $file, $expr->getStartLine()); |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | return \constant($definition); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - if ($expr instanceof Scalar\MagicConst) { |
|
| 195 | + if ($expr instanceof Scalar\MagicConst){ |
|
| 196 | 196 | return $context[$expr->getName()] ?? ''; |
| 197 | 197 | } |
| 198 | 198 | |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | $hasNamedArguments = false; |
| 215 | 215 | $arguments = []; |
| 216 | 216 | |
| 217 | - foreach ($attr->args as $argument) { |
|
| 217 | + foreach ($attr->args as $argument){ |
|
| 218 | 218 | $value = $eval->evaluateDirectly($argument->value); |
| 219 | 219 | |
| 220 | - if ($argument->name === null) { |
|
| 220 | + if ($argument->name === null){ |
|
| 221 | 221 | $arguments[] = $value; |
| 222 | 222 | |
| 223 | - if ($hasNamedArguments) { |
|
| 223 | + if ($hasNamedArguments){ |
|
| 224 | 224 | $exception = new \ParseError(self::ERROR_NAMED_ARGUMENTS_ORDER); |
| 225 | 225 | throw Exception::withLocation($exception, $file, $argument->getStartLine()); |
| 226 | 226 | } |