Passed
Push — master ( d279ac...d3d8e1 )
by Anton
02:34
created
src/Http/Middleware/ErrorHandlerMiddleware.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         RendererInterface $renderer,
58 58
         ResponseFactoryInterface $responseFactory,
59 59
         ContainerInterface $container
60
-    ) {
60
+    ){
61 61
         $this->suppressErrors = $suppressErrors;
62 62
         $this->renderer = $renderer;
63 63
         $this->responseFactory = $responseFactory;
@@ -71,22 +71,22 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function process(Request $request, Handler $handler): Response
73 73
     {
74
-        try {
74
+        try{
75 75
             return $handler->handle($request);
76
-        } catch (ClientException | RouterException $e) {
77
-            if ($e instanceof ClientException) {
76
+        }catch (ClientException | RouterException $e){
77
+            if ($e instanceof ClientException){
78 78
                 $code = $e->getCode();
79
-            } else {
79
+            }else{
80 80
                 $code = 404;
81 81
             }
82
-        } catch (\Throwable $e) {
82
+        }catch (\Throwable $e){
83 83
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
84
-            if ($snapshotter !== null) {
84
+            if ($snapshotter !== null){
85 85
                 /** @var SnapshotterInterface $snapshotter */
86 86
                 $snapshotter->register($e);
87 87
             }
88 88
 
89
-            if (!$this->suppressErrors) {
89
+            if (!$this->suppressErrors){
90 90
                 return $this->renderError($request, $e);
91 91
             }
92 92
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     {
110 110
         $response = $this->responseFactory->createResponse(500);
111 111
 
112
-        if ($request->getHeaderLine('Accept') == 'application/json') {
112
+        if ($request->getHeaderLine('Accept') == 'application/json'){
113 113
             $response = $response->withHeader('Content-Type', 'application/json');
114 114
             $handler = new JsonHandler();
115 115
             $response->getBody()->write(
@@ -121,10 +121,10 @@  discard block
 block discarded – undo
121 121
                     )
122 122
                 )
123 123
             );
124
-        } else {
124
+        }else{
125 125
             $handler = new HtmlHandler();
126 126
             $state = $this->getOptional(StateInterface::class);
127
-            if ($state !== null) {
127
+            if ($state !== null){
128 128
                 $handler = $handler->withState($state);
129 129
             }
130 130
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
      */
161 161
     private function getOptional(string $class)
162 162
     {
163
-        try {
163
+        try{
164 164
             return $this->container->get($class);
165
-        } catch (\Throwable | ContainerExceptionInterface $se) {
165
+        }catch (\Throwable | ContainerExceptionInterface $se){
166 166
             return null;
167 167
         }
168 168
     }
Please login to merge, or discard this patch.
Braces   +29 added lines, -12 removed lines patch added patch discarded remove patch
@@ -71,22 +71,32 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function process(Request $request, Handler $handler): Response
73 73
     {
74
-        try {
74
+        try
75
+        {
75 76
             return $handler->handle($request);
76
-        } catch (ClientException | RouterException $e) {
77
-            if ($e instanceof ClientException) {
77
+        }
78
+        catch (ClientException | RouterException $e)
79
+        {
80
+            if ($e instanceof ClientException)
81
+            {
78 82
                 $code = $e->getCode();
79
-            } else {
83
+            }
84
+            else
85
+            {
80 86
                 $code = 404;
81 87
             }
82
-        } catch (\Throwable $e) {
88
+        }
89
+        catch (\Throwable $e)
90
+        {
83 91
             $snapshotter = $this->getOptional(SnapshotterInterface::class);
84
-            if ($snapshotter !== null) {
92
+            if ($snapshotter !== null)
93
+            {
85 94
                 /** @var SnapshotterInterface $snapshotter */
86 95
                 $snapshotter->register($e);
87 96
             }
88 97
 
89
-            if (!$this->suppressErrors) {
98
+            if (!$this->suppressErrors)
99
+            {
90 100
                 return $this->renderError($request, $e);
91 101
             }
92 102
 
@@ -109,7 +119,8 @@  discard block
 block discarded – undo
109 119
     {
110 120
         $response = $this->responseFactory->createResponse(500);
111 121
 
112
-        if ($request->getHeaderLine('Accept') == 'application/json') {
122
+        if ($request->getHeaderLine('Accept') == 'application/json')
123
+        {
113 124
             $response = $response->withHeader('Content-Type', 'application/json');
114 125
             $handler = new JsonHandler();
115 126
             $response->getBody()->write(
@@ -121,10 +132,13 @@  discard block
 block discarded – undo
121 132
                     )
122 133
                 )
123 134
             );
124
-        } else {
135
+        }
136
+        else
137
+        {
125 138
             $handler = new HtmlHandler();
126 139
             $state = $this->getOptional(StateInterface::class);
127
-            if ($state !== null) {
140
+            if ($state !== null)
141
+            {
128 142
                 $handler = $handler->withState($state);
129 143
             }
130 144
 
@@ -160,9 +174,12 @@  discard block
 block discarded – undo
160 174
      */
161 175
     private function getOptional(string $class)
162 176
     {
163
-        try {
177
+        try
178
+        {
164 179
             return $this->container->get($class);
165
-        } catch (\Throwable | ContainerExceptionInterface $se) {
180
+        }
181
+        catch (\Throwable | ContainerExceptionInterface $se)
182
+        {
166 183
             return null;
167 184
         }
168 185
     }
Please login to merge, or discard this patch.
src/Jobs/JobDispatcher.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         EnvironmentInterface $env,
40 40
         FinalizerInterface $finalizer,
41 41
         ContainerInterface $container
42
-    ) {
42
+    ){
43 43
         $this->env = $env;
44 44
         $this->finalizer = $finalizer;
45 45
         $this->container = $container;
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
         $consumer->serve(
71 71
             $worker,
72 72
             function (\Throwable $e = null): void {
73
-                if ($e !== null) {
73
+                if ($e !== null){
74 74
                     $this->handleException($e);
75 75
                 }
76 76
 
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      */
85 85
     protected function handleException(\Throwable $e): void
86 86
     {
87
-        try {
87
+        try{
88 88
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable | ContainerExceptionInterface $se) {
89
+        }catch (\Throwable | ContainerExceptionInterface $se){
90 90
             // no need to notify when unable to register an exception
91 91
         }
92 92
     }
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
         $consumer->serve(
71 71
             $worker,
72 72
             function (\Throwable $e = null): void {
73
-                if ($e !== null) {
73
+                if ($e !== null)
74
+                {
74 75
                     $this->handleException($e);
75 76
                 }
76 77
 
@@ -84,9 +85,12 @@  discard block
 block discarded – undo
84 85
      */
85 86
     protected function handleException(\Throwable $e): void
86 87
     {
87
-        try {
88
+        try
89
+        {
88 90
             $this->container->get(SnapshotterInterface::class)->register($e);
89
-        } catch (\Throwable | ContainerExceptionInterface $se) {
91
+        }
92
+        catch (\Throwable | ContainerExceptionInterface $se)
93
+        {
90 94
             // no need to notify when unable to register an exception
91 95
         }
92 96
     }
Please login to merge, or discard this patch.
src/Console/Sequence/RuntimeDirectory.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
         $runtimeDirectory = $this->dirs->get('runtime');
47 47
 
48
-        if (!$this->files->exists($runtimeDirectory)) {
48
+        if (!$this->files->exists($runtimeDirectory)){
49 49
             $this->files->ensureDirectory($runtimeDirectory);
50 50
             $output->writeln('<comment>created</comment>');
51 51
             return;
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
         $output->writeln('<info>exists</info>');
54 54
 
55 55
 
56
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
57
-            try {
56
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename){
57
+            try{
58 58
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
59 59
                 $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
60
-            } catch (\Throwable $e) {
60
+            }catch (\Throwable $e){
61 61
                 // @codeCoverageIgnoreStart
62 62
                 $output->writeln(
63 63
                     sprintf(
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                 // @codeCoverageIgnoreEnd
71 71
             }
72 72
 
73
-            if ($output->isVerbose()) {
73
+            if ($output->isVerbose()){
74 74
                 $output->writeln(
75 75
                     sprintf(
76 76
                         '<fg=green>[updated]</fg=green> `%s`',
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -45,7 +45,8 @@  discard block
 block discarded – undo
45 45
 
46 46
         $runtimeDirectory = $this->dirs->get('runtime');
47 47
 
48
-        if (!$this->files->exists($runtimeDirectory)) {
48
+        if (!$this->files->exists($runtimeDirectory))
49
+        {
49 50
             $this->files->ensureDirectory($runtimeDirectory);
50 51
             $output->writeln('<comment>created</comment>');
51 52
             return;
@@ -53,11 +54,15 @@  discard block
 block discarded – undo
53 54
         $output->writeln('<info>exists</info>');
54 55
 
55 56
 
56
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
57
-            try {
57
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename)
58
+        {
59
+            try
60
+            {
58 61
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
59 62
                 $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
60
-            } catch (\Throwable $e) {
63
+            }
64
+            catch (\Throwable $e)
65
+            {
61 66
                 // @codeCoverageIgnoreStart
62 67
                 $output->writeln(
63 68
                     sprintf(
@@ -70,7 +75,8 @@  discard block
 block discarded – undo
70 75
                 // @codeCoverageIgnoreEnd
71 76
             }
72 77
 
73
-            if ($output->isVerbose()) {
78
+            if ($output->isVerbose())
79
+            {
74 80
                 $output->writeln(
75 81
                     sprintf(
76 82
                         '<fg=green>[updated]</fg=green> `%s`',
Please login to merge, or discard this patch.
src/Bootloader/Security/ValidationBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@
 block discarded – undo
112 112
             ]
113 113
         );
114 114
 
115
-        $tokenizer->addDirectory(directory('vendor') . 'spiral/validation/src/');
115
+        $tokenizer->addDirectory(directory('vendor').'spiral/validation/src/');
116 116
     }
117 117
 
118 118
     /**
Please login to merge, or discard this patch.
src/Bootloader/Database/DisconnectsBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
             function () use ($container): void {
32 32
                 /** @var DatabaseManager $dbal */
33 33
                 $dbal = $container->get(DatabaseManager::class);
34
-                foreach ($dbal->getDrivers() as $driver) {
34
+                foreach ($dbal->getDrivers() as $driver){
35 35
                     $driver->disconnect();
36 36
                 }
37 37
             }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,8 @@
 block discarded – undo
31 31
             function () use ($container): void {
32 32
                 /** @var DatabaseManager $dbal */
33 33
                 $dbal = $container->get(DatabaseManager::class);
34
-                foreach ($dbal->getDrivers() as $driver) {
34
+                foreach ($dbal->getDrivers() as $driver)
35
+                {
35 36
                     $driver->disconnect();
36 37
                 }
37 38
             }
Please login to merge, or discard this patch.
src/Bootloader/Cycle/CycleBootloader.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $finalizer->addFinalizer(
55 55
             function () use ($container): void {
56
-                if ($container->hasInstance(ORMInterface::class)) {
56
+                if ($container->hasInstance(ORMInterface::class)){
57 57
                     $container->get(ORMInterface::class)->getHeap()->clean();
58 58
                 }
59 59
             }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     ): ORMInterface {
76 76
         $orm = new ORM($factory, $schema);
77 77
 
78
-        if ($promiseFactory !== null) {
78
+        if ($promiseFactory !== null){
79 79
             return $orm->withPromiseFactory($promiseFactory);
80 80
         }
81 81
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,8 @@  discard block
 block discarded – undo
53 53
     {
54 54
         $finalizer->addFinalizer(
55 55
             function () use ($container): void {
56
-                if ($container->hasInstance(ORMInterface::class)) {
56
+                if ($container->hasInstance(ORMInterface::class))
57
+                {
57 58
                     $container->get(ORMInterface::class)->getHeap()->clean();
58 59
                 }
59 60
             }
@@ -75,7 +76,8 @@  discard block
 block discarded – undo
75 76
     ): ORMInterface {
76 77
         $orm = new ORM($factory, $schema);
77 78
 
78
-        if ($promiseFactory !== null) {
79
+        if ($promiseFactory !== null)
80
+        {
79 81
             return $orm->withPromiseFactory($promiseFactory);
80 82
         }
81 83
 
Please login to merge, or discard this patch.
src/Bootloader/Http/WebsocketsBootloader.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
             ]
57 57
         );
58 58
 
59
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
59
+        if ($env->get('RR_BROADCAST_PATH', null) !== null){
60 60
             $http->addMiddleware(WebsocketsMiddleware::class);
61 61
         }
62 62
     }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@
 block discarded – undo
56 56
             ]
57 57
         );
58 58
 
59
-        if ($env->get('RR_BROADCAST_PATH', null) !== null) {
59
+        if ($env->get('RR_BROADCAST_PATH', null) !== null)
60
+        {
60 61
             $http->addMiddleware(WebsocketsMiddleware::class);
61 62
         }
62 63
     }
Please login to merge, or discard this patch.
src/Bootloader/Http/SessionBootloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
                 'handler'  => new Autowire(
63 63
                     FileHandler::class,
64 64
                     [
65
-                        'directory' => $directories->get('runtime') . 'session',
65
+                        'directory' => $directories->get('runtime').'session',
66 66
                         'lifetime'  => 86400
67 67
                     ]
68 68
                 )
Please login to merge, or discard this patch.
src/Bootloader/DebugBootloader.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,16 +70,16 @@
 block discarded – undo
70 70
     {
71 71
         $state = new State();
72 72
 
73
-        foreach ($this->collectors as $collector) {
74
-            if (is_string($collector)) {
73
+        foreach ($this->collectors as $collector){
74
+            if (is_string($collector)){
75 75
                 $collector = $this->factory->make($collector);
76 76
             }
77 77
 
78
-            if ($collector instanceof Autowire) {
78
+            if ($collector instanceof Autowire){
79 79
                 $collector = $collector->resolve($this->factory);
80 80
             }
81 81
 
82
-            if (!$collector instanceof StateCollectorInterface) {
82
+            if (!$collector instanceof StateCollectorInterface){
83 83
                 throw new StateException(
84 84
                     sprintf(
85 85
                         'Unable to populate state, invalid state collector %s',
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,16 +70,20 @@
 block discarded – undo
70 70
     {
71 71
         $state = new State();
72 72
 
73
-        foreach ($this->collectors as $collector) {
74
-            if (is_string($collector)) {
73
+        foreach ($this->collectors as $collector)
74
+        {
75
+            if (is_string($collector))
76
+            {
75 77
                 $collector = $this->factory->make($collector);
76 78
             }
77 79
 
78
-            if ($collector instanceof Autowire) {
80
+            if ($collector instanceof Autowire)
81
+            {
79 82
                 $collector = $collector->resolve($this->factory);
80 83
             }
81 84
 
82
-            if (!$collector instanceof StateCollectorInterface) {
85
+            if (!$collector instanceof StateCollectorInterface)
86
+            {
83 87
                 throw new StateException(
84 88
                     sprintf(
85 89
                         'Unable to populate state, invalid state collector %s',
Please login to merge, or discard this patch.