Passed
Push — master ( 400934...9d586b )
by Anton
02:32
created
src/Http/RrDispacher.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         FinalizerInterface $finalizer,
50 50
         ContainerInterface $container,
51 51
         FactoryInterface $factory
52
-    ) {
52
+    ){
53 53
         $this->env = $env;
54 54
         $this->finalizer = $finalizer;
55 55
         $this->container = $container;
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 
76 76
         /** @var Http $http */
77 77
         $http = $this->container->get(Http::class);
78
-        while ($request = $client->acceptRequest()) {
79
-            try {
78
+        while ($request = $client->acceptRequest()){
79
+            try{
80 80
                 $client->respond($http->handle($request));
81
-            } catch (\Throwable $e) {
81
+            }catch (\Throwable $e){
82 82
                 $this->handleException($client, $e);
83
-            } finally {
83
+            }finally{
84 84
                 $this->finalizer->finalize(false);
85 85
             }
86 86
         }
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
     {
95 95
         $handler = new HtmlHandler();
96 96
 
97
-        try {
97
+        try{
98 98
             /** @var SnapshotInterface $snapshot */
99 99
             $snapshot = $this->container->get(SnapshotterInterface::class)->register($e);
100 100
             error_log($snapshot->getMessage());
101 101
 
102 102
             // on demand
103 103
             $state = $this->container->get(StateInterface::class);
104
-            if ($state !== null) {
104
+            if ($state !== null){
105 105
                 $handler = $handler->withState($state);
106 106
             }
107
-        } catch (\Throwable | ContainerExceptionInterface $se) {
107
+        }catch (\Throwable | ContainerExceptionInterface $se){
108 108
             error_log((string)$e);
109 109
         }
110 110
 
Please login to merge, or discard this patch.
src/Http/ErrorHandler/PlainRenderer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,9 +40,9 @@
 block discarded – undo
40 40
     public function renderException(Request $request, int $code, string $message): Response
41 41
     {
42 42
         $response = $this->responseFactory->createResponse($code);
43
-        if ($request->getHeaderLine('Accept') == 'application/json') {
43
+        if ($request->getHeaderLine('Accept') == 'application/json'){
44 44
             $response->getBody()->write(json_encode(['status' => 500, 'error' => $message]));
45
-        } else {
45
+        }else{
46 46
             $response->getBody()->write("Error code: {$code}");
47 47
         }
48 48
 
Please login to merge, or discard this patch.
src/Http/Middleware/ErrorHandlerMiddleware.php 1 patch
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,24 +71,24 @@  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 89
             $code = 500;
90 90
 
91
-            if (!$this->suppressErrors) {
91
+            if (!$this->suppressErrors){
92 92
                 return $this->renderException($request, $e);
93 93
             }
94 94
         }
@@ -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(json_encode(
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
                     true
120 120
                 )
121 121
             ));
122
-        } else {
122
+        }else{
123 123
             $handler = new HtmlHandler();
124 124
             $state = $this->getOptional(StateInterface::class);
125
-            if ($state !== null) {
125
+            if ($state !== null){
126 126
                 $handler = $handler->withState($state);
127 127
             }
128 128
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
      */
157 157
     private function getOptional(string $class)
158 158
     {
159
-        try {
159
+        try{
160 160
             return $this->container->get($class);
161
-        } catch (\Throwable | ContainerExceptionInterface $se) {
161
+        }catch (\Throwable | ContainerExceptionInterface $se){
162 162
             return null;
163 163
         }
164 164
     }
Please login to merge, or discard this patch.
src/Http/SapiDispatcher.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
         $http = $this->container->get(Http::class);
63 63
         $emitter = $emitter ?? $this->container->get(EmitterInterface::class);
64 64
 
65
-        try {
65
+        try{
66 66
             $response = $http->handle($this->initRequest());
67 67
             $emitter->emit($response);
68
-        } catch (\Throwable $e) {
68
+        }catch (\Throwable $e){
69 69
             $this->handleException($emitter, $e);
70
-        } finally {
70
+        }finally{
71 71
             $this->finalizer->finalize(false);
72 72
         }
73 73
     }
@@ -88,16 +88,16 @@  discard block
 block discarded – undo
88 88
     {
89 89
         $handler = new HtmlHandler();
90 90
 
91
-        try {
91
+        try{
92 92
             /** @var SnapshotInterface $snapshot */
93 93
             $this->container->get(SnapshotterInterface::class)->register($e);
94 94
 
95 95
             // on demand
96 96
             $state = $this->container->get(StateInterface::class);
97
-            if ($state !== null) {
97
+            if ($state !== null){
98 98
                 $handler = $handler->withState($state);
99 99
             }
100
-        } catch (\Throwable | ContainerExceptionInterface $se) {
100
+        }catch (\Throwable | ContainerExceptionInterface $se){
101 101
             // nothing to report
102 102
         }
103 103
 
Please login to merge, or discard this patch.
src/Debug/StateCollector/EnvironmentCollector.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@
 block discarded – undo
43 43
     {
44 44
         $state->setTag('php', phpversion());
45 45
 
46
-        if ($this->container->get(DispatcherInterface::class)) {
47
-            switch (get_class($this->container->get(DispatcherInterface::class))) {
46
+        if ($this->container->get(DispatcherInterface::class)){
47
+            switch (get_class($this->container->get(DispatcherInterface::class))){
48 48
                 case RrDispacher::class:
49 49
                     $state->setTag('dispatcher', 'roadrunner');
50 50
                     break;
Please login to merge, or discard this patch.
src/Debug/StateCollector/HttpCollector.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
      */
40 40
     public function populate(StateInterface $state): void
41 41
     {
42
-        if (!$this->request === null) {
42
+        if (!$this->request === null){
43 43
             return;
44 44
         }
45 45
 
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 
49 49
         $state->setVariable('headers', $this->request->getHeaders());
50 50
 
51
-        if ($this->request->getQueryParams() !== []) {
51
+        if ($this->request->getQueryParams() !== []){
52 52
             $state->setVariable('query', $this->request->getQueryParams());
53 53
         }
54 54
 
55
-        if ($this->request->getParsedBody() !== null) {
55
+        if ($this->request->getParsedBody() !== null){
56 56
             $state->setVariable('data', $this->request->getParsedBody());
57 57
         }
58 58
     }
Please login to merge, or discard this patch.
src/Console/Logger/DebugListener.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
      */
52 52
     public function __invoke(LogEvent $event): void
53 53
     {
54
-        if (empty($this->output)) {
54
+        if (empty($this->output)){
55 55
             return;
56 56
         }
57 57
 
58
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
58
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){
59 59
             return;
60 60
         }
61 61
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      */
92 92
     public function enable(): self
93 93
     {
94
-        if (!empty($this->listenerRegistry)) {
94
+        if (!empty($this->listenerRegistry)){
95 95
             $this->listenerRegistry->addListener($this);
96 96
         }
97 97
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function disable(): self
107 107
     {
108
-        if (!empty($this->listenerRegistry)) {
108
+        if (!empty($this->listenerRegistry)){
109 109
             $this->listenerRegistry->removeListener($this);
110 110
         }
111 111
 
@@ -128,13 +128,13 @@  discard block
 block discarded – undo
128 128
      */
129 129
     private function getChannel(string $channel): string
130 130
     {
131
-        if (!class_exists($channel, false)) {
131
+        if (!class_exists($channel, false)){
132 132
             return "[{$channel}]";
133 133
         }
134 134
 
135
-        try {
135
+        try{
136 136
             $reflection = new \ReflectionClass($channel);
137
-        } catch (\ReflectionException $e) {
137
+        }catch (\ReflectionException $e){
138 138
             return $channel;
139 139
         }
140 140
 
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
      */
151 151
     private function getMessage(bool $decorated, string $message)
152 152
     {
153
-        if (!$decorated) {
153
+        if (!$decorated){
154 154
             return $message;
155 155
         }
156 156
 
157
-        return Color::GRAY . $message . Color::RESET;
157
+        return Color::GRAY.$message.Color::RESET;
158 158
     }
159 159
 }
Please login to merge, or discard this patch.
src/Bootloader/DebugBootloader.php 1 patch
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(sprintf(
84 84
                     'Unable to populate state, invalid state collector %s',
85 85
                     is_object($collector) ? get_class($collector) : gettype($collector)
Please login to merge, or discard this patch.