Passed
Pull Request — master (#344)
by Valentin
09:29 queued 05:21
created
src/Prototype/tests/InjectorTest.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
             ini_set('zend.assertions', 0);
30 30
         }
31 31
     }
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         $filename = $reflection->getFileName();
38 38
         $source = file_get_contents($filename);
39 39
 
40
-        try {
40
+        try{
41 41
             $i = new Injector();
42 42
             $printed = $i->injectDependencies(
43 43
                 file_get_contents($filename),
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $this->assertStringNotContainsString('private $test;', $printed);
50 50
             $this->assertStringNotContainsString('private TestClass $test;', $printed);
51 51
 //            print_r($printed);
52
-        } finally {
52
+        }finally{
53 53
             file_put_contents($filename, $source);
54 54
         }
55 55
     }
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     {
63 63
         $i = new Injector();
64 64
 
65
-        $filename = __DIR__ . '/Fixtures/TestClass.php';
65
+        $filename = __DIR__.'/Fixtures/TestClass.php';
66 66
         $printed = $i->injectDependencies(
67 67
             file_get_contents($filename),
68 68
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     {
80 80
         $i = new Injector();
81 81
 
82
-        $filename = __DIR__ . '/Fixtures/TestEmptyClass.php';
82
+        $filename = __DIR__.'/Fixtures/TestEmptyClass.php';
83 83
         $content = file_get_contents($filename);
84 84
         $printed = $i->injectDependencies(
85 85
             file_get_contents($filename),
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     {
98 98
         $i = new Injector();
99 99
 
100
-        $filename = __DIR__ . '/Fixtures/TestClass.php';
100
+        $filename = __DIR__.'/Fixtures/TestClass.php';
101 101
         $r = $i->injectDependencies(
102 102
             file_get_contents($filename),
103 103
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     {
123 123
         $i = new Injector();
124 124
 
125
-        $filename = __DIR__ . '/Fixtures/ChildClass.php';
125
+        $filename = __DIR__.'/Fixtures/ChildClass.php';
126 126
         $r = $i->injectDependencies(
127 127
             file_get_contents($filename),
128 128
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     {
141 141
         $i = new Injector();
142 142
 
143
-        $filename = __DIR__ . '/Fixtures/ChildWithConstructorClass.php';
143
+        $filename = __DIR__.'/Fixtures/ChildWithConstructorClass.php';
144 144
         $r = $i->injectDependencies(
145 145
             file_get_contents($filename),
146 146
             $this->getDefinition($filename, ['testClass' => TestClass::class])
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function testModifyConstructor(): void
158 158
     {
159
-        $filename = __DIR__ . '/Fixtures/WithConstructor.php';
159
+        $filename = __DIR__.'/Fixtures/WithConstructor.php';
160 160
         $traverser = new Traverse\Extractor();
161 161
 
162 162
         $parameters = $traverser->extractFromFilename($filename);
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     public function testPriorOptionalConstructorParameters(): void
184 184
     {
185
-        $filename = __DIR__ . '/Fixtures/OptionalConstructorArgsClass.php';
185
+        $filename = __DIR__.'/Fixtures/OptionalConstructorArgsClass.php';
186 186
         $traverser = new Traverse\Extractor();
187 187
 
188 188
         $parameters = $traverser->extractFromFilename($filename);
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $i = new Injector();
215 215
 
216
-        $filename = __DIR__ . '/ClassNode/ConflictResolver/Fixtures/ChildClass.php';
216
+        $filename = __DIR__.'/ClassNode/ConflictResolver/Fixtures/ChildClass.php';
217 217
         $printed = $i->injectDependencies(
218 218
             file_get_contents($filename),
219 219
             $this->getDefinition(
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/LocateProperties.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     /** @var array */
26 26
     private $requested = [];
27 27
 
28
-    private $test=[];
28
+    private $test = [];
29 29
 
30 30
     /**
31 31
      * Get names of all virtual properties.
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
             $node instanceof Node\Expr\PropertyFetch &&
56 56
             $node->var instanceof Node\Expr\Variable &&
57 57
             $node->var->name === 'this'
58
-        ) {
58
+        ){
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
+            foreach ($node->props as $prop){
64
+                if ($prop instanceof Node\Stmt\PropertyProperty){
65 65
                     $this->properties[$prop->name->name] = $prop->name->name;
66 66
                 }
67 67
             }
@@ -72,17 +72,17 @@  discard block
 block discarded – undo
72 72
 
73 73
     public function leaveNode(Node $node)
74 74
     {
75
-        if ($node instanceof Node\Stmt\ClassMethod) {
75
+        if ($node instanceof Node\Stmt\ClassMethod){
76 76
             print_r($node);
77
-            foreach ($node->stmts as $stmt) {
77
+            foreach ($node->stmts as $stmt){
78 78
                 if (
79 79
                     $stmt instanceof Node\Expr\PropertyFetch &&
80 80
                     $stmt->var instanceof Node\Expr\Variable &&
81 81
                     $stmt->var->name === 'this'
82
-                ) {
83
-                    if (!isset($this->requested[$stmt->name->name])) {
82
+                ){
83
+                    if (!isset($this->requested[$stmt->name->name])){
84 84
                         $this->test[$stmt->name->name] = [(string)$node->name];
85
-                    } else {
85
+                    }else{
86 86
                         $this->test[$stmt->name->name][] = (string)$node->name;
87 87
                     }
88 88
                 }
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -59,9 +59,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.