Passed
Push — master ( beb5fc...4d9ea0 )
by Anton
02:12
created
src/Console/Logger/DebugListener.php 2 patches
Braces   +17 added lines, -8 removed lines patch added patch discarded remove patch
@@ -49,11 +49,13 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __invoke(LogEvent $event)
51 51
     {
52
-        if (empty($this->output)) {
52
+        if (empty($this->output))
53
+        {
53 54
             return;
54 55
         }
55 56
 
56
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
57
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE)
58
+        {
57 59
             return;
58 60
         }
59 61
 
@@ -89,7 +91,8 @@  discard block
 block discarded – undo
89 91
      */
90 92
     public function enable(): self
91 93
     {
92
-        if (!empty($this->logs)) {
94
+        if (!empty($this->logs))
95
+        {
93 96
             $this->logs->addListener($this);
94 97
         }
95 98
 
@@ -103,7 +106,8 @@  discard block
 block discarded – undo
103 106
      */
104 107
     public function disable(): self
105 108
     {
106
-        if (!empty($this->logs)) {
109
+        if (!empty($this->logs))
110
+        {
107 111
             $this->logs->removeListener($this);
108 112
         }
109 113
 
@@ -126,13 +130,17 @@  discard block
 block discarded – undo
126 130
      */
127 131
     private function getChannel(string $channel): string
128 132
     {
129
-        if (!class_exists($channel, false)) {
133
+        if (!class_exists($channel, false))
134
+        {
130 135
             return "[{$channel}]";
131 136
         }
132 137
 
133
-        try {
138
+        try
139
+        {
134 140
             $reflection = new \ReflectionClass($channel);
135
-        } catch (\ReflectionException $e) {
141
+        }
142
+        catch (\ReflectionException $e)
143
+        {
136 144
             return $channel;
137 145
         }
138 146
 
@@ -146,7 +154,8 @@  discard block
 block discarded – undo
146 154
      */
147 155
     private function getMessage(bool $decorated, string $message)
148 156
     {
149
-        if (!$decorated) {
157
+        if (!$decorated)
158
+        {
150 159
             return $message;
151 160
         }
152 161
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function __invoke(LogEvent $event)
51 51
     {
52
-        if (empty($this->output)) {
52
+        if (empty($this->output)){
53 53
             return;
54 54
         }
55 55
 
56
-        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE) {
56
+        if ($this->output->getVerbosity() < OutputInterface::VERBOSITY_VERY_VERBOSE){
57 57
             return;
58 58
         }
59 59
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function enable(): self
91 91
     {
92
-        if (!empty($this->logs)) {
92
+        if (!empty($this->logs)){
93 93
             $this->logs->addListener($this);
94 94
         }
95 95
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function disable(): self
105 105
     {
106
-        if (!empty($this->logs)) {
106
+        if (!empty($this->logs)){
107 107
             $this->logs->removeListener($this);
108 108
         }
109 109
 
@@ -126,13 +126,13 @@  discard block
 block discarded – undo
126 126
      */
127 127
     private function getChannel(string $channel): string
128 128
     {
129
-        if (!class_exists($channel, false)) {
129
+        if (!class_exists($channel, false)){
130 130
             return "[{$channel}]";
131 131
         }
132 132
 
133
-        try {
133
+        try{
134 134
             $reflection = new \ReflectionClass($channel);
135
-        } catch (\ReflectionException $e) {
135
+        }catch (\ReflectionException $e){
136 136
             return $channel;
137 137
         }
138 138
 
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
      */
147 147
     private function getMessage(bool $decorated, string $message)
148 148
     {
149
-        if (!$decorated) {
149
+        if (!$decorated){
150 150
             return $message;
151 151
         }
152 152
 
153
-        return Color::GRAY . $message . Color::RESET;
153
+        return Color::GRAY.$message.Color::RESET;
154 154
     }
155 155
 }
Please login to merge, or discard this patch.
src/Console/CommandLocator.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
     public function locateCommands(): array
37 37
     {
38 38
         $commands = [];
39
-        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) {
40
-            if ($class->isAbstract()) {
39
+        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class){
40
+            if ($class->isAbstract()){
41 41
                 continue;
42 42
             }
43 43
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,10 @@
 block discarded – undo
36 36
     public function locateCommands(): array
37 37
     {
38 38
         $commands = [];
39
-        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class) {
40
-            if ($class->isAbstract()) {
39
+        foreach ($this->classes->getClasses(\Symfony\Component\Console\Command\Command::class) as $class)
40
+        {
41
+            if ($class->isAbstract())
42
+            {
41 43
                 continue;
42 44
             }
43 45
 
Please login to merge, or discard this patch.
src/Translator/Views/LocaleProcessor.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,8 @@
 block discarded – undo
46 46
         //We are not forcing locale for now
47 47
         return $source->withCode(preg_replace_callback(
48 48
             self::REGEXP,
49
-            function ($matches) use ($domain, $context) {
49
+            function ($matches) use ($domain, $context)
50
+            {
50 51
                 return $this->translator->trans(
51 52
                     $matches[1],
52 53
                     [],
Please login to merge, or discard this patch.
src/Jobs/JobDispatcher.php 2 patches
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,8 +57,10 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $consumer = $this->container->get(Consumer::class);
59 59
 
60
-        $consumer->serve(function (\Throwable $e = null) {
61
-            if ($e !== null) {
60
+        $consumer->serve(function (\Throwable $e = null)
61
+        {
62
+            if ($e !== null)
63
+            {
62 64
                 $this->handleException($e);
63 65
             }
64 66
 
@@ -71,9 +73,12 @@  discard block
 block discarded – undo
71 73
      */
72 74
     protected function handleException(\Throwable $e)
73 75
     {
74
-        try {
76
+        try
77
+        {
75 78
             $this->container->get(SnapshotterInterface::class)->register($e);
76
-        } catch (\Throwable|ContainerExceptionInterface $se) {
79
+        }
80
+        catch (\Throwable|ContainerExceptionInterface $se)
81
+        {
77 82
             // no need to notify when unable to register an exception
78 83
         }
79 84
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         EnvironmentInterface $env,
37 37
         FinalizerInterface $finalizer,
38 38
         ContainerInterface $container
39
-    ) {
39
+    ){
40 40
         $this->env = $env;
41 41
         $this->finalizer = $finalizer;
42 42
         $this->container = $container;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $consumer = $this->container->get(Consumer::class);
59 59
 
60
-        $consumer->serve(function (\Throwable $e = null) {
61
-            if ($e !== null) {
60
+        $consumer->serve(function (\Throwable $e = null){
61
+            if ($e !== null){
62 62
                 $this->handleException($e);
63 63
             }
64 64
 
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
      */
72 72
     protected function handleException(\Throwable $e)
73 73
     {
74
-        try {
74
+        try{
75 75
             $this->container->get(SnapshotterInterface::class)->register($e);
76
-        } catch (\Throwable|ContainerExceptionInterface $se) {
76
+        }catch (\Throwable | ContainerExceptionInterface $se){
77 77
             // no need to notify when unable to register an exception
78 78
         }
79 79
     }
Please login to merge, or discard this patch.
tests/Framework/Cycle/MigrateTest.php 2 patches
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,10 +39,13 @@
 block discarded – undo
39 39
 
40 40
         $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php');
41 41
         unlink(__DIR__ . '/../../app/src/User/User.php');
42
-        try {
42
+        try
43
+        {
43 44
             $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]);
44 45
             $this->assertContains('drop foreign key', $output);
45
-        } finally {
46
+        }
47
+        finally
48
+        {
46 49
             file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user);
47 50
         }
48 51
     }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,13 +50,13 @@
 block discarded – undo
50 50
         $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]);
51 51
         $this->assertContains('default.users', $output);
52 52
 
53
-        $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php');
54
-        unlink(__DIR__ . '/../../app/src/User/User.php');
55
-        try {
53
+        $user = file_get_contents(__DIR__.'/../../app/src/User/User.php');
54
+        unlink(__DIR__.'/../../app/src/User/User.php');
55
+        try{
56 56
             $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]);
57 57
             $this->assertContains('drop foreign key', $output);
58
-        } finally {
59
-            file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user);
58
+        }finally{
59
+            file_put_contents(__DIR__.'/../../app/src/User/User.php', $user);
60 60
         }
61 61
     }
62 62
 }
Please login to merge, or discard this patch.
tests/Framework/Jobs/DispatcherTest.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         $this->assertNull($this->app->getEnvironment()->get('FIRED'));
39 39
 
40 40
         $w->shouldReceive('receive')->once()->with(
41
-            \Mockery::on(function (&$context) {
41
+            \Mockery::on(function (&$context){
42 42
                 $context = '{
43 43
                   "id": "1", 
44 44
                   "job": "spiral.app.job.TestJob"
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $this->app->getContainer()->bind(Worker::class, $w);
67 67
 
68 68
         $w->shouldReceive('receive')->once()->with(
69
-            \Mockery::on(function (&$context) {
69
+            \Mockery::on(function (&$context){
70 70
                 $context = '{
71 71
                   "id": "1", 
72 72
                   "job": "spiral.app.job.ErrorJob"
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $w->shouldReceive('receive')->once()->andReturn(null);
83 83
 
84 84
         $files = $this->app->get(FilesInterface::class)->getFiles(
85
-            $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/'
85
+            $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/'
86 86
         );
87 87
 
88 88
         $this->assertCount(0, $files);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
         $this->app->get(JobDispatcher::class)->serve();
91 91
 
92 92
         $files = $this->app->get(FilesInterface::class)->getFiles(
93
-            $this->app->get(DirectoriesInterface::class)->get('runtime') . '/snapshots/'
93
+            $this->app->get(DirectoriesInterface::class)->get('runtime').'/snapshots/'
94 94
         );
95 95
 
96 96
         $this->assertCount(1, $files);
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,8 @@  discard block
 block discarded – undo
38 38
         $this->assertNull($this->app->getEnvironment()->get('FIRED'));
39 39
 
40 40
         $w->shouldReceive('receive')->once()->with(
41
-            \Mockery::on(function (&$context) {
41
+            \Mockery::on(function (&$context)
42
+            {
42 43
                 $context = '{
43 44
                   "id": "1", 
44 45
                   "job": "spiral.app.job.TestJob"
@@ -66,7 +67,8 @@  discard block
 block discarded – undo
66 67
         $this->app->getContainer()->bind(Worker::class, $w);
67 68
 
68 69
         $w->shouldReceive('receive')->once()->with(
69
-            \Mockery::on(function (&$context) {
70
+            \Mockery::on(function (&$context)
71
+            {
70 72
                 $context = '{
71 73
                   "id": "1", 
72 74
                   "job": "spiral.app.job.ErrorJob"
Please login to merge, or discard this patch.
tests/app/src/Bootloader/AppBootloader.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         PermissionsInterface $rbac,
30 30
         ViewsBootloader $views,
31 31
         ValidationBootloader $validation
32
-    ) {
32
+    ){
33 33
         $rbac->addRole('user');
34 34
         $rbac->associate('user', '*');
35 35
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         $router->setDefault($route->withDefaults(['name' => 'Dave']));
42 42
 
43
-        $views->addDirectory('custom', __DIR__ . '/../../views/custom/');
43
+        $views->addDirectory('custom', __DIR__.'/../../views/custom/');
44 44
         $views->addEngine(TestEngine::class);
45 45
 
46 46
         $validation->addAlias('aliased', 'notEmpty');
Please login to merge, or discard this patch.
src/Http/Middleware/SessionMiddleware.php 2 patches
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -69,14 +69,18 @@  discard block
 block discarded – undo
69 69
             $this->fetchID($request)
70 70
         );
71 71
 
72
-        try {
72
+        try
73
+        {
73 74
             $response = $this->scope->runScope(
74 75
                 [SessionInterface::class => $session],
75
-                function () use ($session, $request, $handler) {
76
+                function () use ($session, $request, $handler)
77
+                {
76 78
                     return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session));
77 79
                 }
78 80
             );
79
-        } catch (\Throwable $e) {
81
+        }
82
+        catch (\Throwable $e)
83
+        {
80 84
             $session->abort();
81 85
             throw $e;
82 86
         }
@@ -95,14 +99,16 @@  discard block
 block discarded – undo
95 99
         Request $request,
96 100
         Response $response
97 101
     ): Response {
98
-        if (!$session->isStarted()) {
102
+        if (!$session->isStarted())
103
+        {
99 104
             return $response;
100 105
         }
101 106
 
102 107
         $session->commit();
103 108
 
104 109
         //SID changed
105
-        if ($this->fetchID($request) != $session->getID()) {
110
+        if ($this->fetchID($request) != $session->getID())
111
+        {
106 112
             return $this->withCookie($request, $response, $session->getID());
107 113
         }
108 114
 
@@ -119,7 +125,8 @@  discard block
 block discarded – undo
119 125
     protected function fetchID(Request $request): ?string
120 126
     {
121 127
         $cookies = $request->getCookieParams();
122
-        if (empty($cookies[$this->config->getCookie()])) {
128
+        if (empty($cookies[$this->config->getCookie()]))
129
+        {
123 130
             return null;
124 131
         }
125 132
 
@@ -152,7 +159,8 @@  discard block
 block discarded – undo
152 159
     protected function clientSignature(Request $request): string
153 160
     {
154 161
         $signature = '';
155
-        foreach (static::SIGNATURE_HEADERS as $header) {
162
+        foreach (static::SIGNATURE_HEADERS as $header)
163
+        {
156 164
             $signature .= $request->getHeaderLine($header) . ';';
157 165
         }
158 166
 
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         CookiesConfig $cookiesConfig,
58 58
         SessionFactory $factory,
59 59
         ScopeInterface $scope
60
-    ) {
60
+    ){
61 61
         $this->config = $config;
62 62
         $this->httpConfig = $httpConfig;
63 63
         $this->cookiesConfig = $cookiesConfig;
@@ -76,14 +76,14 @@  discard block
 block discarded – undo
76 76
             $this->fetchID($request)
77 77
         );
78 78
 
79
-        try {
79
+        try{
80 80
             $response = $this->scope->runScope(
81 81
                 [SessionInterface::class => $session],
82 82
                 function () use ($session, $request, $handler) {
83 83
                     return $handler->handle($request->withAttribute(static::ATTRIBUTE, $session));
84 84
                 }
85 85
             );
86
-        } catch (\Throwable $e) {
86
+        }catch (\Throwable $e){
87 87
             $session->abort();
88 88
             throw $e;
89 89
         }
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
         Request $request,
103 103
         Response $response
104 104
     ): Response {
105
-        if (!$session->isStarted()) {
105
+        if (!$session->isStarted()){
106 106
             return $response;
107 107
         }
108 108
 
109 109
         $session->commit();
110 110
 
111 111
         //SID changed
112
-        if ($this->fetchID($request) != $session->getID()) {
112
+        if ($this->fetchID($request) != $session->getID()){
113 113
             return $this->withCookie($request, $response, $session->getID());
114 114
         }
115 115
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     protected function fetchID(Request $request): ?string
127 127
     {
128 128
         $cookies = $request->getCookieParams();
129
-        if (empty($cookies[$this->config->getCookie()])) {
129
+        if (empty($cookies[$this->config->getCookie()])){
130 130
             return null;
131 131
         }
132 132
 
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
     protected function clientSignature(Request $request): string
160 160
     {
161 161
         $signature = '';
162
-        foreach (static::SIGNATURE_HEADERS as $header) {
163
-            $signature .= $request->getHeaderLine($header) . ';';
162
+        foreach (static::SIGNATURE_HEADERS as $header){
163
+            $signature .= $request->getHeaderLine($header).';';
164 164
         }
165 165
 
166 166
         return hash('sha256', $signature);
Please login to merge, or discard this patch.
src/GRPC/ServiceLocator.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,15 +38,15 @@
 block discarded – undo
38 38
     public function getServices(): array
39 39
     {
40 40
         $result = [];
41
-        foreach ($this->classes->getClasses(ServiceInterface::class) as $service) {
42
-            if (!$service->isInstantiable()) {
41
+        foreach ($this->classes->getClasses(ServiceInterface::class) as $service){
42
+            if (!$service->isInstantiable()){
43 43
                 continue;
44 44
             }
45 45
 
46 46
             $instance = $this->container->get($service->getName());
47 47
 
48
-            foreach ($service->getInterfaces() as $interface) {
49
-                if ($interface->isSubclassOf(ServiceInterface::class)) {
48
+            foreach ($service->getInterfaces() as $interface){
49
+                if ($interface->isSubclassOf(ServiceInterface::class)){
50 50
                     $result[$interface->getName()] = $instance;
51 51
                 }
52 52
             }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,15 +38,19 @@
 block discarded – undo
38 38
     public function getServices(): array
39 39
     {
40 40
         $result = [];
41
-        foreach ($this->classes->getClasses(ServiceInterface::class) as $service) {
42
-            if (!$service->isInstantiable()) {
41
+        foreach ($this->classes->getClasses(ServiceInterface::class) as $service)
42
+        {
43
+            if (!$service->isInstantiable())
44
+            {
43 45
                 continue;
44 46
             }
45 47
 
46 48
             $instance = $this->container->get($service->getName());
47 49
 
48
-            foreach ($service->getInterfaces() as $interface) {
49
-                if ($interface->isSubclassOf(ServiceInterface::class)) {
50
+            foreach ($service->getInterfaces() as $interface)
51
+            {
52
+                if ($interface->isSubclassOf(ServiceInterface::class))
53
+                {
50 54
                     $result[$interface->getName()] = $instance;
51 55
                 }
52 56
             }
Please login to merge, or discard this patch.