Passed
Pull Request — master (#593)
by butschster
15:43
created
src/Translator/src/Indexer.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function registerMessage(string $domain, string $string, bool $resolveDomain = true): void
55 55
     {
56
-        if ($resolveDomain) {
56
+        if ($resolveDomain){
57 57
             $domain = $this->config->resolveDomain($domain);
58 58
         }
59 59
 
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function indexClasses(ScopedClassesInterface $locator): void
74 74
     {
75
-        foreach ($locator->getScopedClasses('translations', TranslatorTrait::class) as $class) {
75
+        foreach ($locator->getScopedClasses('translations', TranslatorTrait::class) as $class){
76 76
             $strings = $this->fetchMessages($class, true);
77
-            foreach ($strings as $string) {
77
+            foreach ($strings as $string){
78 78
                 $this->registerMessage($class->getName(), $string);
79 79
             }
80 80
         }
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
      */
107 107
     private function registerInvocations(array $invocations): void
108 108
     {
109
-        foreach ($invocations as $invocation) {
110
-            if ($invocation->getArgument(0)->getType() != ReflectionArgument::STRING) {
109
+        foreach ($invocations as $invocation){
110
+            if ($invocation->getArgument(0)->getType() != ReflectionArgument::STRING){
111 111
                 //We can only index invocations with constant string arguments
112 112
                 continue;
113 113
             }
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
     {
129 129
         $target = $reflection->getDefaultProperties() + $reflection->getConstants();
130 130
 
131
-        foreach ($reflection->getProperties() as $property) {
132
-            if (is_string($property->getDocComment()) && strpos($property->getDocComment(), '@do-not-index')) {
131
+        foreach ($reflection->getProperties() as $property){
132
+            if (is_string($property->getDocComment()) && strpos($property->getDocComment(), '@do-not-index')){
133 133
                 unset($target[$property->getName()]);
134 134
             }
135 135
         }
136 136
 
137 137
         $strings = [];
138 138
         array_walk_recursive($target, function ($value) use (&$strings): void {
139
-            if (is_string($value) && Translator::isMessage($value)) {
139
+            if (is_string($value) && Translator::isMessage($value)){
140 140
                 $strings[] = $this->prepareMessage($value);
141 141
             }
142 142
         });
143 143
 
144
-        if ($inherit && $reflection->getParentClass()) {
144
+        if ($inherit && $reflection->getParentClass()){
145 145
             //Joining strings data with parent class values (inheritance ON) - resolved into same
146 146
             //domain on export
147 147
             $strings = array_merge(
@@ -161,27 +161,27 @@  discard block
 block discarded – undo
161 161
         //Translation using default bundle
162 162
         $domain = $this->config->getDefaultDomain();
163 163
 
164
-        if ($invocation->getName() === 'say') {
164
+        if ($invocation->getName() === 'say'){
165 165
             //Let's try to confirm domain
166 166
             $domain = $this->config->resolveDomain($invocation->getClass());
167 167
         }
168 168
 
169 169
         //`l` and `p`, `say` functions
170 170
         $argument = null;
171
-        switch (strtolower($invocation->getName())) {
171
+        switch (strtolower($invocation->getName())){
172 172
             case 'say':
173 173
             case 'l':
174
-                if ($invocation->countArguments() >= 3) {
174
+                if ($invocation->countArguments() >= 3){
175 175
                     $argument = $invocation->getArgument(2);
176 176
                 }
177 177
                 break;
178 178
             case 'p':
179
-                if ($invocation->countArguments() >= 4) {
179
+                if ($invocation->countArguments() >= 4){
180 180
                     $argument = $invocation->getArgument(3);
181 181
                 }
182 182
         }
183 183
 
184
-        if (!empty($argument) && $argument->getType() === ReflectionArgument::STRING) {
184
+        if (!empty($argument) && $argument->getType() === ReflectionArgument::STRING){
185 185
             //Domain specified in arguments
186 186
             $domain = $this->config->resolveDomain($argument->stringValue());
187 187
         }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     private function prepareMessage(string $string): string
196 196
     {
197
-        if (Translator::isMessage($string)) {
197
+        if (Translator::isMessage($string)){
198 198
             $string = substr($string, 2, -2);
199 199
         }
200 200
 
Please login to merge, or discard this patch.
Braces   +30 added lines, -15 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function registerMessage(string $domain, string $string, bool $resolveDomain = true): void
55 55
     {
56
-        if ($resolveDomain) {
56
+        if ($resolveDomain)
57
+        {
57 58
             $domain = $this->config->resolveDomain($domain);
58 59
         }
59 60
 
@@ -72,9 +73,11 @@  discard block
 block discarded – undo
72 73
      */
73 74
     public function indexClasses(ScopedClassesInterface $locator): void
74 75
     {
75
-        foreach ($locator->getScopedClasses('translations', TranslatorTrait::class) as $class) {
76
+        foreach ($locator->getScopedClasses('translations', TranslatorTrait::class) as $class)
77
+        {
76 78
             $strings = $this->fetchMessages($class, true);
77
-            foreach ($strings as $string) {
79
+            foreach ($strings as $string)
80
+            {
78 81
                 $this->registerMessage($class->getName(), $string);
79 82
             }
80 83
         }
@@ -106,8 +109,10 @@  discard block
 block discarded – undo
106 109
      */
107 110
     private function registerInvocations(array $invocations): void
108 111
     {
109
-        foreach ($invocations as $invocation) {
110
-            if ($invocation->getArgument(0)->getType() != ReflectionArgument::STRING) {
112
+        foreach ($invocations as $invocation)
113
+        {
114
+            if ($invocation->getArgument(0)->getType() != ReflectionArgument::STRING)
115
+            {
111 116
                 //We can only index invocations with constant string arguments
112 117
                 continue;
113 118
             }
@@ -128,20 +133,24 @@  discard block
 block discarded – undo
128 133
     {
129 134
         $target = $reflection->getDefaultProperties() + $reflection->getConstants();
130 135
 
131
-        foreach ($reflection->getProperties() as $property) {
132
-            if (is_string($property->getDocComment()) && strpos($property->getDocComment(), '@do-not-index')) {
136
+        foreach ($reflection->getProperties() as $property)
137
+        {
138
+            if (is_string($property->getDocComment()) && strpos($property->getDocComment(), '@do-not-index'))
139
+            {
133 140
                 unset($target[$property->getName()]);
134 141
             }
135 142
         }
136 143
 
137 144
         $strings = [];
138 145
         array_walk_recursive($target, function ($value) use (&$strings): void {
139
-            if (is_string($value) && Translator::isMessage($value)) {
146
+            if (is_string($value) && Translator::isMessage($value))
147
+            {
140 148
                 $strings[] = $this->prepareMessage($value);
141 149
             }
142 150
         });
143 151
 
144
-        if ($inherit && $reflection->getParentClass()) {
152
+        if ($inherit && $reflection->getParentClass())
153
+        {
145 154
             //Joining strings data with parent class values (inheritance ON) - resolved into same
146 155
             //domain on export
147 156
             $strings = array_merge(
@@ -161,27 +170,32 @@  discard block
 block discarded – undo
161 170
         //Translation using default bundle
162 171
         $domain = $this->config->getDefaultDomain();
163 172
 
164
-        if ($invocation->getName() === 'say') {
173
+        if ($invocation->getName() === 'say')
174
+        {
165 175
             //Let's try to confirm domain
166 176
             $domain = $this->config->resolveDomain($invocation->getClass());
167 177
         }
168 178
 
169 179
         //`l` and `p`, `say` functions
170 180
         $argument = null;
171
-        switch (strtolower($invocation->getName())) {
181
+        switch (strtolower($invocation->getName()))
182
+        {
172 183
             case 'say':
173 184
             case 'l':
174
-                if ($invocation->countArguments() >= 3) {
185
+                if ($invocation->countArguments() >= 3)
186
+                {
175 187
                     $argument = $invocation->getArgument(2);
176 188
                 }
177 189
                 break;
178 190
             case 'p':
179
-                if ($invocation->countArguments() >= 4) {
191
+                if ($invocation->countArguments() >= 4)
192
+                {
180 193
                     $argument = $invocation->getArgument(3);
181 194
                 }
182 195
         }
183 196
 
184
-        if (!empty($argument) && $argument->getType() === ReflectionArgument::STRING) {
197
+        if (!empty($argument) && $argument->getType() === ReflectionArgument::STRING)
198
+        {
185 199
             //Domain specified in arguments
186 200
             $domain = $this->config->resolveDomain($argument->stringValue());
187 201
         }
@@ -194,7 +208,8 @@  discard block
 block discarded – undo
194 208
      */
195 209
     private function prepareMessage(string $string): string
196 210
     {
197
-        if (Translator::isMessage($string)) {
211
+        if (Translator::isMessage($string))
212
+        {
198 213
             $string = substr($string, 2, -2);
199 214
         }
200 215
 
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/RouteLocator.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
     public function findDeclarations(): array
48 48
     {
49 49
         $result = [];
50
-        foreach ($this->locator->getScopedClasses('routes') as $class) {
51
-            foreach ($class->getMethods() as $method) {
50
+        foreach ($this->locator->getScopedClasses('routes') as $class){
51
+            foreach ($class->getMethods() as $method){
52 52
                 $route = $this->reader->firstFunctionMetadata($method, Route::class);
53 53
 
54
-                if ($route === null) {
54
+                if ($route === null){
55 55
                     continue;
56 56
                 }
57 57
 
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
                     'controller' => $class->getName(),
62 62
                     'action'     => $method->getName(),
63 63
                     'group'      => $route->group,
64
-                    'verbs'      => (array) $route->methods,
64
+                    'verbs'      => (array)$route->methods,
65 65
                     'defaults'   => $route->defaults,
66
-                    'middleware' => (array) $route->middleware,
66
+                    'middleware' => (array)$route->middleware,
67 67
                     'priority'   => $route->priority,
68 68
                 ];
69 69
             }
70 70
         }
71 71
 
72
-        \uasort($result, static function (array $route1, array $route2) {
72
+        \uasort($result, static function (array $route1, array $route2){
73 73
             return $route1['priority'] <=> $route2['priority'];
74 74
         });
75 75
 
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -47,11 +47,14 @@  discard block
 block discarded – undo
47 47
     public function findDeclarations(): array
48 48
     {
49 49
         $result = [];
50
-        foreach ($this->locator->getScopedClasses('routes') as $class) {
51
-            foreach ($class->getMethods() as $method) {
50
+        foreach ($this->locator->getScopedClasses('routes') as $class)
51
+        {
52
+            foreach ($class->getMethods() as $method)
53
+            {
52 54
                 $route = $this->reader->firstFunctionMetadata($method, Route::class);
53 55
 
54
-                if ($route === null) {
56
+                if ($route === null)
57
+                {
55 58
                     continue;
56 59
                 }
57 60
 
@@ -69,7 +72,8 @@  discard block
 block discarded – undo
69 72
             }
70 73
         }
71 74
 
72
-        \uasort($result, static function (array $route1, array $route2) {
75
+        \uasort($result, static function (array $route1, array $route2)
76
+        {
73 77
             return $route1['priority'] <=> $route2['priority'];
74 78
         });
75 79
 
Please login to merge, or discard this patch.
src/Framework/Console/CommandLocator.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@
 block discarded – undo
38 38
     public function locateCommands(): array
39 39
     {
40 40
         $commands = [];
41
-        foreach ($this->classes->getScopedClasses('consoleCommands', SymfonyCommand::class) as $class) {
42
-            if ($class->isAbstract()) {
41
+        foreach ($this->classes->getScopedClasses('consoleCommands', SymfonyCommand::class) as $class){
42
+            if ($class->isAbstract()){
43 43
                 continue;
44 44
             }
45 45
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,8 +38,10 @@
 block discarded – undo
38 38
     public function locateCommands(): array
39 39
     {
40 40
         $commands = [];
41
-        foreach ($this->classes->getScopedClasses('consoleCommands', SymfonyCommand::class) as $class) {
42
-            if ($class->isAbstract()) {
41
+        foreach ($this->classes->getScopedClasses('consoleCommands', SymfonyCommand::class) as $class)
42
+        {
43
+            if ($class->isAbstract())
44
+            {
43 45
                 continue;
44 46
             }
45 47
 
Please login to merge, or discard this patch.
src/Prototype/tests/LocatorTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
             'directories' => [],
48 48
             'scopes' => [
49 49
                 'prototypes' => [
50
-                    'directories' => [__DIR__ . '/Fixtures']
50
+                    'directories' => [__DIR__.'/Fixtures']
51 51
                 ]
52 52
             ]
53 53
         ])));
Please login to merge, or discard this patch.
src/Console/tests/LazyTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
     public function testLazyCommandCreationInCommandLocator(): void
23 23
     {
24 24
         $locator = new CommandLocator(
25
-            new class() implements ScopedClassesInterface {
25
+            new class() implements ScopedClassesInterface{
26 26
                 public function getScopedClasses(string $scope, $target = null): array
27 27
                 {
28 28
                     return [
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,8 @@
 block discarded – undo
22 22
     public function testLazyCommandCreationInCommandLocator(): void
23 23
     {
24 24
         $locator = new CommandLocator(
25
-            new class() implements ScopedClassesInterface {
25
+            new class() implements ScopedClassesInterface
26
+            {
26 27
                 public function getScopedClasses(string $scope, $target = null): array
27 28
                 {
28 29
                     return [
Please login to merge, or discard this patch.