Passed
Push — master ( ca5e1a...9b142b )
by Anton
04:12
created
tests/Framework/Cycle/MigrateTest.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@
 block discarded – undo
37 37
         $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]);
38 38
         $this->assertContains('default.users', $output);
39 39
 
40
-        $user = file_get_contents(__DIR__ . '/../../app/src/User/User.php');
41
-        unlink(__DIR__ . '/../../app/src/User/User.php');
42
-        try {
40
+        $user = file_get_contents(__DIR__.'/../../app/src/User/User.php');
41
+        unlink(__DIR__.'/../../app/src/User/User.php');
42
+        try{
43 43
             $output = $this->runCommandDebug('cycle:migrate', ['-r' => true]);
44 44
             $this->assertContains('drop foreign key', $output);
45
-        } finally {
46
-            file_put_contents(__DIR__ . '/../../app/src/User/User.php', $user);
45
+        }finally{
46
+            file_put_contents(__DIR__.'/../../app/src/User/User.php', $user);
47 47
         }
48 48
     }
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
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.
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.
tests/app/src/Job/ErrorJob.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,8 +12,10 @@
 block discarded – undo
12 12
 
13 13
 class ErrorJob extends AbstractJob
14 14
 {
15
-    public function do()
15
+    public function do{
16
+        ()
16 17
     {
17 18
         throw new \ErrorException("bad job");
18 19
     }
20
+    }
19 21
 }
20 22
\ No newline at end of file
Please login to merge, or discard this patch.
tests/app/src/Job/TestJob.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,8 +13,10 @@
 block discarded – undo
13 13
 
14 14
 class TestJob extends AbstractJob
15 15
 {
16
-    public function do(EnvironmentInterface $env)
16
+    public function do{
17
+        (EnvironmentInterface $env)
17 18
     {
18 19
         $env->set('FIRED', true);
19 20
     }
21
+    }
20 22
 }
21 23
\ No newline at end of file
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.
src/GRPC/GRPCDispatcher.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
         EnvironmentInterface $env,
38 38
         FinalizerInterface $finalizer,
39 39
         ContainerInterface $container
40
-    ) {
40
+    ){
41 41
         $this->env = $env;
42 42
         $this->finalizer = $finalizer;
43 43
         $this->container = $container;
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
         $worker = $this->container->get(Worker::class);
66 66
         $locator = $this->container->get(LocatorInterface::class);
67 67
 
68
-        foreach ($locator->getServices() as $interface => $service) {
68
+        foreach ($locator->getServices() as $interface => $service){
69 69
             $server->registerService($interface, $service);
70 70
         }
71 71
 
72
-        $server->serve($worker, function (\Throwable $e = null) {
73
-            if ($e !== null) {
72
+        $server->serve($worker, function (\Throwable $e = null){
73
+            if ($e !== null){
74 74
                 $this->handleException($e);
75 75
             }
76 76
 
@@ -83,9 +83,9 @@  discard block
 block discarded – undo
83 83
      */
84 84
     protected function handleException(\Throwable $e)
85 85
     {
86
-        try {
86
+        try{
87 87
             $this->container->get(SnapshotterInterface::class)->register($e);
88
-        } catch (\Throwable|ContainerExceptionInterface $se) {
88
+        }catch (\Throwable | ContainerExceptionInterface $se){
89 89
             // no need to notify when unable to register an exception
90 90
         }
91 91
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -65,12 +65,15 @@  discard block
 block discarded – undo
65 65
         $worker = $this->container->get(Worker::class);
66 66
         $locator = $this->container->get(LocatorInterface::class);
67 67
 
68
-        foreach ($locator->getServices() as $interface => $service) {
68
+        foreach ($locator->getServices() as $interface => $service)
69
+        {
69 70
             $server->registerService($interface, $service);
70 71
         }
71 72
 
72
-        $server->serve($worker, function (\Throwable $e = null) {
73
-            if ($e !== null) {
73
+        $server->serve($worker, function (\Throwable $e = null)
74
+        {
75
+            if ($e !== null)
76
+            {
74 77
                 $this->handleException($e);
75 78
             }
76 79
 
@@ -83,9 +86,12 @@  discard block
 block discarded – undo
83 86
      */
84 87
     protected function handleException(\Throwable $e)
85 88
     {
86
-        try {
89
+        try
90
+        {
87 91
             $this->container->get(SnapshotterInterface::class)->register($e);
88
-        } catch (\Throwable|ContainerExceptionInterface $se) {
92
+        }
93
+        catch (\Throwable|ContainerExceptionInterface $se)
94
+        {
89 95
             // no need to notify when unable to register an exception
90 96
         }
91 97
     }
Please login to merge, or discard this patch.
src/Console/Sequence/RuntimeDirectory.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,19 +43,19 @@  discard block
 block discarded – undo
43 43
 
44 44
         $runtimeDirectory = $this->dirs->get('runtime');
45 45
 
46
-        if (!$this->files->exists($runtimeDirectory)) {
46
+        if (!$this->files->exists($runtimeDirectory)){
47 47
             $this->files->ensureDirectory($runtimeDirectory);
48 48
             $output->writeln("<comment>created</comment>");
49 49
             return;
50
-        } else {
50
+        }else{
51 51
             $output->writeln("<info>exists</info>");
52 52
         }
53 53
 
54
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
55
-            try {
54
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename){
55
+            try{
56 56
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
57 57
                 $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
58
-            } catch (\Throwable $e) {
58
+            }catch (\Throwable $e){
59 59
                 // @codeCoverageIgnoreStart
60 60
                 $output->writeln(sprintf(
61 61
                     "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>",
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
                 // @codeCoverageIgnoreEnd
67 67
             }
68 68
 
69
-            if ($output->isVerbose()) {
69
+            if ($output->isVerbose()){
70 70
                 $output->writeln(sprintf(
71 71
                     "<fg=green>[updated]</fg=green> `%s`",
72 72
                     $this->files->relativePath($filename, $runtimeDirectory)
Please login to merge, or discard this patch.
Braces   +14 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,19 +43,26 @@  discard block
 block discarded – undo
43 43
 
44 44
         $runtimeDirectory = $this->dirs->get('runtime');
45 45
 
46
-        if (!$this->files->exists($runtimeDirectory)) {
46
+        if (!$this->files->exists($runtimeDirectory))
47
+        {
47 48
             $this->files->ensureDirectory($runtimeDirectory);
48 49
             $output->writeln("<comment>created</comment>");
49 50
             return;
50
-        } else {
51
+        }
52
+        else
53
+        {
51 54
             $output->writeln("<info>exists</info>");
52 55
         }
53 56
 
54
-        foreach ($this->files->getFiles($runtimeDirectory) as $filename) {
55
-            try {
57
+        foreach ($this->files->getFiles($runtimeDirectory) as $filename)
58
+        {
59
+            try
60
+            {
56 61
                 $this->files->setPermissions($filename, FilesInterface::RUNTIME);
57 62
                 $this->files->setPermissions(dirname($filename), FilesInterface::RUNTIME);
58
-            } catch (\Throwable $e) {
63
+            }
64
+            catch (\Throwable $e)
65
+            {
59 66
                 // @codeCoverageIgnoreStart
60 67
                 $output->writeln(sprintf(
61 68
                     "<fg=red>[errored]</fg=red> `%s`: <fg=red>%s</fg=red>",
@@ -66,7 +73,8 @@  discard block
 block discarded – undo
66 73
                 // @codeCoverageIgnoreEnd
67 74
             }
68 75
 
69
-            if ($output->isVerbose()) {
76
+            if ($output->isVerbose())
77
+            {
70 78
                 $output->writeln(sprintf(
71 79
                     "<fg=green>[updated]</fg=green> `%s`",
72 80
                     $this->files->relativePath($filename, $runtimeDirectory)
Please login to merge, or discard this patch.