@@ -25,7 +25,8 @@ discard block |
||
| 25 | 25 | { |
| 26 | 26 | public function setUp(): void |
| 27 | 27 | { |
| 28 | - if ((string)ini_get('zend.assertions') === 1) { |
|
| 28 | + if ((string)ini_get('zend.assertions') === 1) |
|
| 29 | + { |
|
| 29 | 30 | ini_set('zend.assertions', 0); |
| 30 | 31 | } |
| 31 | 32 | } |
@@ -37,7 +38,8 @@ discard block |
||
| 37 | 38 | $filename = $reflection->getFileName(); |
| 38 | 39 | $source = file_get_contents($filename); |
| 39 | 40 | |
| 40 | - try { |
|
| 41 | + try |
|
| 42 | + { |
|
| 41 | 43 | $i = new Injector(); |
| 42 | 44 | $printed = $i->injectDependencies( |
| 43 | 45 | file_get_contents($filename), |
@@ -49,7 +51,9 @@ discard block |
||
| 49 | 51 | $this->assertStringNotContainsString('private $test;', $printed); |
| 50 | 52 | $this->assertStringNotContainsString('private TestClass $test;', $printed); |
| 51 | 53 | // print_r($printed); |
| 52 | - } finally { |
|
| 54 | + } |
|
| 55 | + finally |
|
| 56 | + { |
|
| 53 | 57 | file_put_contents($filename, $source); |
| 54 | 58 | } |
| 55 | 59 | } |
@@ -59,9 +59,12 @@ discard block |
||
| 59 | 59 | $this->requested[$node->name->name] = $node->name->name; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if ($node instanceof Node\Stmt\Property) { |
|
| 63 | - foreach ($node->props as $prop) { |
|
| 64 | - if ($prop instanceof Node\Stmt\PropertyProperty) { |
|
| 62 | + if ($node instanceof Node\Stmt\Property) |
|
| 63 | + { |
|
| 64 | + foreach ($node->props as $prop) |
|
| 65 | + { |
|
| 66 | + if ($prop instanceof Node\Stmt\PropertyProperty) |
|
| 67 | + { |
|
| 65 | 68 | $this->properties[$prop->name->name] = $prop->name->name; |
| 66 | 69 | } |
| 67 | 70 | } |
@@ -72,17 +75,22 @@ discard block |
||
| 72 | 75 | |
| 73 | 76 | public function leaveNode(Node $node) |
| 74 | 77 | { |
| 75 | - if ($node instanceof Node\Stmt\ClassMethod) { |
|
| 78 | + if ($node instanceof Node\Stmt\ClassMethod) |
|
| 79 | + { |
|
| 76 | 80 | print_r($node); |
| 77 | - foreach ($node->stmts as $stmt) { |
|
| 81 | + foreach ($node->stmts as $stmt) |
|
| 82 | + { |
|
| 78 | 83 | if ( |
| 79 | 84 | $stmt instanceof Node\Expr\PropertyFetch && |
| 80 | 85 | $stmt->var instanceof Node\Expr\Variable && |
| 81 | 86 | $stmt->var->name === 'this' |
| 82 | 87 | ) { |
| 83 | - if (!isset($this->requested[$stmt->name->name])) { |
|
| 88 | + if (!isset($this->requested[$stmt->name->name])) |
|
| 89 | + { |
|
| 84 | 90 | $this->test[$stmt->name->name] = [(string)$node->name]; |
| 85 | - } else { |
|
| 91 | + } |
|
| 92 | + else |
|
| 93 | + { |
|
| 86 | 94 | $this->test[$stmt->name->name][] = (string)$node->name; |
| 87 | 95 | } |
| 88 | 96 | } |