@@ -24,7 +24,8 @@ |
||
| 24 | 24 | { |
| 25 | 25 | public function setUp(): void |
| 26 | 26 | { |
| 27 | - if ((string)ini_get('zend.assertions') === 1) { |
|
| 27 | + if ((string)ini_get('zend.assertions') === 1) |
|
| 28 | + { |
|
| 28 | 29 | ini_set('zend.assertions', 0); |
| 29 | 30 | } |
| 30 | 31 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | public function setUp(): void |
| 21 | 21 | { |
| 22 | - if ((string)ini_get('zend.assertions') === 1) { |
|
| 22 | + if ((string)ini_get('zend.assertions') === 1){ |
|
| 23 | 23 | ini_set('zend.assertions', 0); |
| 24 | 24 | } |
| 25 | 25 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | $i = new Injector(); |
| 34 | 34 | |
| 35 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
| 35 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
| 36 | 36 | $printed = $i->injectDependencies( |
| 37 | 37 | file_get_contents($filename), |
| 38 | 38 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $i = new Injector(); |
| 47 | 47 | |
| 48 | - $filename = __DIR__ . '/Fixtures/WithPromotedProperty.php'; |
|
| 48 | + $filename = __DIR__.'/Fixtures/WithPromotedProperty.php'; |
|
| 49 | 49 | $printed = $i->injectDependencies( |
| 50 | 50 | file_get_contents($filename), |
| 51 | 51 | $this->getDefinition($filename, ['two' => InjectionTwo::class]) |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | $i = new Injector(); |
| 67 | 67 | |
| 68 | - $filename = __DIR__ . '/Fixtures/TestEmptyClass.php'; |
|
| 68 | + $filename = __DIR__.'/Fixtures/TestEmptyClass.php'; |
|
| 69 | 69 | $content = file_get_contents($filename); |
| 70 | 70 | $printed = $i->injectDependencies( |
| 71 | 71 | file_get_contents($filename), |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $i = new Injector(); |
| 85 | 85 | |
| 86 | - $filename = __DIR__ . '/Fixtures/TestClass.php'; |
|
| 86 | + $filename = __DIR__.'/Fixtures/TestClass.php'; |
|
| 87 | 87 | $r = $i->injectDependencies( |
| 88 | 88 | file_get_contents($filename), |
| 89 | 89 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | { |
| 109 | 109 | $i = new Injector(); |
| 110 | 110 | |
| 111 | - $filename = __DIR__ . '/Fixtures/ChildClass.php'; |
|
| 111 | + $filename = __DIR__.'/Fixtures/ChildClass.php'; |
|
| 112 | 112 | $r = $i->injectDependencies( |
| 113 | 113 | file_get_contents($filename), |
| 114 | 114 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | { |
| 127 | 127 | $i = new Injector(); |
| 128 | 128 | |
| 129 | - $filename = __DIR__ . '/Fixtures/ChildWithConstructorClass.php'; |
|
| 129 | + $filename = __DIR__.'/Fixtures/ChildWithConstructorClass.php'; |
|
| 130 | 130 | $r = $i->injectDependencies( |
| 131 | 131 | file_get_contents($filename), |
| 132 | 132 | $this->getDefinition($filename, ['testClass' => TestClass::class]) |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function testModifyConstructor(): void |
| 144 | 144 | { |
| 145 | - $filename = __DIR__ . '/Fixtures/WithConstructor.php'; |
|
| 145 | + $filename = __DIR__.'/Fixtures/WithConstructor.php'; |
|
| 146 | 146 | $extractor = new Traverse\Extractor(); |
| 147 | 147 | |
| 148 | 148 | $parameters = $extractor->extractFromFilename($filename); |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function testPriorOptionalConstructorParameters(): void |
| 170 | 170 | { |
| 171 | - $filename = __DIR__ . '/Fixtures/OptionalConstructorArgsClass.php'; |
|
| 171 | + $filename = __DIR__.'/Fixtures/OptionalConstructorArgsClass.php'; |
|
| 172 | 172 | $extractor = new Traverse\Extractor(); |
| 173 | 173 | |
| 174 | 174 | $parameters = $extractor->extractFromFilename($filename); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | { |
| 200 | 200 | $i = new Injector(); |
| 201 | 201 | |
| 202 | - $filename = __DIR__ . '/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
| 202 | + $filename = __DIR__.'/ClassNode/ConflictResolver/Fixtures/ChildClass.php'; |
|
| 203 | 203 | $printed = $i->injectDependencies( |
| 204 | 204 | file_get_contents($filename), |
| 205 | 205 | $this->getDefinition( |
@@ -26,11 +26,11 @@ |
||
| 26 | 26 | |
| 27 | 27 | public function store(string $name): void |
| 28 | 28 | { |
| 29 | - $this->storage[$name] = file_get_contents($this->dir . $name); |
|
| 29 | + $this->storage[$name] = file_get_contents($this->dir.$name); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function restore(string $name): void |
| 33 | 33 | { |
| 34 | - file_put_contents($this->dir . $name, $this->storage[$name]); |
|
| 34 | + file_put_contents($this->dir.$name, $this->storage[$name]); |
|
| 35 | 35 | } |
| 36 | 36 | } |
@@ -57,12 +57,15 @@ |
||
| 57 | 57 | { |
| 58 | 58 | $line = 0; |
| 59 | 59 | |
| 60 | - for ($i = 0; $i < $offset; $i++) { |
|
| 61 | - if (!isset($content[$i])) { |
|
| 60 | + for ($i = 0; $i < $offset; $i++) |
|
| 61 | + { |
|
| 62 | + if (!isset($content[$i])) |
|
| 63 | + { |
|
| 62 | 64 | break; |
| 63 | 65 | } |
| 64 | 66 | |
| 65 | - if ($content[$i] === "\n") { |
|
| 67 | + if ($content[$i] === "\n") |
|
| 68 | + { |
|
| 66 | 69 | $line++; |
| 67 | 70 | } |
| 68 | 71 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | public function __construct( |
| 13 | 13 | private readonly string $content, |
| 14 | 14 | private readonly ?string $filename = null |
| 15 | - ) { |
|
| 15 | + ){ |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function getContent(): string |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | { |
| 30 | 30 | $line = 0; |
| 31 | 31 | |
| 32 | - for ($i = 0; $i < $offset; $i++) { |
|
| 33 | - if (!isset($content[$i])) { |
|
| 32 | + for ($i = 0; $i < $offset; $i++){ |
|
| 33 | + if (!isset($content[$i])){ |
|
| 34 | 34 | break; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if ($content[$i] === "\n") { |
|
| 37 | + if ($content[$i] === "\n"){ |
|
| 38 | 38 | $line++; |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -53,7 +53,8 @@ |
||
| 53 | 53 | */ |
| 54 | 54 | public function peak(): ?string |
| 55 | 55 | { |
| 56 | - if ($this->offset + 1 > $this->length) { |
|
| 56 | + if ($this->offset + 1 > $this->length) |
|
| 57 | + { |
|
| 57 | 58 | return null; |
| 58 | 59 | } |
| 59 | 60 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | public function __construct( |
| 15 | 15 | private readonly string $source |
| 16 | - ) { |
|
| 16 | + ){ |
|
| 17 | 17 | $this->length = \strlen($source); |
| 18 | 18 | $this->offset = 0; |
| 19 | 19 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | public function peak(): ?string |
| 35 | 35 | { |
| 36 | - if ($this->offset + 1 > $this->length) { |
|
| 36 | + if ($this->offset + 1 > $this->length){ |
|
| 37 | 37 | return null; |
| 38 | 38 | } |
| 39 | 39 | |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | $buffer = null; |
| 28 | 28 | $bufferOffset = 0; |
| 29 | 29 | |
| 30 | - foreach ($src as $n) { |
|
| 31 | - if ($n instanceof Byte) { |
|
| 32 | - if ($buffer === null) { |
|
| 30 | + foreach ($src as $n){ |
|
| 31 | + if ($n instanceof Byte){ |
|
| 32 | + if ($buffer === null){ |
|
| 33 | 33 | $buffer = ''; |
| 34 | 34 | $bufferOffset = $n->offset; |
| 35 | 35 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if ($buffer !== null) { |
|
| 41 | + if ($buffer !== null){ |
|
| 42 | 42 | yield new Token(Token::TYPE_RAW, $bufferOffset, $buffer); |
| 43 | 43 | $buffer = null; |
| 44 | 44 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | yield $n; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ($buffer !== null) { |
|
| 49 | + if ($buffer !== null){ |
|
| 50 | 50 | yield new Token(Token::TYPE_RAW, $bufferOffset, $buffer); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -27,9 +27,12 @@ discard block |
||
| 27 | 27 | $buffer = null; |
| 28 | 28 | $bufferOffset = 0; |
| 29 | 29 | |
| 30 | - foreach ($src as $n) { |
|
| 31 | - if ($n instanceof Byte) { |
|
| 32 | - if ($buffer === null) { |
|
| 30 | + foreach ($src as $n) |
|
| 31 | + { |
|
| 32 | + if ($n instanceof Byte) |
|
| 33 | + { |
|
| 34 | + if ($buffer === null) |
|
| 35 | + { |
|
| 33 | 36 | $buffer = ''; |
| 34 | 37 | $bufferOffset = $n->offset; |
| 35 | 38 | } |
@@ -38,7 +41,8 @@ discard block |
||
| 38 | 41 | continue; |
| 39 | 42 | } |
| 40 | 43 | |
| 41 | - if ($buffer !== null) { |
|
| 44 | + if ($buffer !== null) |
|
| 45 | + { |
|
| 42 | 46 | yield new Token(Token::TYPE_RAW, $bufferOffset, $buffer); |
| 43 | 47 | $buffer = null; |
| 44 | 48 | } |
@@ -46,7 +50,8 @@ discard block |
||
| 46 | 50 | yield $n; |
| 47 | 51 | } |
| 48 | 52 | |
| 49 | - if ($buffer !== null) { |
|
| 53 | + if ($buffer !== null) |
|
| 54 | + { |
|
| 50 | 55 | yield new Token(Token::TYPE_RAW, $bufferOffset, $buffer); |
| 51 | 56 | } |
| 52 | 57 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function testVerbatim4(): void |
| 105 | 105 | { |
| 106 | 106 | $this->assertSame( |
| 107 | - '<script>alert(<?php echo json_encode' . |
|
| 107 | + '<script>alert(<?php echo json_encode'. |
|
| 108 | 108 | '("hello\' \'world", JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT, 512); ?>)</script>', |
| 109 | 109 | $res = $this->compile('<script>alert({{ "hello\' \'world" }})</script>')->getContent() |
| 110 | 110 | ); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | { |
| 128 | 128 | ob_start(); |
| 129 | 129 | |
| 130 | - eval('?>' . $body); |
|
| 130 | + eval('?>'.$body); |
|
| 131 | 131 | |
| 132 | 132 | return ob_get_clean(); |
| 133 | 133 | } |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | 149 | $loader->set( |
| 150 | - 'grid' . DIRECTORY_SEPARATOR . 'render', |
|
| 150 | + 'grid'.DIRECTORY_SEPARATOR.'render', |
|
| 151 | 151 | ' |
| 152 | 152 | <table> |
| 153 | 153 | <thead> |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | ); |
| 163 | 163 | |
| 164 | 164 | $loader->set( |
| 165 | - 'grid' . DIRECTORY_SEPARATOR . 'cell', |
|
| 165 | + 'grid'.DIRECTORY_SEPARATOR.'cell', |
|
| 166 | 166 | ' |
| 167 | 167 | <stack:push name="head"><tr>${title}</tr></stack:push> |
| 168 | 168 | <stack:push name="body"><td>${context}</td></stack:push> |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 45 | 45 | |
| 46 | - try { |
|
| 46 | + try{ |
|
| 47 | 47 | $builder->compile('broken')->getContent(); |
| 48 | - } catch (ParserException $e) { |
|
| 48 | + }catch (ParserException $e){ |
|
| 49 | 49 | $this->assertInstanceOf(SyntaxException::class, $e->getPrevious()); |
| 50 | 50 | $this->assertStringContainsString('broken.dark.php', $e->getFile()); |
| 51 | 51 | $this->assertSame(3, $e->getLine()); |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | { |
| 57 | 57 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 58 | 58 | |
| 59 | - try { |
|
| 59 | + try{ |
|
| 60 | 60 | $builder->compile('import/bad-element'); |
| 61 | - } catch (ImportException $e) { |
|
| 61 | + }catch (ImportException $e){ |
|
| 62 | 62 | $this->assertStringContainsString('bad-element.dark.php', $e->getFile()); |
| 63 | 63 | $this->assertSame(1, $e->getLine()); |
| 64 | 64 | } |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 70 | 70 | |
| 71 | - try { |
|
| 71 | + try{ |
|
| 72 | 72 | $builder->compile('import/bad-element-3'); |
| 73 | - } catch (ImportException $e) { |
|
| 73 | + }catch (ImportException $e){ |
|
| 74 | 74 | $this->assertStringContainsString('bad-element-3.dark.php', $e->getFile()); |
| 75 | 75 | $this->assertSame(3, $e->getLine()); |
| 76 | 76 | } |
@@ -80,9 +80,9 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 82 | 82 | |
| 83 | - try { |
|
| 83 | + try{ |
|
| 84 | 84 | $builder->compile('import/bad-dir'); |
| 85 | - } catch (ImportException $e) { |
|
| 85 | + }catch (ImportException $e){ |
|
| 86 | 86 | $this->assertStringContainsString('bad-dir.dark.php', $e->getFile()); |
| 87 | 87 | $this->assertSame(1, $e->getLine()); |
| 88 | 88 | } |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 94 | 94 | |
| 95 | - try { |
|
| 95 | + try{ |
|
| 96 | 96 | $builder->compile('import/bad-dir-2'); |
| 97 | - } catch (ImportException $e) { |
|
| 97 | + }catch (ImportException $e){ |
|
| 98 | 98 | $this->assertStringContainsString('bad-dir-2.dark.php', $e->getFile()); |
| 99 | 99 | $this->assertSame(2, $e->getLine()); |
| 100 | 100 | } |
@@ -104,9 +104,9 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 106 | 106 | |
| 107 | - try { |
|
| 107 | + try{ |
|
| 108 | 108 | $builder->compile('bad-directive'); |
| 109 | - } catch (DirectiveException $e) { |
|
| 109 | + }catch (DirectiveException $e){ |
|
| 110 | 110 | $this->assertStringContainsString('bad-directive.dark.php', $e->getFile()); |
| 111 | 111 | $this->assertSame(2, $e->getLine()); |
| 112 | 112 | } |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 118 | 118 | |
| 119 | - try { |
|
| 119 | + try{ |
|
| 120 | 120 | $builder->compile('exception-in-import'); |
| 121 | - } catch (ImportException $e) { |
|
| 121 | + }catch (ImportException $e){ |
|
| 122 | 122 | $this->assertStringContainsString('exception-in-import.dark.php', $e->getFile()); |
| 123 | 123 | $this->assertSame(3, $e->getLine()); |
| 124 | 124 | |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 135 | 135 | |
| 136 | - try { |
|
| 136 | + try{ |
|
| 137 | 137 | $builder->compile('exception-in-import-2'); |
| 138 | - } catch (ImportException $e) { |
|
| 138 | + }catch (ImportException $e){ |
|
| 139 | 139 | $this->assertInstanceOf(ImportException::class, $e); |
| 140 | 140 | $this->assertStringContainsString('exception-in-import-2.dark.php', $e->getFile()); |
| 141 | 141 | $this->assertSame(3, $e->getLine()); |
@@ -151,9 +151,9 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 153 | 153 | |
| 154 | - try { |
|
| 154 | + try{ |
|
| 155 | 155 | $builder->compile('bad-extends'); |
| 156 | - } catch (ExtendsException $e) { |
|
| 156 | + }catch (ExtendsException $e){ |
|
| 157 | 157 | $this->assertStringContainsString('bad-extends.dark.php', $e->getFile()); |
| 158 | 158 | $this->assertSame(1, $e->getLine()); |
| 159 | 159 | |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | { |
| 166 | 166 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 167 | 167 | |
| 168 | - try { |
|
| 168 | + try{ |
|
| 169 | 169 | $builder->compile('bad-extends-2'); |
| 170 | - } catch (ExtendsException $e) { |
|
| 170 | + }catch (ExtendsException $e){ |
|
| 171 | 171 | $this->assertInstanceOf(ExtendsException::class, $e); |
| 172 | 172 | $this->assertStringContainsString('bad-extends-2.dark.php', $e->getFile()); |
| 173 | 173 | $this->assertSame(1, $e->getLine()); |
@@ -43,9 +43,12 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 45 | 45 | |
| 46 | - try { |
|
| 46 | + try |
|
| 47 | + { |
|
| 47 | 48 | $builder->compile('broken')->getContent(); |
| 48 | - } catch (ParserException $e) { |
|
| 49 | + } |
|
| 50 | + catch (ParserException $e) |
|
| 51 | + { |
|
| 49 | 52 | $this->assertInstanceOf(SyntaxException::class, $e->getPrevious()); |
| 50 | 53 | $this->assertStringContainsString('broken.dark.php', $e->getFile()); |
| 51 | 54 | $this->assertSame(3, $e->getLine()); |
@@ -56,9 +59,12 @@ discard block |
||
| 56 | 59 | { |
| 57 | 60 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 58 | 61 | |
| 59 | - try { |
|
| 62 | + try |
|
| 63 | + { |
|
| 60 | 64 | $builder->compile('import/bad-element'); |
| 61 | - } catch (ImportException $e) { |
|
| 65 | + } |
|
| 66 | + catch (ImportException $e) |
|
| 67 | + { |
|
| 62 | 68 | $this->assertStringContainsString('bad-element.dark.php', $e->getFile()); |
| 63 | 69 | $this->assertSame(1, $e->getLine()); |
| 64 | 70 | } |
@@ -68,9 +74,12 @@ discard block |
||
| 68 | 74 | { |
| 69 | 75 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 70 | 76 | |
| 71 | - try { |
|
| 77 | + try |
|
| 78 | + { |
|
| 72 | 79 | $builder->compile('import/bad-element-3'); |
| 73 | - } catch (ImportException $e) { |
|
| 80 | + } |
|
| 81 | + catch (ImportException $e) |
|
| 82 | + { |
|
| 74 | 83 | $this->assertStringContainsString('bad-element-3.dark.php', $e->getFile()); |
| 75 | 84 | $this->assertSame(3, $e->getLine()); |
| 76 | 85 | } |
@@ -80,9 +89,12 @@ discard block |
||
| 80 | 89 | { |
| 81 | 90 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 82 | 91 | |
| 83 | - try { |
|
| 92 | + try |
|
| 93 | + { |
|
| 84 | 94 | $builder->compile('import/bad-dir'); |
| 85 | - } catch (ImportException $e) { |
|
| 95 | + } |
|
| 96 | + catch (ImportException $e) |
|
| 97 | + { |
|
| 86 | 98 | $this->assertStringContainsString('bad-dir.dark.php', $e->getFile()); |
| 87 | 99 | $this->assertSame(1, $e->getLine()); |
| 88 | 100 | } |
@@ -92,9 +104,12 @@ discard block |
||
| 92 | 104 | { |
| 93 | 105 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 94 | 106 | |
| 95 | - try { |
|
| 107 | + try |
|
| 108 | + { |
|
| 96 | 109 | $builder->compile('import/bad-dir-2'); |
| 97 | - } catch (ImportException $e) { |
|
| 110 | + } |
|
| 111 | + catch (ImportException $e) |
|
| 112 | + { |
|
| 98 | 113 | $this->assertStringContainsString('bad-dir-2.dark.php', $e->getFile()); |
| 99 | 114 | $this->assertSame(2, $e->getLine()); |
| 100 | 115 | } |
@@ -104,9 +119,12 @@ discard block |
||
| 104 | 119 | { |
| 105 | 120 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 106 | 121 | |
| 107 | - try { |
|
| 122 | + try |
|
| 123 | + { |
|
| 108 | 124 | $builder->compile('bad-directive'); |
| 109 | - } catch (DirectiveException $e) { |
|
| 125 | + } |
|
| 126 | + catch (DirectiveException $e) |
|
| 127 | + { |
|
| 110 | 128 | $this->assertStringContainsString('bad-directive.dark.php', $e->getFile()); |
| 111 | 129 | $this->assertSame(2, $e->getLine()); |
| 112 | 130 | } |
@@ -116,9 +134,12 @@ discard block |
||
| 116 | 134 | { |
| 117 | 135 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 118 | 136 | |
| 119 | - try { |
|
| 137 | + try |
|
| 138 | + { |
|
| 120 | 139 | $builder->compile('exception-in-import'); |
| 121 | - } catch (ImportException $e) { |
|
| 140 | + } |
|
| 141 | + catch (ImportException $e) |
|
| 142 | + { |
|
| 122 | 143 | $this->assertStringContainsString('exception-in-import.dark.php', $e->getFile()); |
| 123 | 144 | $this->assertSame(3, $e->getLine()); |
| 124 | 145 | |
@@ -133,9 +154,12 @@ discard block |
||
| 133 | 154 | { |
| 134 | 155 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 135 | 156 | |
| 136 | - try { |
|
| 157 | + try |
|
| 158 | + { |
|
| 137 | 159 | $builder->compile('exception-in-import-2'); |
| 138 | - } catch (ImportException $e) { |
|
| 160 | + } |
|
| 161 | + catch (ImportException $e) |
|
| 162 | + { |
|
| 139 | 163 | $this->assertInstanceOf(ImportException::class, $e); |
| 140 | 164 | $this->assertStringContainsString('exception-in-import-2.dark.php', $e->getFile()); |
| 141 | 165 | $this->assertSame(3, $e->getLine()); |
@@ -151,9 +175,12 @@ discard block |
||
| 151 | 175 | { |
| 152 | 176 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 153 | 177 | |
| 154 | - try { |
|
| 178 | + try |
|
| 179 | + { |
|
| 155 | 180 | $builder->compile('bad-extends'); |
| 156 | - } catch (ExtendsException $e) { |
|
| 181 | + } |
|
| 182 | + catch (ExtendsException $e) |
|
| 183 | + { |
|
| 157 | 184 | $this->assertStringContainsString('bad-extends.dark.php', $e->getFile()); |
| 158 | 185 | $this->assertSame(1, $e->getLine()); |
| 159 | 186 | |
@@ -165,9 +192,12 @@ discard block |
||
| 165 | 192 | { |
| 166 | 193 | $builder = $this->getBuilder($this->getFixtureLoader()); |
| 167 | 194 | |
| 168 | - try { |
|
| 195 | + try |
|
| 196 | + { |
|
| 169 | 197 | $builder->compile('bad-extends-2'); |
| 170 | - } catch (ExtendsException $e) { |
|
| 198 | + } |
|
| 199 | + catch (ExtendsException $e) |
|
| 200 | + { |
|
| 171 | 201 | $this->assertInstanceOf(ExtendsException::class, $e); |
| 172 | 202 | $this->assertStringContainsString('bad-extends-2.dark.php', $e->getFile()); |
| 173 | 203 | $this->assertSame(1, $e->getLine()); |
@@ -24,19 +24,19 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function leaveNode(Node $node): void |
| 26 | 26 | { |
| 27 | - if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct') { |
|
| 28 | - foreach ($node->params as $param) { |
|
| 29 | - if ($param->type instanceof Node\NullableType) { |
|
| 30 | - if ($param->type->type instanceof Node\Identifier) { |
|
| 27 | + if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct'){ |
|
| 28 | + foreach ($node->params as $param){ |
|
| 29 | + if ($param->type instanceof Node\NullableType){ |
|
| 30 | + if ($param->type->type instanceof Node\Identifier){ |
|
| 31 | 31 | $type = $param->type->type->name; |
| 32 | - } else { |
|
| 32 | + }else{ |
|
| 33 | 33 | $type = implode('\\', $param->type->type->parts); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $type = "?$type"; |
| 37 | - } elseif ($param->type instanceof Node\Name) { |
|
| 37 | + } elseif ($param->type instanceof Node\Name){ |
|
| 38 | 38 | $type = implode('\\', $param->type->parts); |
| 39 | - } else { |
|
| 39 | + }else{ |
|
| 40 | 40 | $type = $param->type->name ?? null; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -24,19 +24,29 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function leaveNode(Node $node): void |
| 26 | 26 | { |
| 27 | - if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct') { |
|
| 28 | - foreach ($node->params as $param) { |
|
| 29 | - if ($param->type instanceof Node\NullableType) { |
|
| 30 | - if ($param->type->type instanceof Node\Identifier) { |
|
| 27 | + if ($node instanceof Node\Stmt\ClassMethod && $node->name->name === '__construct') |
|
| 28 | + { |
|
| 29 | + foreach ($node->params as $param) |
|
| 30 | + { |
|
| 31 | + if ($param->type instanceof Node\NullableType) |
|
| 32 | + { |
|
| 33 | + if ($param->type->type instanceof Node\Identifier) |
|
| 34 | + { |
|
| 31 | 35 | $type = $param->type->type->name; |
| 32 | - } else { |
|
| 36 | + } |
|
| 37 | + else |
|
| 38 | + { |
|
| 33 | 39 | $type = implode('\\', $param->type->type->parts); |
| 34 | 40 | } |
| 35 | 41 | |
| 36 | 42 | $type = "?$type"; |
| 37 | - } elseif ($param->type instanceof Node\Name) { |
|
| 43 | + } |
|
| 44 | + elseif ($param->type instanceof Node\Name) |
|
| 45 | + { |
|
| 38 | 46 | $type = implode('\\', $param->type->parts); |
| 39 | - } else { |
|
| 47 | + } |
|
| 48 | + else |
|
| 49 | + { |
|
| 40 | 50 | $type = $param->type->name ?? null; |
| 41 | 51 | } |
| 42 | 52 | |