Passed
Push — master ( 95fdf8...1b835e )
by Kirill
04:44 queued 10s
created
src/Prototype/src/ClassNode/ConflictResolver/AbstractEntity.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     public function fullName(): string
33 33
     {
34 34
         $name = $this->name;
35
-        if ($this->sequence > 0) {
35
+        if ($this->sequence > 0){
36 36
             $name .= $this->sequence;
37 37
         }
38 38
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@
 block discarded – undo
32 32
     public function fullName(): string
33 33
     {
34 34
         $name = $this->name;
35
-        if ($this->sequence > 0) {
35
+        if ($this->sequence > 0)
36
+        {
36 37
             $name .= $this->sequence;
37 38
         }
38 39
 
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/ConflictResolver/Names.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
     private function getConstructorReservedNames(ClassNode $definition): array
46 46
     {
47 47
         $names = [];
48
-        foreach ($definition->constructorVars as $name) {
48
+        foreach ($definition->constructorVars as $name){
49 49
             $names[] = $name;
50 50
         }
51 51
 
52
-        foreach ($definition->constructorParams as $param) {
52
+        foreach ($definition->constructorParams as $param){
53 53
             $names[] = $param->name;
54 54
         }
55 55
 
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
     private function initiateCounters(array $names): array
64 64
     {
65 65
         $counters = [];
66
-        foreach ($names as $name) {
66
+        foreach ($names as $name){
67 67
             $name = $this->parseName($name);
68 68
 
69
-            if (isset($counters[$name->name])) {
69
+            if (isset($counters[$name->name])){
70 70
                 $counters[$name->name][$name->sequence] = $name->fullName();
71
-            } else {
71
+            }else{
72 72
                 $counters[$name->name] = [$name->sequence => $name->fullName()];
73 73
             }
74 74
         }
@@ -82,18 +82,18 @@  discard block
 block discarded – undo
82 82
      */
83 83
     private function addPostfixes(ClassNode $definition, array $counters): void
84 84
     {
85
-        foreach ($definition->dependencies as $dependency) {
85
+        foreach ($definition->dependencies as $dependency){
86 86
             $name = $this->parseName($dependency->var);
87
-            if (isset($counters[$name->name])) {
87
+            if (isset($counters[$name->name])){
88 88
                 $sequence = $this->sequences->find(array_keys($counters[$name->name]), $name->sequence);
89
-                if ($sequence !== $name->sequence) {
89
+                if ($sequence !== $name->sequence){
90 90
                     $name->sequence = $sequence;
91 91
 
92 92
                     $dependency->var = $name->fullName();
93 93
                 }
94 94
 
95 95
                 $counters[$name->name][$sequence] = $name->fullName();
96
-            } else {
96
+            }else{
97 97
                 $counters[$name->name] = [$name->sequence => $name->fullName()];
98 98
             }
99 99
         }
@@ -105,9 +105,9 @@  discard block
 block discarded – undo
105 105
      */
106 106
     private function parseName(string $name): NameEntity
107 107
     {
108
-        if (preg_match("/\d+$/", $name, $match)) {
108
+        if (preg_match("/\d+$/", $name, $match)){
109 109
             $sequence = (int)$match[0];
110
-            if ($sequence > 0) {
110
+            if ($sequence > 0){
111 111
                 return NameEntity::createWithSequence(Utils::trimTrailingDigits($name, $sequence), $sequence);
112 112
             }
113 113
         }
Please login to merge, or discard this patch.
Braces   +24 added lines, -11 removed lines patch added patch discarded remove patch
@@ -45,11 +45,13 @@  discard block
 block discarded – undo
45 45
     private function getConstructorReservedNames(ClassNode $definition): array
46 46
     {
47 47
         $names = [];
48
-        foreach ($definition->constructorVars as $name) {
48
+        foreach ($definition->constructorVars as $name)
49
+        {
49 50
             $names[] = $name;
50 51
         }
51 52
 
52
-        foreach ($definition->constructorParams as $param) {
53
+        foreach ($definition->constructorParams as $param)
54
+        {
53 55
             $names[] = $param->name;
54 56
         }
55 57
 
@@ -63,12 +65,16 @@  discard block
 block discarded – undo
63 65
     private function initiateCounters(array $names): array
64 66
     {
65 67
         $counters = [];
66
-        foreach ($names as $name) {
68
+        foreach ($names as $name)
69
+        {
67 70
             $name = $this->parseName($name);
68 71
 
69
-            if (isset($counters[$name->name])) {
72
+            if (isset($counters[$name->name]))
73
+            {
70 74
                 $counters[$name->name][$name->sequence] = $name->fullName();
71
-            } else {
75
+            }
76
+            else
77
+            {
72 78
                 $counters[$name->name] = [$name->sequence => $name->fullName()];
73 79
             }
74 80
         }
@@ -82,18 +88,23 @@  discard block
 block discarded – undo
82 88
      */
83 89
     private function addPostfixes(ClassNode $definition, array $counters): void
84 90
     {
85
-        foreach ($definition->dependencies as $dependency) {
91
+        foreach ($definition->dependencies as $dependency)
92
+        {
86 93
             $name = $this->parseName($dependency->var);
87
-            if (isset($counters[$name->name])) {
94
+            if (isset($counters[$name->name]))
95
+            {
88 96
                 $sequence = $this->sequences->find(array_keys($counters[$name->name]), $name->sequence);
89
-                if ($sequence !== $name->sequence) {
97
+                if ($sequence !== $name->sequence)
98
+                {
90 99
                     $name->sequence = $sequence;
91 100
 
92 101
                     $dependency->var = $name->fullName();
93 102
                 }
94 103
 
95 104
                 $counters[$name->name][$sequence] = $name->fullName();
96
-            } else {
105
+            }
106
+            else
107
+            {
97 108
                 $counters[$name->name] = [$name->sequence => $name->fullName()];
98 109
             }
99 110
         }
@@ -105,9 +116,11 @@  discard block
 block discarded – undo
105 116
      */
106 117
     private function parseName(string $name): NameEntity
107 118
     {
108
-        if (preg_match("/\d+$/", $name, $match)) {
119
+        if (preg_match("/\d+$/", $name, $match))
120
+        {
109 121
             $sequence = (int)$match[0];
110
-            if ($sequence > 0) {
122
+            if ($sequence > 0)
123
+            {
111 124
                 return NameEntity::createWithSequence(Utils::trimTrailingDigits($name, $sequence), $sequence);
112 125
             }
113 126
         }
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/ConflictResolver/Namespaces.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function getReservedNamespacesWithAlias(ClassNode $definition, array $namespaces): array
60 60
     {
61
-        foreach ($definition->getStmts() as $stmt) {
62
-            if (!$stmt->alias) {
61
+        foreach ($definition->getStmts() as $stmt){
62
+            if (!$stmt->alias){
63 63
                 continue;
64 64
             }
65 65
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
      */
77 77
     private function getReservedNamespacesWithoutAlias(ClassNode $definition, array $namespaces): array
78 78
     {
79
-        foreach ($definition->getStmts() as $stmt) {
80
-            if ($stmt->alias || isset($namespaces[$stmt->shortName])) {
79
+        foreach ($definition->getStmts() as $stmt){
80
+            if ($stmt->alias || isset($namespaces[$stmt->shortName])){
81 81
                 continue;
82 82
             }
83 83
 
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
     private function initiateCounters(array $namespaces): array
95 95
     {
96 96
         $counters = [];
97
-        foreach ($namespaces as $shortName => $fullName) {
97
+        foreach ($namespaces as $shortName => $fullName){
98 98
             $namespace = $this->parseNamespace($shortName, $fullName);
99 99
 
100
-            if (isset($counters[$namespace->name])) {
100
+            if (isset($counters[$namespace->name])){
101 101
                 $counters[$namespace->name][$namespace->sequence] = $namespace;
102
-            } else {
102
+            }else{
103 103
                 $counters[$namespace->name] = [$namespace->sequence => $namespace];
104 104
             }
105 105
         }
@@ -113,52 +113,52 @@  discard block
 block discarded – undo
113 113
      */
114 114
     private function resolveImportsNamespaces(ClassNode $definition, array $counters): void
115 115
     {
116
-        if (!$definition->hasConstructor && $definition->constructorParams) {
117
-            foreach ($definition->constructorParams as $param) {
116
+        if (!$definition->hasConstructor && $definition->constructorParams){
117
+            foreach ($definition->constructorParams as $param){
118 118
                 //no type (or type is internal), do nothing
119
-                if (empty($param->type) || $param->isBuiltIn()) {
119
+                if (empty($param->type) || $param->isBuiltIn()){
120 120
                     continue;
121 121
                 }
122 122
 
123 123
                 $namespace = $this->parseNamespaceFromType($param->type);
124
-                if (isset($counters[$namespace->name])) {
125
-                    if ($this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace)) {
124
+                if (isset($counters[$namespace->name])){
125
+                    if ($this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace)){
126 126
                         continue;
127 127
                     }
128 128
 
129 129
                     $sequence = $this->sequences->find(array_keys($counters[$namespace->name]), $namespace->sequence);
130
-                    if ($sequence !== $namespace->sequence) {
130
+                    if ($sequence !== $namespace->sequence){
131 131
                         $namespace->sequence = $sequence;
132 132
 
133 133
                         $param->type->alias = $namespace->fullName();
134 134
                     }
135 135
 
136 136
                     $counters[$namespace->name][$sequence] = $namespace;
137
-                } else {
137
+                }else{
138 138
                     $counters[$namespace->name] = [$namespace->sequence => $namespace];
139 139
                 }
140 140
             }
141 141
         }
142 142
 
143
-        foreach ($definition->dependencies as $dependency) {
143
+        foreach ($definition->dependencies as $dependency){
144 144
             $namespace = $this->parseNamespaceFromType($dependency->type);
145
-            if (isset($counters[$namespace->name])) {
145
+            if (isset($counters[$namespace->name])){
146 146
                 $alreadyImported = $this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace);
147
-                if ($alreadyImported !== null) {
147
+                if ($alreadyImported !== null){
148 148
                     $dependency->type->alias = $alreadyImported->fullName();
149 149
 
150 150
                     continue;
151 151
                 }
152 152
 
153 153
                 $sequence = $this->sequences->find(array_keys($counters[$namespace->name]), $namespace->sequence);
154
-                if ($sequence !== $namespace->sequence) {
154
+                if ($sequence !== $namespace->sequence){
155 155
                     $namespace->sequence = $sequence;
156 156
 
157 157
                     $dependency->type->alias = $namespace->fullName();
158 158
                 }
159 159
 
160 160
                 $counters[$namespace->name][$sequence] = $namespace;
161
-            } else {
161
+            }else{
162 162
                 $counters[$namespace->name] = [$namespace->sequence => $namespace];
163 163
             }
164 164
         }
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
      */
172 172
     private function getAlreadyImportedNamespace(array $counters, NamespaceEntity $namespace): ?NamespaceEntity
173 173
     {
174
-        foreach ($counters as $counter) {
175
-            if ($counter->equals($namespace)) {
174
+        foreach ($counters as $counter){
175
+            if ($counter->equals($namespace)){
176 176
                 return $counter;
177 177
             }
178 178
         }
@@ -196,9 +196,9 @@  discard block
 block discarded – undo
196 196
      */
197 197
     private function parseNamespace(string $shortName, string $fullName): NamespaceEntity
198 198
     {
199
-        if (preg_match("/\d+$/", $shortName, $match)) {
199
+        if (preg_match("/\d+$/", $shortName, $match)){
200 200
             $sequence = (int)$match[0];
201
-            if ($sequence > 0) {
201
+            if ($sequence > 0){
202 202
                 return NamespaceEntity::createWithSequence(
203 203
                     Utils::trimTrailingDigits($shortName, $sequence),
204 204
                     $fullName,
Please login to merge, or discard this patch.
Braces   +49 added lines, -23 removed lines patch added patch discarded remove patch
@@ -58,8 +58,10 @@  discard block
 block discarded – undo
58 58
      */
59 59
     private function getReservedNamespacesWithAlias(ClassNode $definition, array $namespaces): array
60 60
     {
61
-        foreach ($definition->getStmts() as $stmt) {
62
-            if (!$stmt->alias) {
61
+        foreach ($definition->getStmts() as $stmt)
62
+        {
63
+            if (!$stmt->alias)
64
+            {
63 65
                 continue;
64 66
             }
65 67
 
@@ -76,8 +78,10 @@  discard block
 block discarded – undo
76 78
      */
77 79
     private function getReservedNamespacesWithoutAlias(ClassNode $definition, array $namespaces): array
78 80
     {
79
-        foreach ($definition->getStmts() as $stmt) {
80
-            if ($stmt->alias || isset($namespaces[$stmt->shortName])) {
81
+        foreach ($definition->getStmts() as $stmt)
82
+        {
83
+            if ($stmt->alias || isset($namespaces[$stmt->shortName]))
84
+            {
81 85
                 continue;
82 86
             }
83 87
 
@@ -94,12 +98,16 @@  discard block
 block discarded – undo
94 98
     private function initiateCounters(array $namespaces): array
95 99
     {
96 100
         $counters = [];
97
-        foreach ($namespaces as $shortName => $fullName) {
101
+        foreach ($namespaces as $shortName => $fullName)
102
+        {
98 103
             $namespace = $this->parseNamespace($shortName, $fullName);
99 104
 
100
-            if (isset($counters[$namespace->name])) {
105
+            if (isset($counters[$namespace->name]))
106
+            {
101 107
                 $counters[$namespace->name][$namespace->sequence] = $namespace;
102
-            } else {
108
+            }
109
+            else
110
+            {
103 111
                 $counters[$namespace->name] = [$namespace->sequence => $namespace];
104 112
             }
105 113
         }
@@ -113,52 +121,66 @@  discard block
 block discarded – undo
113 121
      */
114 122
     private function resolveImportsNamespaces(ClassNode $definition, array $counters): void
115 123
     {
116
-        if (!$definition->hasConstructor && $definition->constructorParams) {
117
-            foreach ($definition->constructorParams as $param) {
124
+        if (!$definition->hasConstructor && $definition->constructorParams)
125
+        {
126
+            foreach ($definition->constructorParams as $param)
127
+            {
118 128
                 //no type (or type is internal), do nothing
119
-                if (empty($param->type) || $param->isBuiltIn()) {
129
+                if (empty($param->type) || $param->isBuiltIn())
130
+                {
120 131
                     continue;
121 132
                 }
122 133
 
123 134
                 $namespace = $this->parseNamespaceFromType($param->type);
124
-                if (isset($counters[$namespace->name])) {
125
-                    if ($this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace)) {
135
+                if (isset($counters[$namespace->name]))
136
+                {
137
+                    if ($this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace))
138
+                    {
126 139
                         continue;
127 140
                     }
128 141
 
129 142
                     $sequence = $this->sequences->find(array_keys($counters[$namespace->name]), $namespace->sequence);
130
-                    if ($sequence !== $namespace->sequence) {
143
+                    if ($sequence !== $namespace->sequence)
144
+                    {
131 145
                         $namespace->sequence = $sequence;
132 146
 
133 147
                         $param->type->alias = $namespace->fullName();
134 148
                     }
135 149
 
136 150
                     $counters[$namespace->name][$sequence] = $namespace;
137
-                } else {
151
+                }
152
+                else
153
+                {
138 154
                     $counters[$namespace->name] = [$namespace->sequence => $namespace];
139 155
                 }
140 156
             }
141 157
         }
142 158
 
143
-        foreach ($definition->dependencies as $dependency) {
159
+        foreach ($definition->dependencies as $dependency)
160
+        {
144 161
             $namespace = $this->parseNamespaceFromType($dependency->type);
145
-            if (isset($counters[$namespace->name])) {
162
+            if (isset($counters[$namespace->name]))
163
+            {
146 164
                 $alreadyImported = $this->getAlreadyImportedNamespace($counters[$namespace->name], $namespace);
147
-                if ($alreadyImported !== null) {
165
+                if ($alreadyImported !== null)
166
+                {
148 167
                     $dependency->type->alias = $alreadyImported->fullName();
149 168
 
150 169
                     continue;
151 170
                 }
152 171
 
153 172
                 $sequence = $this->sequences->find(array_keys($counters[$namespace->name]), $namespace->sequence);
154
-                if ($sequence !== $namespace->sequence) {
173
+                if ($sequence !== $namespace->sequence)
174
+                {
155 175
                     $namespace->sequence = $sequence;
156 176
 
157 177
                     $dependency->type->alias = $namespace->fullName();
158 178
                 }
159 179
 
160 180
                 $counters[$namespace->name][$sequence] = $namespace;
161
-            } else {
181
+            }
182
+            else
183
+            {
162 184
                 $counters[$namespace->name] = [$namespace->sequence => $namespace];
163 185
             }
164 186
         }
@@ -171,8 +193,10 @@  discard block
 block discarded – undo
171 193
      */
172 194
     private function getAlreadyImportedNamespace(array $counters, NamespaceEntity $namespace): ?NamespaceEntity
173 195
     {
174
-        foreach ($counters as $counter) {
175
-            if ($counter->equals($namespace)) {
196
+        foreach ($counters as $counter)
197
+        {
198
+            if ($counter->equals($namespace))
199
+            {
176 200
                 return $counter;
177 201
             }
178 202
         }
@@ -196,9 +220,11 @@  discard block
 block discarded – undo
196 220
      */
197 221
     private function parseNamespace(string $shortName, string $fullName): NamespaceEntity
198 222
     {
199
-        if (preg_match("/\d+$/", $shortName, $match)) {
223
+        if (preg_match("/\d+$/", $shortName, $match))
224
+        {
200 225
             $sequence = (int)$match[0];
201
-            if ($sequence > 0) {
226
+            if ($sequence > 0)
227
+            {
202 228
                 return NamespaceEntity::createWithSequence(
203 229
                     Utils::trimTrailingDigits($shortName, $sequence),
204 230
                     $fullName,
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/ConflictResolver/Sequences.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,21 +24,21 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function find(array $sequences, int $originSequence): int
26 26
     {
27
-        if (empty($sequences) || $originSequence > max($sequences)) {
27
+        if (empty($sequences) || $originSequence > max($sequences)){
28 28
             return $originSequence;
29 29
         }
30 30
 
31 31
         $gaps = $this->skippedSequences($sequences);
32 32
 
33
-        if (isset($gaps[$originSequence])) {
33
+        if (isset($gaps[$originSequence])){
34 34
             return $originSequence;
35 35
         }
36 36
 
37 37
         //we do not add "1" as postfix: $var, $var2, $var3, etc
38 38
         unset($gaps[1]);
39
-        if (empty($gaps)) {
39
+        if (empty($gaps)){
40 40
             $max = max($sequences);
41
-            if ($max === 0) {
41
+            if ($max === 0){
42 42
                 return 2;
43 43
             }
44 44
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
     {
57 57
         $skipped = [];
58 58
         $max = max($sequences);
59
-        for ($i = 0; $i < $max; $i++) {
60
-            if (!in_array($i, $sequences, true)) {
59
+        for ($i = 0; $i < $max; $i++){
60
+            if (!in_array($i, $sequences, true)){
61 61
                 $skipped[$i] = $i;
62 62
             }
63 63
         }
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,21 +24,25 @@  discard block
 block discarded – undo
24 24
      */
25 25
     public function find(array $sequences, int $originSequence): int
26 26
     {
27
-        if (empty($sequences) || $originSequence > max($sequences)) {
27
+        if (empty($sequences) || $originSequence > max($sequences))
28
+        {
28 29
             return $originSequence;
29 30
         }
30 31
 
31 32
         $gaps = $this->skippedSequences($sequences);
32 33
 
33
-        if (isset($gaps[$originSequence])) {
34
+        if (isset($gaps[$originSequence]))
35
+        {
34 36
             return $originSequence;
35 37
         }
36 38
 
37 39
         //we do not add "1" as postfix: $var, $var2, $var3, etc
38 40
         unset($gaps[1]);
39
-        if (empty($gaps)) {
41
+        if (empty($gaps))
42
+        {
40 43
             $max = max($sequences);
41
-            if ($max === 0) {
44
+            if ($max === 0)
45
+            {
42 46
                 return 2;
43 47
             }
44 48
 
@@ -56,8 +60,10 @@  discard block
 block discarded – undo
56 60
     {
57 61
         $skipped = [];
58 62
         $max = max($sequences);
59
-        for ($i = 0; $i < $max; $i++) {
60
-            if (!in_array($i, $sequences, true)) {
63
+        for ($i = 0; $i < $max; $i++)
64
+        {
65
+            if (!in_array($i, $sequences, true))
66
+            {
61 67
                 $skipped[$i] = $i;
62 68
             }
63 69
         }
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/ConstructorParam.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
         $stmt = new self();
56 56
         $stmt->name = $parameter->getName();
57 57
 
58
-        if ($parameter->hasType()) {
58
+        if ($parameter->hasType()){
59 59
             /** @var \ReflectionType $type */
60 60
             $type = $parameter->getType();
61 61
             $stmt->type = Type::create($type->getName());
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
             $stmt->nullable = $type->allowsNull();
64 64
         }
65 65
 
66
-        if ($parameter->isDefaultValueAvailable()) {
66
+        if ($parameter->isDefaultValueAvailable()){
67 67
             $stmt->hasDefault = true;
68 68
             $stmt->default = $parameter->getDefaultValue();
69 69
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,7 +55,8 @@  discard block
 block discarded – undo
55 55
         $stmt = new self();
56 56
         $stmt->name = $parameter->getName();
57 57
 
58
-        if ($parameter->hasType()) {
58
+        if ($parameter->hasType())
59
+        {
59 60
             /** @var \ReflectionType $type */
60 61
             $type = $parameter->getType();
61 62
             $stmt->type = Type::create($type->getName());
@@ -63,7 +64,8 @@  discard block
 block discarded – undo
63 64
             $stmt->nullable = $type->allowsNull();
64 65
         }
65 66
 
66
-        if ($parameter->isDefaultValueAvailable()) {
67
+        if ($parameter->isDefaultValueAvailable())
68
+        {
67 69
             $stmt->hasDefault = true;
68 70
             $stmt->default = $parameter->getDefaultValue();
69 71
         }
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/ClassStmt.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
      */
37 37
     public function __toString(): string
38 38
     {
39
-        if ($this->alias) {
39
+        if ($this->alias){
40 40
             return "{$this->name} as $this->alias";
41 41
         }
42 42
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,8 @@
 block discarded – undo
36 36
      */
37 37
     public function __toString(): string
38 38
     {
39
-        if ($this->alias) {
39
+        if ($this->alias)
40
+        {
40 41
             return "{$this->name} as $this->alias";
41 42
         }
42 43
 
Please login to merge, or discard this patch.
src/Prototype/src/ClassNode/Type.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         $type = new self();
34 34
 
35 35
         $fullName = null;
36
-        if ($type->hasShortName($name)) {
36
+        if ($type->hasShortName($name)){
37 37
             $fullName = $name;
38 38
             $name = Utils::shortName($name);
39 39
         }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     public function getSlashedShortName(bool $builtIn): string
60 60
     {
61 61
         $type = $this->shortName;
62
-        if (!$builtIn && !$this->fullName) {
62
+        if (!$builtIn && !$this->fullName){
63 63
             $type = "\\$type";
64 64
         }
65 65
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@  discard block
 block discarded – undo
33 33
         $type = new self();
34 34
 
35 35
         $fullName = null;
36
-        if ($type->hasShortName($name)) {
36
+        if ($type->hasShortName($name))
37
+        {
37 38
             $fullName = $name;
38 39
             $name = Utils::shortName($name);
39 40
         }
@@ -59,7 +60,8 @@  discard block
 block discarded – undo
59 60
     public function getSlashedShortName(bool $builtIn): string
60 61
     {
61 62
         $type = $this->shortName;
62
-        if (!$builtIn && !$this->fullName) {
63
+        if (!$builtIn && !$this->fullName)
64
+        {
63 65
             $type = "\\$type";
64 66
         }
65 67
 
Please login to merge, or discard this patch.
src/Prototype/src/Command/ListCommand.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function perform(): void
23 23
     {
24 24
         $prototyped = $this->locator->getTargetClasses();
25
-        if ($prototyped === []) {
25
+        if ($prototyped === []){
26 26
             $this->writeln('<comment>No prototyped classes found.</comment>');
27 27
 
28 28
             return;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
         $grid = $this->table(['Class:', 'Property:', 'Target:']);
32 32
 
33
-        foreach ($prototyped as $class) {
33
+        foreach ($prototyped as $class){
34 34
             $proto = $this->getPrototypeProperties($class);
35 35
 
36 36
             $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@  discard block
 block discarded – undo
22 22
     public function perform(): void
23 23
     {
24 24
         $prototyped = $this->locator->getTargetClasses();
25
-        if ($prototyped === []) {
25
+        if ($prototyped === [])
26
+        {
26 27
             $this->writeln('<comment>No prototyped classes found.</comment>');
27 28
 
28 29
             return;
@@ -30,7 +31,8 @@  discard block
 block discarded – undo
30 31
 
31 32
         $grid = $this->table(['Class:', 'Property:', 'Target:']);
32 33
 
33
-        foreach ($prototyped as $class) {
34
+        foreach ($prototyped as $class)
35
+        {
34 36
             $proto = $this->getPrototypeProperties($class);
35 37
 
36 38
             $grid->addRow([$class->getName(), $this->mergeNames($proto), $this->mergeTargets($proto)]);
Please login to merge, or discard this patch.
src/Prototype/src/Command/InjectCommand.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     public function perform(): void
33 33
     {
34 34
         $prototyped = $this->locator->getTargetClasses();
35
-        if ($prototyped === []) {
35
+        if ($prototyped === []){
36 36
             $this->writeln('<comment>No prototyped classes found.</comment>');
37 37
 
38 38
             return;
@@ -40,19 +40,19 @@  discard block
 block discarded – undo
40 40
 
41 41
         $targets = [];
42 42
 
43
-        foreach ($prototyped as $class) {
43
+        foreach ($prototyped as $class){
44 44
             $proto = $this->getPrototypeProperties($class);
45
-            if (empty($proto)) {
45
+            if (empty($proto)){
46 46
                 continue;
47 47
             }
48 48
 
49
-            foreach ($proto as $target) {
50
-                if ($target instanceof \Throwable) {
49
+            foreach ($proto as $target){
50
+                if ($target instanceof \Throwable){
51 51
                     $targets[] = [$class->getName(), $target->getMessage(), $target->getFile(), $target->getLine()];
52 52
                     continue 2;
53 53
                 }
54 54
 
55
-                if ($target === null) {
55
+                if ($target === null){
56 56
                     continue 2;
57 57
                 }
58 58
             }
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 
62 62
             $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
63 63
 
64
-            try {
64
+            try{
65 65
                 $modified = (new Injector())->injectDependencies(
66 66
                     file_get_contents($class->getFileName()),
67 67
                     $classDefinition,
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
                 );
70 70
 
71 71
                 file_put_contents($class->getFileName(), $modified);
72
-            } catch (\Throwable $e) {
72
+            }catch (\Throwable $e){
73 73
                 $targets[] = [$class, $e->getMessage(), $e->getFile(), $e->getLine()];
74 74
             }
75 75
         }
76 76
 
77
-        if (!empty($targets)) {
77
+        if (!empty($targets)){
78 78
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
79
-            foreach ($targets as $target) {
79
+            foreach ($targets as $target){
80 80
                 $grid->addRow($target);
81 81
             }
82 82
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,7 +32,8 @@  discard block
 block discarded – undo
32 32
     public function perform(): void
33 33
     {
34 34
         $prototyped = $this->locator->getTargetClasses();
35
-        if ($prototyped === []) {
35
+        if ($prototyped === [])
36
+        {
36 37
             $this->writeln('<comment>No prototyped classes found.</comment>');
37 38
 
38 39
             return;
@@ -40,19 +41,24 @@  discard block
 block discarded – undo
40 41
 
41 42
         $targets = [];
42 43
 
43
-        foreach ($prototyped as $class) {
44
+        foreach ($prototyped as $class)
45
+        {
44 46
             $proto = $this->getPrototypeProperties($class);
45
-            if (empty($proto)) {
47
+            if (empty($proto))
48
+            {
46 49
                 continue;
47 50
             }
48 51
 
49
-            foreach ($proto as $target) {
50
-                if ($target instanceof \Throwable) {
52
+            foreach ($proto as $target)
53
+            {
54
+                if ($target instanceof \Throwable)
55
+                {
51 56
                     $targets[] = [$class->getName(), $target->getMessage(), $target->getFile(), $target->getLine()];
52 57
                     continue 2;
53 58
                 }
54 59
 
55
-                if ($target === null) {
60
+                if ($target === null)
61
+                {
56 62
                     continue 2;
57 63
                 }
58 64
             }
@@ -61,7 +67,8 @@  discard block
 block discarded – undo
61 67
 
62 68
             $classDefinition = $this->extractor->extract($class->getFilename(), $proto);
63 69
 
64
-            try {
70
+            try
71
+            {
65 72
                 $modified = (new Injector())->injectDependencies(
66 73
                     file_get_contents($class->getFileName()),
67 74
                     $classDefinition,
@@ -69,14 +76,18 @@  discard block
 block discarded – undo
69 76
                 );
70 77
 
71 78
                 file_put_contents($class->getFileName(), $modified);
72
-            } catch (\Throwable $e) {
79
+            }
80
+            catch (\Throwable $e)
81
+            {
73 82
                 $targets[] = [$class, $e->getMessage(), $e->getFile(), $e->getLine()];
74 83
             }
75 84
         }
76 85
 
77
-        if (!empty($targets)) {
86
+        if (!empty($targets))
87
+        {
78 88
             $grid = $this->table(['Class:', 'Property:', 'Target:']);
79
-            foreach ($targets as $target) {
89
+            foreach ($targets as $target)
90
+            {
80 91
                 $grid->addRow($target);
81 92
             }
82 93
 
Please login to merge, or discard this patch.