@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | namespace TheSeer\Tokenizer; |
3 | 3 | |
4 | 4 | use PHPUnit\Framework\TestCase; |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | |
11 | 11 | public function testValidSourceGetsParsed() { |
12 | 12 | $tokenizer = new Tokenizer(); |
13 | - $result = $tokenizer->parse(file_get_contents(__DIR__ . '/_files/test.php')); |
|
13 | + $result = $tokenizer->parse(file_get_contents(__DIR__.'/_files/test.php')); |
|
14 | 14 | |
15 | 15 | $expected = unserialize( |
16 | - file_get_contents(__DIR__ . '/_files/test.php.tokens'), |
|
16 | + file_get_contents(__DIR__.'/_files/test.php.tokens'), |
|
17 | 17 | [TokenCollection::class] |
18 | 18 | ); |
19 | 19 | $this->assertEquals($expected, $result); |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types = 1); |
|
1 | +<?php declare(strict_types=1); |
|
2 | 2 | namespace TheSeer\Tokenizer; |
3 | 3 | |
4 | 4 | use PHPUnit\Framework\TestCase; |
@@ -64,11 +64,11 @@ |
||
64 | 64 | $namespace .= self::OPERATOR_NAMESPACE; |
65 | 65 | } |
66 | 66 | |
67 | - return new Fqsen(self::OPERATOR_NAMESPACE . $namespace . $type); |
|
67 | + return new Fqsen(self::OPERATOR_NAMESPACE.$namespace.$type); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | $typeParts[0] = $namespaceAliases[$typeParts[0]]; |
71 | 71 | |
72 | - return new Fqsen(self::OPERATOR_NAMESPACE . implode(self::OPERATOR_NAMESPACE, $typeParts)); |
|
72 | + return new Fqsen(self::OPERATOR_NAMESPACE.implode(self::OPERATOR_NAMESPACE, $typeParts)); |
|
73 | 73 | } |
74 | 74 | } |
@@ -58,9 +58,9 @@ |
||
58 | 58 | $objectType = (string) ($this->fqsen ?? 'object'); |
59 | 59 | |
60 | 60 | if ($this->keyType === null) { |
61 | - return $objectType . '<' . $this->valueType . '>'; |
|
61 | + return $objectType.'<'.$this->valueType.'>'; |
|
62 | 62 | } |
63 | 63 | |
64 | - return $objectType . '<' . $this->keyType . ',' . $this->valueType . '>'; |
|
64 | + return $objectType.'<'.$this->keyType.','.$this->valueType.'>'; |
|
65 | 65 | } |
66 | 66 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | if (strpos((string) $fqsen, '::') !== false || strpos((string) $fqsen, '()') !== false) { |
41 | 41 | throw new InvalidArgumentException( |
42 | 42 | 'Object types can only refer to a class, interface or trait but a method, function, constant or ' |
43 | - . 'property was received: ' . (string) $fqsen |
|
43 | + . 'property was received: '.(string) $fqsen |
|
44 | 44 | ); |
45 | 45 | } |
46 | 46 |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | return $this->createFromReflectionClassConstant($reflector); |
84 | 84 | } |
85 | 85 | |
86 | - throw new UnexpectedValueException('Unhandled \Reflector instance given: ' . get_class($reflector)); |
|
86 | + throw new UnexpectedValueException('Unhandled \Reflector instance given: '.get_class($reflector)); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | private function createFromReflectionParameter(ReflectionParameter $parameter) : Context |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | return $this->createFromReflectionClass($class); |
94 | 94 | } |
95 | 95 | |
96 | - throw new InvalidArgumentException('Unable to get class of ' . $parameter->getName()); |
|
96 | + throw new InvalidArgumentException('Unable to get class of '.$parameter->getName()); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | private function createFromReflectionMethod(ReflectionMethod $method) : Context |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (is_string($fileName) && file_exists($fileName)) { |
120 | 120 | $contents = file_get_contents($fileName); |
121 | 121 | if ($contents === false) { |
122 | - throw new RuntimeException('Unable to read file "' . $fileName . '"'); |
|
122 | + throw new RuntimeException('Unable to read file "'.$fileName.'"'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | return $this->createForNamespace($namespace, $contents); |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | case T_STRING: |
262 | 262 | case T_NS_SEPARATOR: |
263 | 263 | $currentNs .= $tokenValue; |
264 | - $currentAlias = $tokenValue; |
|
264 | + $currentAlias = $tokenValue; |
|
265 | 265 | break; |
266 | 266 | case T_CURLY_OPEN: |
267 | 267 | case '{': |
@@ -44,6 +44,6 @@ |
||
44 | 44 | */ |
45 | 45 | public function __toString() : string |
46 | 46 | { |
47 | - return '?' . $this->realType->__toString(); |
|
47 | + return '?'.$this->realType->__toString(); |
|
48 | 48 | } |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function __toString() : string |
70 | 70 | { |
71 | 71 | if ($this->keyType) { |
72 | - return 'array<' . $this->keyType . ',' . $this->valueType . '>'; |
|
72 | + return 'array<'.$this->keyType.','.$this->valueType.'>'; |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if ($this->valueType instanceof Mixed_) { |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | if ($this->valueType instanceof Compound) { |
80 | - return '(' . $this->valueType . ')[]'; |
|
80 | + return '('.$this->valueType.')[]'; |
|
81 | 81 | } |
82 | 82 | |
83 | - return $this->valueType . '[]'; |
|
83 | + return $this->valueType.'[]'; |
|
84 | 84 | } |
85 | 85 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | { |
123 | 123 | $type = trim($type); |
124 | 124 | if (!$type) { |
125 | - throw new InvalidArgumentException('Attempted to resolve "' . $type . '" but it appears to be empty'); |
|
125 | + throw new InvalidArgumentException('Attempted to resolve "'.$type.'" but it appears to be empty'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | if ($context === null) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | ); |
139 | 139 | |
140 | 140 | if ($tokens === false) { |
141 | - throw new InvalidArgumentException('Unable to split the type string "' . $type . '" into tokens'); |
|
141 | + throw new InvalidArgumentException('Unable to split the type string "'.$type.'" into tokens'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | $tokenIterator = new ArrayIterator($tokens); |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | default: |
294 | 294 | // I haven't got the foggiest how the logic would come here but added this as a defense. |
295 | 295 | throw new RuntimeException( |
296 | - 'Unable to resolve type "' . $type . '", there is no known method to resolve it' |
|
296 | + 'Unable to resolve type "'.$type.'", there is no known method to resolve it' |
|
297 | 297 | ); |
298 | 298 | } |
299 | 299 | |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | { |
308 | 308 | if (!class_exists($typeClassName)) { |
309 | 309 | throw new InvalidArgumentException( |
310 | - 'The Value Object that needs to be created with a keyword "' . $keyword . '" must be an existing class' |
|
311 | - . ' but we could not find the class ' . $typeClassName |
|
310 | + 'The Value Object that needs to be created with a keyword "'.$keyword.'" must be an existing class' |
|
311 | + . ' but we could not find the class '.$typeClassName |
|
312 | 312 | ); |
313 | 313 | } |
314 | 314 | |
315 | 315 | if (!in_array(Type::class, class_implements($typeClassName), true)) { |
316 | 316 | throw new InvalidArgumentException( |
317 | - 'The class "' . $typeClassName . '" must implement the interface "phpDocumentor\Reflection\Type"' |
|
317 | + 'The class "'.$typeClassName.'" must implement the interface "phpDocumentor\Reflection\Type"' |
|
318 | 318 | ); |
319 | 319 | } |
320 | 320 | |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if (!$isArray |
398 | 398 | && (!$classType instanceof Object_ || $classType->getFqsen() === null)) { |
399 | 399 | throw new RuntimeException( |
400 | - $classType . ' is not a collection' |
|
400 | + $classType.' is not a collection' |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | throw new RuntimeException( |
450 | - 'Unexpected character "' . $tokens->current() . '", ">" is missing' |
|
450 | + 'Unexpected character "'.$tokens->current().'", ">" is missing' |
|
451 | 451 | ); |
452 | 452 | } |
453 | 453 |