Passed
Pull Request — master (#544)
by Kauan
10:59
created
src/Websocket/Middleware/Authenticate.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
         try {
45 45
             $this->auth->setRequest($request);
46 46
             if ($user = $this->auth->authenticate()) {
47
-                $request->setUserResolver(function () use ($user) {
47
+                $request->setUserResolver(function() use ($user) {
48 48
                     return $user;
49 49
                 });
50 50
             }
Please login to merge, or discard this patch.
src/Websocket/Middleware/StartSession.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
      */
59 59
     protected function startSession(Request $request)
60 60
     {
61
-        return tap($this->getSession($request), function (Session $session) use ($request) {
61
+        return tap($this->getSession($request), function(Session $session) use ($request) {
62 62
             $session->setRequestOnHandler($request);
63 63
 
64 64
             $session->start();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      */
75 75
     public function getSession(Request $request)
76 76
     {
77
-        return tap($this->manager->driver(), function (Session $session) use ($request) {
77
+        return tap($this->manager->driver(), function(Session $session) use ($request) {
78 78
             $session->setId($request->cookies->get($session->getName()));
79 79
         });
80 80
     }
@@ -86,6 +86,6 @@  discard block
 block discarded – undo
86 86
      */
87 87
     protected function sessionConfigured()
88 88
     {
89
-        return ! is_null($this->manager->getSessionConfig()['driver'] ?? null);
89
+        return !is_null($this->manager->getSessionConfig()['driver'] ?? null);
90 90
     }
91 91
 }
Please login to merge, or discard this patch.
src/Server/helpers.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * This is only for `function not exists` in config/swoole_http.php.
5 5
  */
6
-if (! function_exists('swoole_cpu_num')) {
6
+if (!function_exists('swoole_cpu_num')) {
7 7
     function swoole_cpu_num(): int
8 8
     {
9 9
         return 1;
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 /**
14 14
  * This is only for `function not exists` in config/swoole_http.php.
15 15
  */
16
-if (! defined('SWOOLE_SOCK_TCP')) {
16
+if (!defined('SWOOLE_SOCK_TCP')) {
17 17
     define('SWOOLE_SOCK_TCP', 1);
18 18
 }
19 19
 
20
-if (! defined('SWOOLE_PROCESS')) {
20
+if (!defined('SWOOLE_PROCESS')) {
21 21
     define('SWOOLE_PROCESS', 2);
22 22
 }
Please login to merge, or discard this patch.
src/Server/Manager.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         $this->createTables();
116 116
         $this->prepareWebsocket();
117 117
 
118
-        if (! $this->container->make(Server::class)->taskworker) {
118
+        if (!$this->container->make(Server::class)->taskworker) {
119 119
             $this->setSwooleServerListeners();
120 120
         }
121 121
     }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $server = $this->container->make(Server::class);
129 129
         foreach ($this->events as $event) {
130 130
             $listener = Str::camel("on_$event");
131
-            $callback = method_exists($this, $listener) ? [$this, $listener] : function () use ($event) {
131
+            $callback = method_exists($this, $listener) ? [$this, $listener] : function() use ($event) {
132 132
                 $this->container->make('events')->dispatch("swoole.$event", func_get_args());
133 133
             };
134 134
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     protected function bindSandbox()
324 324
     {
325
-        $this->app->singleton(Sandbox::class, function ($app) {
325
+        $this->app->singleton(Sandbox::class, function($app) {
326 326
             return new Sandbox($app, $this->framework);
327 327
         });
328 328
 
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
      */
411 411
     protected function normalizeException(Throwable $e)
412 412
     {
413
-        if (! $e instanceof Exception) {
413
+        if (!$e instanceof Exception) {
414 414
             if ($e instanceof \ParseError) {
415 415
                 $severity = E_PARSE;
416 416
             } elseif ($e instanceof \TypeError) {
Please login to merge, or discard this patch.
src/HttpServiceProvider.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         ) || $config->get('queue.default') === 'swoole';
193 193
 
194 194
         // only enable task worker in websocket mode and for queue driver
195
-        if (! $isDefinedSwooleDriver && ! $this->isWebsocket) {
195
+        if (!$isDefinedSwooleDriver && !$this->isWebsocket) {
196 196
             unset($options['task_worker_num']);
197 197
         }
198 198
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     protected function registerServer()
208 208
     {
209
-        $this->app->singleton(Server::class, function () {
209
+        $this->app->singleton(Server::class, function() {
210 210
             if (is_null(static::$server)) {
211 211
                 $this->createSwooleServer();
212 212
                 $this->configureSwooleServer();
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
      */
223 223
     protected function registerDatabaseDriver()
224 224
     {
225
-        $this->app->extend(DatabaseManager::class, function (DatabaseManager $db) {
226
-            $db->extend('mysql-coroutine', function ($config, $name) {
225
+        $this->app->extend(DatabaseManager::class, function(DatabaseManager $db) {
226
+            $db->extend('mysql-coroutine', function($config, $name) {
227 227
                 $config['name'] = $name;
228 228
 
229 229
                 $connection = new MySqlConnection(
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
      */
267 267
     protected function registerSwooleQueueDriver()
268 268
     {
269
-        $this->app->afterResolving('queue', function (QueueManager $manager) {
270
-            $manager->addConnector('swoole', function () {
269
+        $this->app->afterResolving('queue', function(QueueManager $manager) {
270
+            $manager->addConnector('swoole', function() {
271 271
                 return new SwooleTaskConnector($this->app->make(Server::class));
272 272
             });
273 273
         });
Please login to merge, or discard this patch.
src/Transformers/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $key = str_replace('-', '_', $key);
161 161
             $key = strtoupper($key);
162 162
 
163
-            if (! in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) {
163
+            if (!in_array($key, ['REMOTE_ADDR', 'SERVER_PORT', 'HTTPS'])) {
164 164
                 $key = 'HTTP_' . $key;
165 165
             }
166 166
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
             return false;
198 198
         }
199 199
 
200
-        if (! is_file($filePath) || ! filesize($filePath)) {
200
+        if (!is_file($filePath) || !filesize($filePath)) {
201 201
             return false;
202 202
         }
203 203
 
Please login to merge, or discard this patch.
src/Commands/HttpServerCommand.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
      */
143 143
     protected function stop()
144 144
     {
145
-        if (! $this->isRunning()) {
145
+        if (!$this->isRunning()) {
146 146
             $this->error("Failed! There is no swoole_http_server process running.");
147 147
 
148 148
             return;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      */
183 183
     protected function reload()
184 184
     {
185
-        if (! $this->isRunning()) {
185
+        if (!$this->isRunning()) {
186 186
             $this->error("Failed! There is no swoole_http_server process running.");
187 187
 
188 188
             return;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
         $this->info('Reloading swoole_http_server...');
192 192
 
193
-        if (! $this->killProcess(SIGUSR1)) {
193
+        if (!$this->killProcess(SIGUSR1)) {
194 194
             $this->error('> failure');
195 195
 
196 196
             return;
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     {
266 266
         $this->action = $this->argument('action');
267 267
 
268
-        if (! in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
268
+        if (!in_array($this->action, ['start', 'stop', 'restart', 'reload', 'infos'], true)) {
269 269
             $this->error(
270 270
                 "Invalid argument '{$this->action}'. Expected 'start', 'stop', 'restart', 'reload' or 'infos'."
271 271
             );
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
         $filter = Arr::get($this->config, 'hot_reload.filter');
287 287
         $log = Arr::get($this->config, 'hot_reload.log');
288 288
 
289
-        $cb = function (FSEvent $event) use ($server, $log) {
289
+        $cb = function(FSEvent $event) use ($server, $log) {
290 290
             $log ? $this->info(FSOutput::format($event)) : null;
291 291
             $server->reload();
292 292
         };
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
     {
306 306
         $pids = $this->laravel->make(PidManager::class)->read();
307 307
 
308
-        if (! count($pids)) {
308
+        if (!count($pids)) {
309 309
             return false;
310 310
         }
311 311
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
             $start = time();
341 341
 
342 342
             do {
343
-                if (! $this->isRunning()) {
343
+                if (!$this->isRunning()) {
344 344
                     break;
345 345
                 }
346 346
 
@@ -370,13 +370,13 @@  discard block
 block discarded – undo
370 370
             exit(1);
371 371
         }
372 372
 
373
-        if (! extension_loaded('swoole') && ! extension_loaded('openswoole')) {
373
+        if (!extension_loaded('swoole') && !extension_loaded('openswoole')) {
374 374
             $this->error('Can\'t detect Swoole extension installed.');
375 375
 
376 376
             exit(1);
377 377
         }
378 378
 
379
-        if (! version_compare(swoole_version(), '4.3.1', 'ge')) {
379
+        if (!version_compare(swoole_version(), '4.3.1', 'ge')) {
380 380
             $this->error('Your Swoole version must be higher than `4.3.1`.');
381 381
 
382 382
             exit(1);
@@ -388,15 +388,15 @@  discard block
 block discarded – undo
388 388
      */
389 389
     protected function registerAccessLog()
390 390
     {
391
-        $this->laravel->singleton(OutputStyle::class, function () {
391
+        $this->laravel->singleton(OutputStyle::class, function() {
392 392
             return new OutputStyle($this->input, $this->output);
393 393
         });
394 394
 
395
-        $this->laravel->singleton(AccessOutput::class, function () {
395
+        $this->laravel->singleton(AccessOutput::class, function() {
396 396
             return new AccessOutput(new ConsoleOutput);
397 397
         });
398 398
 
399
-        $this->laravel->singleton(AccessLog::class, function (Container $container) {
399
+        $this->laravel->singleton(AccessLog::class, function(Container $container) {
400 400
             return new AccessLog($container->make(AccessOutput::class));
401 401
         });
402 402
     }
Please login to merge, or discard this patch.