Passed
Pull Request — master (#737)
by Vadim
07:15
created
src/Framework/GRPC/ProtoCompiler.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 
64 64
         $output = trim(implode("\n", $output), "\n ,");
65 65
 
66
-        if ($output !== '') {
66
+        if ($output !== ''){
67 67
             $this->files->deleteDirectory($tmpDir);
68 68
             throw new CompileException($output);
69 69
         }
70 70
 
71 71
         // copying files (using relative path and namespace)
72 72
         $result = [];
73
-        foreach ($this->files->getFiles($tmpDir) as $file) {
73
+        foreach ($this->files->getFiles($tmpDir) as $file){
74 74
             $result[] = $this->copy($tmpDir, $file);
75 75
         }
76 76
 
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
     private function copy(string $tmpDir, string $file): string
88 88
     {
89 89
         $source = ltrim($this->files->relativePath($file, $tmpDir), '\\/');
90
-        if (strpos($source, $this->baseNamespace) === 0) {
90
+        if (strpos($source, $this->baseNamespace) === 0){
91 91
             $source = ltrim(substr($source, strlen($this->baseNamespace)), '\\/');
92 92
         }
93 93
 
94
-        $target = $this->files->normalizePath($this->basePath . '/' . $source);
94
+        $target = $this->files->normalizePath($this->basePath.'/'.$source);
95 95
 
96 96
         $this->files->ensureDirectory(dirname($target));
97 97
         $this->files->copy($file, $target);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      */
105 105
     private function tmpDir(): string
106 106
     {
107
-        $directory = sys_get_temp_dir() . '/' . spl_object_hash($this);
107
+        $directory = sys_get_temp_dir().'/'.spl_object_hash($this);
108 108
         $this->files->ensureDirectory($directory);
109 109
 
110 110
         return $this->files->normalizePath($directory, true);
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         return array_filter(
122 122
             $this->files->getFiles(dirname($protoFile)),
123
-            function ($file) {
123
+            function ($file){
124 124
                 return strpos($file, '.proto') !== false;
125 125
             }
126 126
         );
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,14 +63,16 @@  discard block
 block discarded – undo
63 63
 
64 64
         $output = trim(implode("\n", $output), "\n ,");
65 65
 
66
-        if ($output !== '') {
66
+        if ($output !== '')
67
+        {
67 68
             $this->files->deleteDirectory($tmpDir);
68 69
             throw new CompileException($output);
69 70
         }
70 71
 
71 72
         // copying files (using relative path and namespace)
72 73
         $result = [];
73
-        foreach ($this->files->getFiles($tmpDir) as $file) {
74
+        foreach ($this->files->getFiles($tmpDir) as $file)
75
+        {
74 76
             $result[] = $this->copy($tmpDir, $file);
75 77
         }
76 78
 
@@ -87,7 +89,8 @@  discard block
 block discarded – undo
87 89
     private function copy(string $tmpDir, string $file): string
88 90
     {
89 91
         $source = ltrim($this->files->relativePath($file, $tmpDir), '\\/');
90
-        if (strpos($source, $this->baseNamespace) === 0) {
92
+        if (strpos($source, $this->baseNamespace) === 0)
93
+        {
91 94
             $source = ltrim(substr($source, strlen($this->baseNamespace)), '\\/');
92 95
         }
93 96
 
@@ -120,7 +123,8 @@  discard block
 block discarded – undo
120 123
     {
121 124
         return array_filter(
122 125
             $this->files->getFiles(dirname($protoFile)),
123
-            function ($file) {
126
+            function ($file)
127
+            {
124 128
                 return strpos($file, '.proto') !== false;
125 129
             }
126 130
         );
Please login to merge, or discard this patch.
src/Framework/Command/Translator/ExportCommand.php 2 patches
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function perform(TranslatorConfig $config, CatalogueManager $manager): void
41 41
     {
42
-        if (!$config->hasDumper($this->option('dumper'))) {
42
+        if (!$config->hasDumper($this->option('dumper')))
43
+        {
43 44
             $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>");
44 45
 
45 46
             return;
@@ -51,7 +52,8 @@  discard block
 block discarded – undo
51 52
             $manager->get($this->argument('locale'))
52 53
         );
53 54
 
54
-        if ($this->isVerbose() && !empty($mc->getDomains())) {
55
+        if ($this->isVerbose() && !empty($mc->getDomains()))
56
+        {
55 57
             $this->sprintf(
56 58
                 "<info>Exporting domain(s):</info> %s\n",
57 59
                 implode(',', $mc->getDomains())
@@ -89,10 +91,14 @@  discard block
 block discarded – undo
89 91
             $catalogue->getData()
90 92
         );
91 93
 
92
-        if ($this->option('fallback')) {
93
-            foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) {
94
-                foreach ($messages as $id => $message) {
95
-                    if (!$messageCatalogue->defines($id, $domain)) {
94
+        if ($this->option('fallback'))
95
+        {
96
+            foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages)
97
+            {
98
+                foreach ($messages as $id => $message)
99
+                {
100
+                    if (!$messageCatalogue->defines($id, $domain))
101
+                    {
96 102
                         $messageCatalogue->set($id, $message, $domain);
97 103
                     }
98 104
                 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
         ['locale', InputArgument::REQUIRED, 'Locale to be dumped'],
29 29
         ['path', InputArgument::REQUIRED, 'Export path'],
30 30
     ];
31
-    protected const OPTIONS     = [
31
+    protected const OPTIONS = [
32 32
         ['dumper', 'd', InputOption::VALUE_OPTIONAL, 'Dumper name', 'php'],
33 33
         ['fallback', 'f', InputOption::VALUE_NONE, 'Merge messages from fallback catalogue'],
34 34
     ];
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function perform(TranslatorConfig $config, CatalogueManager $manager): void
41 41
     {
42
-        if (!$config->hasDumper($this->option('dumper'))) {
42
+        if (!$config->hasDumper($this->option('dumper'))){
43 43
             $this->writeln("<fg=red>Undefined dumper '{$this->option('dumper')}'.</fg=red>");
44 44
 
45 45
             return;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             $manager->get($this->argument('locale'))
52 52
         );
53 53
 
54
-        if ($this->isVerbose() && !empty($mc->getDomains())) {
54
+        if ($this->isVerbose() && !empty($mc->getDomains())){
55 55
             $this->sprintf(
56 56
                 "<info>Exporting domain(s):</info> %s\n",
57 57
                 implode(',', $mc->getDomains())
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
             ]
70 70
         );
71 71
 
72
-        $this->writeln('Export successfully completed using <info>' . get_class($dumper) . '</info>');
73
-        $this->writeln('Output: <comment>' . realpath($this->argument('path')) . '</comment>');
72
+        $this->writeln('Export successfully completed using <info>'.get_class($dumper).'</info>');
73
+        $this->writeln('Output: <comment>'.realpath($this->argument('path')).'</comment>');
74 74
     }
75 75
 
76 76
     /**
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
             $catalogue->getData()
90 90
         );
91 91
 
92
-        if ($this->option('fallback')) {
93
-            foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages) {
94
-                foreach ($messages as $id => $message) {
95
-                    if (!$messageCatalogue->defines($id, $domain)) {
92
+        if ($this->option('fallback')){
93
+            foreach ($manager->get($config->getFallbackLocale())->getData() as $domain => $messages){
94
+                foreach ($messages as $id => $message){
95
+                    if (!$messageCatalogue->defines($id, $domain)){
96 96
                         $messageCatalogue->set($id, $message, $domain);
97 97
                     }
98 98
                 }
Please login to merge, or discard this patch.
src/Csrf/tests/TestResponseFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value){
41 41
             $response = $response->withAddedHeader($header, $value);
42 42
         }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value)
41
+        {
41 42
             $response = $response->withAddedHeader($header, $value);
42 43
         }
43 44
 
Please login to merge, or discard this patch.
src/Csrf/tests/CsrfTest.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $core = $this->httpCore([CsrfMiddleware::class]);
54 54
         $core->setHandler(
55
-            static function ($r) {
55
+            static function ($r){
56 56
                 return $r->getAttribute(CsrfMiddleware::ATTRIBUTE);
57 57
             }
58 58
         );
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
         $core = $this->httpCore([CsrfMiddleware::class]);
84 84
         $core->setHandler(
85
-            static function () {
85
+            static function (){
86 86
                 return 'all good';
87 87
             }
88 88
         );
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
96 96
         $core->setHandler(
97
-            static function () {
97
+            static function (){
98 98
                 return 'all good';
99 99
             }
100 100
         );
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $this->expectException(\LogicException::class);
109 109
         $core = $this->httpCore([CsrfFirewall::class]);
110 110
         $core->setHandler(
111
-            static function () {
111
+            static function (){
112 112
                 return 'all good';
113 113
             }
114 114
         );
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
122 122
         $core->setHandler(
123
-            static function () {
123
+            static function (){
124 124
                 return 'all good';
125 125
             }
126 126
         );
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
155 155
         $core->setHandler(
156
-            static function () {
156
+            static function (){
157 157
                 return 'all good';
158 158
             }
159 159
         );
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
     {
187 187
         $core = $this->httpCore([CsrfMiddleware::class, StrictCsrfFirewall::class]);
188 188
         $core->setHandler(
189
-            static function () {
189
+            static function (){
190 190
                 return 'all good';
191 191
             }
192 192
         );
@@ -277,10 +277,10 @@  discard block
 block discarded – undo
277 277
     {
278 278
         $result = [];
279 279
 
280
-        foreach ($response->getHeaders() as $header) {
281
-            foreach ($header as $headerLine) {
280
+        foreach ($response->getHeaders() as $header){
281
+            foreach ($header as $headerLine){
282 282
                 $chunk = explode(';', $headerLine);
283
-                if (!count($chunk) || mb_strpos($chunk[0], '=') === false) {
283
+                if (!count($chunk) || mb_strpos($chunk[0], '=') === false){
284 284
                     continue;
285 285
                 }
286 286
 
Please login to merge, or discard this patch.
Braces   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,7 +52,8 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $core = $this->httpCore([CsrfMiddleware::class]);
54 54
         $core->setHandler(
55
-            static function ($r) {
55
+            static function ($r)
56
+            {
56 57
                 return $r->getAttribute(CsrfMiddleware::ATTRIBUTE);
57 58
             }
58 59
         );
@@ -82,7 +83,8 @@  discard block
 block discarded – undo
82 83
 
83 84
         $core = $this->httpCore([CsrfMiddleware::class]);
84 85
         $core->setHandler(
85
-            static function () {
86
+            static function ()
87
+            {
86 88
                 return 'all good';
87 89
             }
88 90
         );
@@ -94,7 +96,8 @@  discard block
 block discarded – undo
94 96
     {
95 97
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
96 98
         $core->setHandler(
97
-            static function () {
99
+            static function ()
100
+            {
98 101
                 return 'all good';
99 102
             }
100 103
         );
@@ -108,7 +111,8 @@  discard block
 block discarded – undo
108 111
         $this->expectException(\LogicException::class);
109 112
         $core = $this->httpCore([CsrfFirewall::class]);
110 113
         $core->setHandler(
111
-            static function () {
114
+            static function ()
115
+            {
112 116
                 return 'all good';
113 117
             }
114 118
         );
@@ -120,7 +124,8 @@  discard block
 block discarded – undo
120 124
     {
121 125
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
122 126
         $core->setHandler(
123
-            static function () {
127
+            static function ()
128
+            {
124 129
                 return 'all good';
125 130
             }
126 131
         );
@@ -153,7 +158,8 @@  discard block
 block discarded – undo
153 158
     {
154 159
         $core = $this->httpCore([CsrfMiddleware::class, CsrfFirewall::class]);
155 160
         $core->setHandler(
156
-            static function () {
161
+            static function ()
162
+            {
157 163
                 return 'all good';
158 164
             }
159 165
         );
@@ -186,7 +192,8 @@  discard block
 block discarded – undo
186 192
     {
187 193
         $core = $this->httpCore([CsrfMiddleware::class, StrictCsrfFirewall::class]);
188 194
         $core->setHandler(
189
-            static function () {
195
+            static function ()
196
+            {
190 197
                 return 'all good';
191 198
             }
192 199
         );
@@ -277,10 +284,13 @@  discard block
 block discarded – undo
277 284
     {
278 285
         $result = [];
279 286
 
280
-        foreach ($response->getHeaders() as $header) {
281
-            foreach ($header as $headerLine) {
287
+        foreach ($response->getHeaders() as $header)
288
+        {
289
+            foreach ($header as $headerLine)
290
+            {
282 291
                 $chunk = explode(';', $headerLine);
283
-                if (!count($chunk) || mb_strpos($chunk[0], '=') === false) {
292
+                if (!count($chunk) || mb_strpos($chunk[0], '=') === false)
293
+                {
284 294
                     continue;
285 295
                 }
286 296
 
Please login to merge, or discard this patch.
src/AuthHttp/src/Transport/CookieTransport.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         bool $secure = false,
57 57
         bool $httpOnly = true,
58 58
         ?string $sameSite = null
59
-    ) {
59
+    ){
60 60
         $this->cookie = $cookie;
61 61
         $this->basePath = $basePath;
62 62
         $this->domain = $domain;
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     ): Response {
86 86
         /** @var CookieQueue $cookieQueue */
87 87
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
88
-        if ($cookieQueue === null) {
88
+        if ($cookieQueue === null){
89 89
             return $response->withAddedHeader(
90 90
                 'Set-Cookie',
91 91
                 Cookie::create(
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
             );
102 102
         }
103 103
 
104
-        if ($tokenID === null) {
104
+        if ($tokenID === null){
105 105
             $cookieQueue->delete($this->cookie);
106
-        } else {
106
+        }else{
107 107
             $cookieQueue->set(
108 108
                 $this->cookie,
109 109
                 $tokenID,
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
      */
135 135
     private function getLifetime(\DateTimeInterface $expiresAt = null): ?int
136 136
     {
137
-        if ($expiresAt === null) {
137
+        if ($expiresAt === null){
138 138
             return null;
139 139
         }
140 140
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -85,7 +85,8 @@  discard block
 block discarded – undo
85 85
     ): Response {
86 86
         /** @var CookieQueue $cookieQueue */
87 87
         $cookieQueue = $request->getAttribute(CookieQueue::ATTRIBUTE);
88
-        if ($cookieQueue === null) {
88
+        if ($cookieQueue === null)
89
+        {
89 90
             return $response->withAddedHeader(
90 91
                 'Set-Cookie',
91 92
                 Cookie::create(
@@ -101,9 +102,12 @@  discard block
 block discarded – undo
101 102
             );
102 103
         }
103 104
 
104
-        if ($tokenID === null) {
105
+        if ($tokenID === null)
106
+        {
105 107
             $cookieQueue->delete($this->cookie);
106
-        } else {
108
+        }
109
+        else
110
+        {
107 111
             $cookieQueue->set(
108 112
                 $this->cookie,
109 113
                 $tokenID,
@@ -134,7 +138,8 @@  discard block
 block discarded – undo
134 138
      */
135 139
     private function getLifetime(\DateTimeInterface $expiresAt = null): ?int
136 140
     {
137
-        if ($expiresAt === null) {
141
+        if ($expiresAt === null)
142
+        {
138 143
             return null;
139 144
         }
140 145
 
Please login to merge, or discard this patch.
src/AuthHttp/src/TransportRegistry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     {
50 50
         $name = $name ?? $this->default;
51 51
 
52
-        if (!isset($this->transports[$name])) {
52
+        if (!isset($this->transports[$name])){
53 53
             throw new TransportException("Undefined auth transport {$name}");
54 54
         }
55 55
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,8 @@
 block discarded – undo
49 49
     {
50 50
         $name = $name ?? $this->default;
51 51
 
52
-        if (!isset($this->transports[$name])) {
52
+        if (!isset($this->transports[$name]))
53
+        {
53 54
             throw new TransportException("Undefined auth transport {$name}");
54 55
         }
55 56
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/AuthMiddlewareTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null){
79 79
                     echo 'no token';
80 80
                 }
81 81
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -75,7 +75,8 @@
 block discarded – undo
75 75
 
76 76
         $http->setHandler(
77 77
             static function (ServerRequestInterface $request, ResponseInterface $response): void {
78
-                if ($request->getAttribute('authContext')->getToken() === null) {
78
+                if ($request->getAttribute('authContext')->getToken() === null)
79
+                {
79 80
                     echo 'no token';
80 81
                 }
81 82
             }
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/ResponseFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value){
41 41
             $response = $response->withAddedHeader($header, $value);
42 42
         }
43 43
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,8 @@
 block discarded – undo
37 37
         $response = new Response('php://memory', $code, []);
38 38
         $response = $response->withStatus($code, $reasonPhrase);
39 39
 
40
-        foreach ($this->config->getBaseHeaders() as $header => $value) {
40
+        foreach ($this->config->getBaseHeaders() as $header => $value)
41
+        {
41 42
             $response = $response->withAddedHeader($header, $value);
42 43
         }
43 44
 
Please login to merge, or discard this patch.
src/AuthHttp/tests/Diactoros/UploadedFileFactory.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null){
30 30
             $size = $stream->getSize();
31 31
         }
32 32
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@
 block discarded – undo
26 26
         string $clientFilename = null,
27 27
         string $clientMediaType = null
28 28
     ): UploadedFileInterface {
29
-        if ($size === null) {
29
+        if ($size === null)
30
+        {
30 31
             $size = $stream->getSize();
31 32
         }
32 33
 
Please login to merge, or discard this patch.