Passed
Push — master ( 347780...7c17cc )
by butschster
07:14
created
src/Prototype/src/NodeVisitors/UpdateConstructor.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -20,18 +20,18 @@  discard block
 block discarded – undo
20 20
 {
21 21
     public function __construct(
22 22
         private readonly ClassNode $definition
23
-    ) {
23
+    ){
24 24
     }
25 25
 
26
-    public function leaveNode(Node $node): int|Node|null
26
+    public function leaveNode(Node $node): int | Node | null
27 27
     {
28
-        if (!$node instanceof Node\Stmt\Class_) {
28
+        if (!$node instanceof Node\Stmt\Class_){
29 29
             return null;
30 30
         }
31 31
 
32 32
         $constructor = $this->getConstructorAttribute($node);
33 33
         $this->addDependencies($constructor);
34
-        if (!$this->definition->hasConstructor && $this->definition->constructorParams) {
34
+        if (!$this->definition->hasConstructor && $this->definition->constructorParams){
35 35
             $this->addParentConstructorCall($constructor);
36 36
         }
37 37
 
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
      */
48 48
     private function addDependencies(Node\Stmt\ClassMethod $constructor): void
49 49
     {
50
-        foreach ($this->definition->dependencies as $dependency) {
50
+        foreach ($this->definition->dependencies as $dependency){
51 51
             \array_unshift($constructor->params, $this->buildConstructorParam($dependency));
52 52
             \array_unshift(
53 53
                 $constructor->stmts,
@@ -70,34 +70,34 @@  discard block
 block discarded – undo
70 70
     private function addParentConstructorCall(Node\Stmt\ClassMethod $constructor): void
71 71
     {
72 72
         $parentConstructorDependencies = [];
73
-        foreach ($this->definition->constructorParams as $param) {
73
+        foreach ($this->definition->constructorParams as $param){
74 74
             $parentConstructorDependencies[] = new Node\Arg(new Node\Expr\Variable($param->name));
75 75
 
76 76
             $cp = new Param($param->name);
77
-            if (!empty($param->type)) {
77
+            if (!empty($param->type)){
78 78
                 $type = $this->getParamType($param);
79
-                if ($param->nullable) {
79
+                if ($param->nullable){
80 80
                     $type = \sprintf('?%s', $type);
81 81
                 }
82 82
 
83 83
                 $cp->setType(new Node\Name($type));
84 84
             }
85 85
 
86
-            if ($param->byRef) {
86
+            if ($param->byRef){
87 87
                 $cp->makeByRef();
88 88
             }
89 89
 
90
-            if ($param->isVariadic) {
90
+            if ($param->isVariadic){
91 91
                 $cp->makeVariadic();
92 92
             }
93 93
 
94
-            if ($param->hasDefault) {
94
+            if ($param->hasDefault){
95 95
                 $cp->setDefault($param->default);
96 96
             }
97 97
             $constructor->params[] = $cp->getNode();
98 98
         }
99 99
 
100
-        if ($parentConstructorDependencies !== []) {
100
+        if ($parentConstructorDependencies !== []){
101 101
             \array_unshift(
102 102
                 $constructor->stmts,
103 103
                 new Node\Stmt\Expression(
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
 
126 126
         $params = [];
127 127
 
128
-        foreach ($this->definition->dependencies as $dependency) {
128
+        foreach ($this->definition->dependencies as $dependency){
129 129
             $params[] = new Annotation\Line(
130 130
                 \sprintf('%s $%s', $this->getPropertyType($dependency), $dependency->var),
131 131
                 'param'
132 132
             );
133 133
         }
134 134
 
135
-        if (!$this->definition->hasConstructor) {
136
-            foreach ($this->definition->constructorParams as $param) {
137
-                if (!empty($param->type)) {
135
+        if (!$this->definition->hasConstructor){
136
+            foreach ($this->definition->constructorParams as $param){
137
+                if (!empty($param->type)){
138 138
                     $type = $this->getParamType($param);
139
-                    if ($param->nullable) {
139
+                    if ($param->nullable){
140 140
                         $type = \sprintf('%s|null', $type);
141 141
                     }
142 142
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                         \sprintf($param->isVariadic ? '%s ...$%s' : '%s $%s', $type, $param->name),
145 145
                         'param'
146 146
                     );
147
-                } else {
147
+                }else{
148 148
                     $params[] = new Annotation\Line(
149 149
                         \sprintf('$%s', $param->name),
150 150
                         'param'
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
 
156 156
         $placementID = 0;
157 157
         $previous = null;
158
-        foreach ($an->lines as $index => $line) {
158
+        foreach ($an->lines as $index => $line){
159 159
             // always next node
160 160
             $placementID = $index + 1;
161 161
 
162 162
             // inject before this parameters
163
-            if ($line->is(['throws', 'return'])) {
163
+            if ($line->is(['throws', 'return'])){
164 164
                 // insert before given node
165 165
                 $placementID--;
166 166
                 break;
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
             $previous = $line;
170 170
         }
171 171
 
172
-        if ($previous !== null && !$previous->isEmpty()) {
172
+        if ($previous !== null && !$previous->isEmpty()){
173 173
             $placementID++;
174 174
         }
175 175
 
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
 
181 181
     private function getPropertyType(Dependency $dependency): string
182 182
     {
183
-        foreach ($this->definition->getStmts() as $stmt) {
184
-            if ($stmt->name === $dependency->type->fullName && $stmt->alias) {
183
+        foreach ($this->definition->getStmts() as $stmt){
184
+            if ($stmt->name === $dependency->type->fullName && $stmt->alias){
185 185
                 return $stmt->alias;
186 186
             }
187 187
         }
@@ -191,13 +191,13 @@  discard block
 block discarded – undo
191 191
 
192 192
     private function getParamType(ClassNode\ConstructorParam $param): string
193 193
     {
194
-        foreach ($this->definition->getStmts() as $stmt) {
195
-            if ($stmt->name === $param->type->fullName && $stmt->alias) {
194
+        foreach ($this->definition->getStmts() as $stmt){
195
+            if ($stmt->name === $param->type->fullName && $stmt->alias){
196 196
                 return $stmt->alias;
197 197
             }
198 198
         }
199 199
 
200
-        if ($param->type->alias) {
200
+        if ($param->type->alias){
201 201
             return $param->type->alias;
202 202
         }
203 203
 
Please login to merge, or discard this patch.
Braces   +49 added lines, -24 removed lines patch added patch discarded remove patch
@@ -25,13 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
     public function leaveNode(Node $node): int|Node|null
27 27
     {
28
-        if (!$node instanceof Node\Stmt\Class_) {
28
+        if (!$node instanceof Node\Stmt\Class_)
29
+        {
29 30
             return null;
30 31
         }
31 32
 
32 33
         $constructor = $this->getConstructorAttribute($node);
33 34
         $this->addDependencies($constructor);
34
-        if (!$this->definition->hasConstructor && $this->definition->constructorParams) {
35
+        if (!$this->definition->hasConstructor && $this->definition->constructorParams)
36
+        {
35 37
             $this->addParentConstructorCall($constructor);
36 38
         }
37 39
 
@@ -47,7 +49,8 @@  discard block
 block discarded – undo
47 49
      */
48 50
     private function addDependencies(Node\Stmt\ClassMethod $constructor): void
49 51
     {
50
-        foreach ($this->definition->dependencies as $dependency) {
52
+        foreach ($this->definition->dependencies as $dependency)
53
+        {
51 54
             \array_unshift($constructor->params, $this->buildConstructorParam($dependency));
52 55
             \array_unshift(
53 56
                 $constructor->stmts,
@@ -70,34 +73,41 @@  discard block
 block discarded – undo
70 73
     private function addParentConstructorCall(Node\Stmt\ClassMethod $constructor): void
71 74
     {
72 75
         $parentConstructorDependencies = [];
73
-        foreach ($this->definition->constructorParams as $param) {
76
+        foreach ($this->definition->constructorParams as $param)
77
+        {
74 78
             $parentConstructorDependencies[] = new Node\Arg(new Node\Expr\Variable($param->name));
75 79
 
76 80
             $cp = new Param($param->name);
77
-            if (!empty($param->type)) {
81
+            if (!empty($param->type))
82
+            {
78 83
                 $type = $this->getParamType($param);
79
-                if ($param->nullable) {
84
+                if ($param->nullable)
85
+                {
80 86
                     $type = \sprintf('?%s', $type);
81 87
                 }
82 88
 
83 89
                 $cp->setType(new Node\Name($type));
84 90
             }
85 91
 
86
-            if ($param->byRef) {
92
+            if ($param->byRef)
93
+            {
87 94
                 $cp->makeByRef();
88 95
             }
89 96
 
90
-            if ($param->isVariadic) {
97
+            if ($param->isVariadic)
98
+            {
91 99
                 $cp->makeVariadic();
92 100
             }
93 101
 
94
-            if ($param->hasDefault) {
102
+            if ($param->hasDefault)
103
+            {
95 104
                 $cp->setDefault($param->default);
96 105
             }
97 106
             $constructor->params[] = $cp->getNode();
98 107
         }
99 108
 
100
-        if ($parentConstructorDependencies !== []) {
109
+        if ($parentConstructorDependencies !== [])
110
+        {
101 111
             \array_unshift(
102 112
                 $constructor->stmts,
103 113
                 new Node\Stmt\Expression(
@@ -125,18 +135,23 @@  discard block
 block discarded – undo
125 135
 
126 136
         $params = [];
127 137
 
128
-        foreach ($this->definition->dependencies as $dependency) {
138
+        foreach ($this->definition->dependencies as $dependency)
139
+        {
129 140
             $params[] = new Annotation\Line(
130 141
                 \sprintf('%s $%s', $this->getPropertyType($dependency), $dependency->var),
131 142
                 'param'
132 143
             );
133 144
         }
134 145
 
135
-        if (!$this->definition->hasConstructor) {
136
-            foreach ($this->definition->constructorParams as $param) {
137
-                if (!empty($param->type)) {
146
+        if (!$this->definition->hasConstructor)
147
+        {
148
+            foreach ($this->definition->constructorParams as $param)
149
+            {
150
+                if (!empty($param->type))
151
+                {
138 152
                     $type = $this->getParamType($param);
139
-                    if ($param->nullable) {
153
+                    if ($param->nullable)
154
+                    {
140 155
                         $type = \sprintf('%s|null', $type);
141 156
                     }
142 157
 
@@ -144,7 +159,9 @@  discard block
 block discarded – undo
144 159
                         \sprintf($param->isVariadic ? '%s ...$%s' : '%s $%s', $type, $param->name),
145 160
                         'param'
146 161
                     );
147
-                } else {
162
+                }
163
+                else
164
+                {
148 165
                     $params[] = new Annotation\Line(
149 166
                         \sprintf('$%s', $param->name),
150 167
                         'param'
@@ -155,12 +172,14 @@  discard block
 block discarded – undo
155 172
 
156 173
         $placementID = 0;
157 174
         $previous = null;
158
-        foreach ($an->lines as $index => $line) {
175
+        foreach ($an->lines as $index => $line)
176
+        {
159 177
             // always next node
160 178
             $placementID = $index + 1;
161 179
 
162 180
             // inject before this parameters
163
-            if ($line->is(['throws', 'return'])) {
181
+            if ($line->is(['throws', 'return']))
182
+            {
164 183
                 // insert before given node
165 184
                 $placementID--;
166 185
                 break;
@@ -169,7 +188,8 @@  discard block
 block discarded – undo
169 188
             $previous = $line;
170 189
         }
171 190
 
172
-        if ($previous !== null && !$previous->isEmpty()) {
191
+        if ($previous !== null && !$previous->isEmpty())
192
+        {
173 193
             $placementID++;
174 194
         }
175 195
 
@@ -180,8 +200,10 @@  discard block
 block discarded – undo
180 200
 
181 201
     private function getPropertyType(Dependency $dependency): string
182 202
     {
183
-        foreach ($this->definition->getStmts() as $stmt) {
184
-            if ($stmt->name === $dependency->type->fullName && $stmt->alias) {
203
+        foreach ($this->definition->getStmts() as $stmt)
204
+        {
205
+            if ($stmt->name === $dependency->type->fullName && $stmt->alias)
206
+            {
185 207
                 return $stmt->alias;
186 208
             }
187 209
         }
@@ -191,13 +213,16 @@  discard block
 block discarded – undo
191 213
 
192 214
     private function getParamType(ClassNode\ConstructorParam $param): string
193 215
     {
194
-        foreach ($this->definition->getStmts() as $stmt) {
195
-            if ($stmt->name === $param->type->fullName && $stmt->alias) {
216
+        foreach ($this->definition->getStmts() as $stmt)
217
+        {
218
+            if ($stmt->name === $param->type->fullName && $stmt->alias)
219
+            {
196 220
                 return $stmt->alias;
197 221
             }
198 222
         }
199 223
 
200
-        if ($param->type->alias) {
224
+        if ($param->type->alias)
225
+        {
201 226
             return $param->type->alias;
202 227
         }
203 228
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/DefineConstructor.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): ?Node
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Class_) {
19
+        if (!$node instanceof Node\Stmt\Class_){
20 20
             return null;
21 21
         }
22 22
 
23 23
         $placementID = 0;
24
-        foreach ($node->stmts as $index => $child) {
24
+        foreach ($node->stmts as $index => $child){
25 25
             $placementID = $index;
26
-            if ($child instanceof Node\Stmt\ClassMethod) {
27
-                if ($child->name->name === '__construct') {
26
+            if ($child instanceof Node\Stmt\ClassMethod){
27
+                if ($child->name->name === '__construct'){
28 28
                     $node->setAttribute('constructor', $child);
29 29
 
30 30
                     return null;
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,19 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): ?Node
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Class_) {
19
+        if (!$node instanceof Node\Stmt\Class_)
20
+        {
20 21
             return null;
21 22
         }
22 23
 
23 24
         $placementID = 0;
24
-        foreach ($node->stmts as $index => $child) {
25
+        foreach ($node->stmts as $index => $child)
26
+        {
25 27
             $placementID = $index;
26
-            if ($child instanceof Node\Stmt\ClassMethod) {
27
-                if ($child->name->name === '__construct') {
28
+            if ($child instanceof Node\Stmt\ClassMethod)
29
+            {
30
+                if ($child->name->name === '__construct')
31
+                {
28 32
                     $node->setAttribute('constructor', $child);
29 33
 
30 34
                     return null;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/LocateVariables.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
 {
13 13
     private array $vars = [];
14 14
 
15
-    public function enterNode(Node $node): int|Node\Stmt\ClassMethod|null
15
+    public function enterNode(Node $node): int | Node\Stmt\ClassMethod | null
16 16
     {
17
-        if ($node instanceof Node\Stmt\Class_) {
18
-            foreach ($node->stmts as $stmt) {
19
-                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') {
17
+        if ($node instanceof Node\Stmt\Class_){
18
+            foreach ($node->stmts as $stmt){
19
+                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct'){
20 20
                     return $stmt;
21 21
                 }
22 22
             }
23 23
             return NodeTraverser::DONT_TRAVERSE_CHILDREN;
24 24
         }
25 25
 
26
-        if ($node instanceof Node\Expr\Variable) {
26
+        if ($node instanceof Node\Expr\Variable){
27 27
             $this->vars[] = $node->name;
28 28
         }
29 29
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,16 +14,20 @@
 block discarded – undo
14 14
 
15 15
     public function enterNode(Node $node): int|Node\Stmt\ClassMethod|null
16 16
     {
17
-        if ($node instanceof Node\Stmt\Class_) {
18
-            foreach ($node->stmts as $stmt) {
19
-                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct') {
17
+        if ($node instanceof Node\Stmt\Class_)
18
+        {
19
+            foreach ($node->stmts as $stmt)
20
+            {
21
+                if ($stmt instanceof Node\Stmt\ClassMethod && $stmt->name === '__construct')
22
+                {
20 23
                     return $stmt;
21 24
                 }
22 25
             }
23 26
             return NodeTraverser::DONT_TRAVERSE_CHILDREN;
24 27
         }
25 28
 
26
-        if ($node instanceof Node\Expr\Variable) {
29
+        if ($node instanceof Node\Expr\Variable)
30
+        {
27 31
             $this->vars[] = $node->name;
28 32
         }
29 33
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/LocateStatements.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 
17 17
     public function enterNode(Node $node): void
18 18
     {
19
-        if ($node instanceof Node\Stmt\Use_) {
20
-            foreach ($node->uses as $use) {
19
+        if ($node instanceof Node\Stmt\Use_){
20
+            foreach ($node->uses as $use){
21 21
                 $this->imports[] = [
22 22
                     'name'  => \implode('\\', $use->name->parts),
23 23
                     'alias' => $use->alias->name ?? null,
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,10 @@
 block discarded – undo
16 16
 
17 17
     public function enterNode(Node $node): void
18 18
     {
19
-        if ($node instanceof Node\Stmt\Use_) {
20
-            foreach ($node->uses as $use) {
19
+        if ($node instanceof Node\Stmt\Use_)
20
+        {
21
+            foreach ($node->uses as $use)
22
+            {
21 23
                 $this->imports[] = [
22 24
                     'name'  => \implode('\\', $use->name->parts),
23 25
                     'alias' => $use->alias->name ?? null,
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/ClassNode/DeclareClass.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@
 block discarded – undo
15 15
 
16 16
     public function enterNode(Node $node): ?int
17 17
     {
18
-        if ($node instanceof Node\Stmt\Namespace_) {
18
+        if ($node instanceof Node\Stmt\Namespace_){
19 19
             $this->namespace = \implode('\\', $node->name->parts);
20 20
         }
21 21
 
22
-        if ($node instanceof Node\Stmt\Class_) {
22
+        if ($node instanceof Node\Stmt\Class_){
23 23
             $this->class = $node->name->name;
24 24
 
25 25
             return NodeTraverser::STOP_TRAVERSAL;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,11 +15,13 @@
 block discarded – undo
15 15
 
16 16
     public function enterNode(Node $node): ?int
17 17
     {
18
-        if ($node instanceof Node\Stmt\Namespace_) {
18
+        if ($node instanceof Node\Stmt\Namespace_)
19
+        {
19 20
             $this->namespace = \implode('\\', $node->name->parts);
20 21
         }
21 22
 
22
-        if ($node instanceof Node\Stmt\Class_) {
23
+        if ($node instanceof Node\Stmt\Class_)
24
+        {
23 25
             $this->class = $node->name->name;
24 26
 
25 27
             return NodeTraverser::STOP_TRAVERSAL;
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/AddProperty.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
         private readonly ClassNode $definition,
19 19
         private readonly bool $useTypedProperties = false,
20 20
         private readonly bool $noPhpDoc = false
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     public function leaveNode(Node $node): ?Node
25 25
     {
26
-        if (!$node instanceof Node\Stmt\Class_) {
26
+        if (!$node instanceof Node\Stmt\Class_){
27 27
             return null;
28 28
         }
29 29
 
30 30
         $nodes = [];
31
-        foreach ($this->definition->dependencies as $dependency) {
31
+        foreach ($this->definition->dependencies as $dependency){
32 32
             $nodes[] = $this->buildProperty($dependency);
33 33
         }
34 34
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
     private function definePlacementID(Node\Stmt\Class_ $node): int
42 42
     {
43
-        foreach ($node->stmts as $index => $child) {
44
-            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property) {
43
+        foreach ($node->stmts as $index => $child){
44
+            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property){
45 45
                 return $index;
46 46
             }
47 47
         }
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
         $b = new Property($dependency->property);
55 55
         $b->makePrivate();
56 56
 
57
-        if ($this->useTypedProperty()) {
57
+        if ($this->useTypedProperty()){
58 58
             $b->setType($this->getPropertyType($dependency));
59 59
         }
60 60
 
61
-        if ($this->renderDoc()) {
61
+        if ($this->renderDoc()){
62 62
             $b->setDocComment(new Doc(\sprintf('/** @var %s */', $this->getPropertyType($dependency))));
63 63
         }
64 64
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 
78 78
     private function getPropertyType(Dependency $dependency): string
79 79
     {
80
-        foreach ($this->definition->getStmts() as $stmt) {
81
-            if (($stmt->name === $dependency->type->fullName) && $stmt->alias) {
80
+        foreach ($this->definition->getStmts() as $stmt){
81
+            if (($stmt->name === $dependency->type->fullName) && $stmt->alias){
82 82
                 return $stmt->alias;
83 83
             }
84 84
         }
Please login to merge, or discard this patch.
Braces   +16 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,12 +23,14 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function leaveNode(Node $node): ?Node
25 25
     {
26
-        if (!$node instanceof Node\Stmt\Class_) {
26
+        if (!$node instanceof Node\Stmt\Class_)
27
+        {
27 28
             return null;
28 29
         }
29 30
 
30 31
         $nodes = [];
31
-        foreach ($this->definition->dependencies as $dependency) {
32
+        foreach ($this->definition->dependencies as $dependency)
33
+        {
32 34
             $nodes[] = $this->buildProperty($dependency);
33 35
         }
34 36
 
@@ -40,8 +42,10 @@  discard block
 block discarded – undo
40 42
 
41 43
     private function definePlacementID(Node\Stmt\Class_ $node): int
42 44
     {
43
-        foreach ($node->stmts as $index => $child) {
44
-            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property) {
45
+        foreach ($node->stmts as $index => $child)
46
+        {
47
+            if ($child instanceof Node\Stmt\ClassMethod || $child instanceof Node\Stmt\Property)
48
+            {
45 49
                 return $index;
46 50
             }
47 51
         }
@@ -54,11 +58,13 @@  discard block
 block discarded – undo
54 58
         $b = new Property($dependency->property);
55 59
         $b->makePrivate();
56 60
 
57
-        if ($this->useTypedProperty()) {
61
+        if ($this->useTypedProperty())
62
+        {
58 63
             $b->setType($this->getPropertyType($dependency));
59 64
         }
60 65
 
61
-        if ($this->renderDoc()) {
66
+        if ($this->renderDoc())
67
+        {
62 68
             $b->setDocComment(new Doc(\sprintf('/** @var %s */', $this->getPropertyType($dependency))));
63 69
         }
64 70
 
@@ -77,8 +83,10 @@  discard block
 block discarded – undo
77 83
 
78 84
     private function getPropertyType(Dependency $dependency): string
79 85
     {
80
-        foreach ($this->definition->getStmts() as $stmt) {
81
-            if (($stmt->name === $dependency->type->fullName) && $stmt->alias) {
86
+        foreach ($this->definition->getStmts() as $stmt)
87
+        {
88
+            if (($stmt->name === $dependency->type->fullName) && $stmt->alias)
89
+            {
82 90
                 return $stmt->alias;
83 91
             }
84 92
         }
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/RemoveTrait.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@
 block discarded – undo
15 15
  */
16 16
 final class RemoveTrait extends NodeVisitorAbstract
17 17
 {
18
-    public function leaveNode(Node $node): int|Node|null
18
+    public function leaveNode(Node $node): int | Node | null
19 19
     {
20
-        if (!$node instanceof Node\Stmt\TraitUse) {
20
+        if (!$node instanceof Node\Stmt\TraitUse){
21 21
             return null;
22 22
         }
23 23
 
24
-        foreach ($node->traits as $index => $use) {
25
-            if ($use instanceof Node\Name) {
24
+        foreach ($node->traits as $index => $use){
25
+            if ($use instanceof Node\Name){
26 26
                 $name = $this->trimSlashes(\implode('\\', $use->parts));
27 27
                 if (
28 28
                     \in_array($name, [
29 29
                         $this->trimSlashes(PrototypeTrait::class),
30 30
                         Utils::shortName(PrototypeTrait::class),
31 31
                     ], true)
32
-                ) {
32
+                ){
33 33
                     unset($node->traits[$index]);
34 34
                 }
35 35
             }
36 36
         }
37 37
 
38 38
         $node->traits = \array_values($node->traits);
39
-        if (empty($node->traits)) {
39
+        if (empty($node->traits)){
40 40
             return NodeTraverser::REMOVE_NODE;
41 41
         }
42 42
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,12 +17,15 @@  discard block
 block discarded – undo
17 17
 {
18 18
     public function leaveNode(Node $node): int|Node|null
19 19
     {
20
-        if (!$node instanceof Node\Stmt\TraitUse) {
20
+        if (!$node instanceof Node\Stmt\TraitUse)
21
+        {
21 22
             return null;
22 23
         }
23 24
 
24
-        foreach ($node->traits as $index => $use) {
25
-            if ($use instanceof Node\Name) {
25
+        foreach ($node->traits as $index => $use)
26
+        {
27
+            if ($use instanceof Node\Name)
28
+            {
26 29
                 $name = $this->trimSlashes(\implode('\\', $use->parts));
27 30
                 if (
28 31
                     \in_array($name, [
@@ -36,7 +39,8 @@  discard block
 block discarded – undo
36 39
         }
37 40
 
38 41
         $node->traits = \array_values($node->traits);
39
-        if (empty($node->traits)) {
42
+        if (empty($node->traits))
43
+        {
40 44
             return NodeTraverser::REMOVE_NODE;
41 45
         }
42 46
 
Please login to merge, or discard this patch.
src/Prototype/src/NodeVisitors/RemoveUse.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,19 +14,19 @@
 block discarded – undo
14 14
  */
15 15
 final class RemoveUse extends NodeVisitorAbstract
16 16
 {
17
-    public function leaveNode(Node $node): int|Node|null
17
+    public function leaveNode(Node $node): int | Node | null
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Use_) {
19
+        if (!$node instanceof Node\Stmt\Use_){
20 20
             return null;
21 21
         }
22 22
 
23
-        foreach ($node->uses as $index => $use) {
24
-            if ($use->name->toString() === PrototypeTrait::class) {
23
+        foreach ($node->uses as $index => $use){
24
+            if ($use->name->toString() === PrototypeTrait::class){
25 25
                 unset($node->uses[$index]);
26 26
             }
27 27
         }
28 28
 
29
-        if (empty($node->uses)) {
29
+        if (empty($node->uses)){
30 30
             return NodeTraverser::REMOVE_NODE;
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,17 +16,21 @@
 block discarded – undo
16 16
 {
17 17
     public function leaveNode(Node $node): int|Node|null
18 18
     {
19
-        if (!$node instanceof Node\Stmt\Use_) {
19
+        if (!$node instanceof Node\Stmt\Use_)
20
+        {
20 21
             return null;
21 22
         }
22 23
 
23
-        foreach ($node->uses as $index => $use) {
24
-            if ($use->name->toString() === PrototypeTrait::class) {
24
+        foreach ($node->uses as $index => $use)
25
+        {
26
+            if ($use->name->toString() === PrototypeTrait::class)
27
+            {
25 28
                 unset($node->uses[$index]);
26 29
             }
27 30
         }
28 31
 
29
-        if (empty($node->uses)) {
32
+        if (empty($node->uses))
33
+        {
30 34
             return NodeTraverser::REMOVE_NODE;
31 35
         }
32 36
 
Please login to merge, or discard this patch.
src/Prototype/src/PrototypeRegistry.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
     public function __construct(
20 20
         private readonly ContainerInterface $container
21
-    ) {
21
+    ){
22 22
     }
23 23
 
24 24
     /**
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * Resolves the name of prototype dependency into target class name.
42 42
      */
43
-    public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null
43
+    public function resolveProperty(string $name): Dependency | ContainerExceptionInterface | null
44 44
     {
45 45
         $dependency = $this->dependencies[$name] ?? null;
46
-        if ($dependency === null) {
46
+        if ($dependency === null){
47 47
             return null;
48 48
         }
49 49
 
50
-        try {
50
+        try{
51 51
             $this->container->get($dependency->type->name());
52 52
 
53 53
             return $dependency;
54
-        } catch (ContainerExceptionInterface $e) {
54
+        }catch (ContainerExceptionInterface $e){
55 55
             return $e;
56 56
         }
57 57
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,15 +43,19 @@
 block discarded – undo
43 43
     public function resolveProperty(string $name): Dependency|ContainerExceptionInterface|null
44 44
     {
45 45
         $dependency = $this->dependencies[$name] ?? null;
46
-        if ($dependency === null) {
46
+        if ($dependency === null)
47
+        {
47 48
             return null;
48 49
         }
49 50
 
50
-        try {
51
+        try
52
+        {
51 53
             $this->container->get($dependency->type->name());
52 54
 
53 55
             return $dependency;
54
-        } catch (ContainerExceptionInterface $e) {
56
+        }
57
+        catch (ContainerExceptionInterface $e)
58
+        {
55 59
             return $e;
56 60
         }
57 61
     }
Please login to merge, or discard this patch.