Passed
Push — master ( 48358c...5b4064 )
by Valentin
13:24 queued 08:47
created
src/AnnotatedRoutes/src/Bootloader/AnnotatedRoutesBootloader.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,14 +67,14 @@  discard block
 block discarded – undo
67 67
         AnnotationRegistry::registerLoader('class_exists');
68 68
 
69 69
         $schema = $this->memory->loadData(self::MEMORY_SECTION);
70
-        if (empty($schema) || !$cached) {
70
+        if (empty($schema) || !$cached){
71 71
             $schema = $locator->findDeclarations();
72 72
             $this->memory->saveData(self::MEMORY_SECTION, $schema);
73 73
         }
74 74
 
75 75
         $this->configureRoutes($schema);
76 76
 
77
-        foreach ($this->groups as $group) {
77
+        foreach ($this->groups as $group){
78 78
             $group->flushRoutes();
79 79
         }
80 80
     }
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     private function configureRoutes(array $routes): void
94 94
     {
95
-        foreach ($routes as $name => $schema) {
95
+        foreach ($routes as $name => $schema){
96 96
             $this->groups
97 97
                 ->getGroup($schema['group'])
98 98
                 ->registerRoute(
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -67,14 +67,16 @@  discard block
 block discarded – undo
67 67
         AnnotationRegistry::registerLoader('class_exists');
68 68
 
69 69
         $schema = $this->memory->loadData(self::MEMORY_SECTION);
70
-        if (empty($schema) || !$cached) {
70
+        if (empty($schema) || !$cached)
71
+        {
71 72
             $schema = $locator->findDeclarations();
72 73
             $this->memory->saveData(self::MEMORY_SECTION, $schema);
73 74
         }
74 75
 
75 76
         $this->configureRoutes($schema);
76 77
 
77
-        foreach ($this->groups as $group) {
78
+        foreach ($this->groups as $group)
79
+        {
78 80
             $group->flushRoutes();
79 81
         }
80 82
     }
@@ -92,7 +94,8 @@  discard block
 block discarded – undo
92 94
      */
93 95
     private function configureRoutes(array $routes): void
94 96
     {
95
-        foreach ($routes as $name => $schema) {
97
+        foreach ($routes as $name => $schema)
98
+        {
96 99
             $this->groups
97 100
                 ->getGroup($schema['group'])
98 101
                 ->registerRoute(
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/RouteGroup.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         ContainerInterface $container,
51 51
         RouterInterface $router,
52 52
         Pipeline $pipeline
53
-    ) {
53
+    ){
54 54
         $this->container = $container;
55 55
         $this->router = $router;
56 56
         $this->pipeline = $pipeline;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function setCore($core): self
80 80
     {
81
-        if (!$core instanceof CoreInterface) {
81
+        if (!$core instanceof CoreInterface){
82 82
             $core = $this->container->get($core);
83 83
         }
84 84
         $this->core = $core;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function addMiddleware($middleware): self
97 97
     {
98
-        if (!$middleware instanceof MiddlewareInterface) {
98
+        if (!$middleware instanceof MiddlewareInterface){
99 99
             $middleware = $this->container->get($middleware);
100 100
         }
101 101
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         array $verbs,
127 127
         array $defaults,
128 128
         array $middleware
129
-    ) {
129
+    ){
130 130
         $this->routes[$name] = [
131 131
             'pattern'    => $pattern,
132 132
             'controller' => $controller,
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
      */
143 143
     public function flushRoutes()
144 144
     {
145
-        foreach ($this->routes as $name => $schema) {
145
+        foreach ($this->routes as $name => $schema){
146 146
             $route = $this->createRoute($schema['pattern'], $schema['controller'], $schema['action']);
147 147
 
148
-            if ($schema['defaults'] !== []) {
148
+            if ($schema['defaults'] !== []){
149 149
                 $route = $route->withDefaults($schema['defaults']);
150 150
             }
151 151
 
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
     public function createRoute(string $pattern, string $controller, string $action): Route
166 166
     {
167 167
         $action = new Action($controller, $action);
168
-        if ($this->core !== null) {
168
+        if ($this->core !== null){
169 169
             $action = $action->withCore($this->core);
170 170
         }
171 171
 
172
-        $route = new Route($this->prefix . $pattern, $action);
172
+        $route = new Route($this->prefix.$pattern, $action);
173 173
 
174 174
         // all routes within group share the same middleware pipeline
175 175
         $route = $route->withMiddleware($this->pipeline);
Please login to merge, or discard this patch.
Braces   +10 added lines, -5 removed lines patch added patch discarded remove patch
@@ -78,7 +78,8 @@  discard block
 block discarded – undo
78 78
      */
79 79
     public function setCore($core): self
80 80
     {
81
-        if (!$core instanceof CoreInterface) {
81
+        if (!$core instanceof CoreInterface)
82
+        {
82 83
             $core = $this->container->get($core);
83 84
         }
84 85
         $this->core = $core;
@@ -95,7 +96,8 @@  discard block
 block discarded – undo
95 96
      */
96 97
     public function addMiddleware($middleware): self
97 98
     {
98
-        if (!$middleware instanceof MiddlewareInterface) {
99
+        if (!$middleware instanceof MiddlewareInterface)
100
+        {
99 101
             $middleware = $this->container->get($middleware);
100 102
         }
101 103
 
@@ -142,10 +144,12 @@  discard block
 block discarded – undo
142 144
      */
143 145
     public function flushRoutes()
144 146
     {
145
-        foreach ($this->routes as $name => $schema) {
147
+        foreach ($this->routes as $name => $schema)
148
+        {
146 149
             $route = $this->createRoute($schema['pattern'], $schema['controller'], $schema['action']);
147 150
 
148
-            if ($schema['defaults'] !== []) {
151
+            if ($schema['defaults'] !== [])
152
+            {
149 153
                 $route = $route->withDefaults($schema['defaults']);
150 154
             }
151 155
 
@@ -165,7 +169,8 @@  discard block
 block discarded – undo
165 169
     public function createRoute(string $pattern, string $controller, string $action): Route
166 170
     {
167 171
         $action = new Action($controller, $action);
168
-        if ($this->core !== null) {
172
+        if ($this->core !== null)
173
+        {
169 174
             $action = $action->withCore($this->core);
170 175
         }
171 176
 
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/RouteLocator.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,8 @@
 block discarded – undo
33 33
     public function findDeclarations(): array
34 34
     {
35 35
         $result = [];
36
-        foreach ($this->locator->findMethods(RouteAnnotation::class) as $match) {
36
+        foreach ($this->locator->findMethods(RouteAnnotation::class) as $match)
37
+        {
37 38
             /** @var RouteAnnotation $route */
38 39
             $route = $match->getAnnotation();
39 40
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     public function findDeclarations(): array
34 34
     {
35 35
         $result = [];
36
-        foreach ($this->locator->findMethods(RouteAnnotation::class) as $match) {
36
+        foreach ($this->locator->findMethods(RouteAnnotation::class) as $match){
37 37
             /** @var RouteAnnotation $route */
38 38
             $route = $match->getAnnotation();
39 39
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
                 'controller' => $match->getClass()->getName(),
43 43
                 'action'     => $match->getMethod()->getName(),
44 44
                 'group'      => $route->group,
45
-                'verbs'      => (array) $route->methods,
45
+                'verbs'      => (array)$route->methods,
46 46
                 'defaults'   => $route->defaults,
47
-                'middleware' => (array) $route->middleware,
47
+                'middleware' => (array)$route->middleware,
48 48
             ];
49 49
         }
50 50
 
Please login to merge, or discard this patch.
src/AnnotatedRoutes/src/GroupRegistry.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
      */
40 40
     public function getGroup(string $name): RouteGroup
41 41
     {
42
-        if (!isset($this->groups[$name])) {
42
+        if (!isset($this->groups[$name])){
43 43
             $this->groups[$name] = $this->factory->make(RouteGroup::class);
44 44
         }
45 45
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,8 @@
 block discarded – undo
39 39
      */
40 40
     public function getGroup(string $name): RouteGroup
41 41
     {
42
-        if (!isset($this->groups[$name])) {
42
+        if (!isset($this->groups[$name]))
43
+        {
43 44
             $this->groups[$name] = $this->factory->make(RouteGroup::class);
44 45
         }
45 46
 
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/TestCase.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
     protected function makeApp(array $env): App
26 26
     {
27 27
         $config = [
28
-            'root' => __DIR__ . '/App',
29
-            'app'  => __DIR__ . '/App',
28
+            'root' => __DIR__.'/App',
29
+            'app'  => __DIR__.'/App',
30 30
         ];
31 31
 
32 32
         return App::init($config, new Environment($env), false);
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/IntegrationTest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
         array $headers = []
52 52
     ): ResponseInterface {
53 53
         $r = $this->request($uri, 'GET', [], $headers, []);
54
-        foreach ($attributes as $k => $v) {
54
+        foreach ($attributes as $k => $v){
55 55
             $r = $r->withAttribute($k, $v);
56 56
         }
57 57
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     public function fetchCookies(array $header)
96 96
     {
97 97
         $result = [];
98
-        foreach ($header as $line) {
98
+        foreach ($header as $line){
99 99
             $cookie = explode('=', $line);
100 100
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
101 101
         }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,8 @@  discard block
 block discarded – undo
51 51
         array $headers = []
52 52
     ): ResponseInterface {
53 53
         $r = $this->request($uri, 'GET', [], $headers, []);
54
-        foreach ($attributes as $k => $v) {
54
+        foreach ($attributes as $k => $v)
55
+        {
55 56
             $r = $r->withAttribute($k, $v);
56 57
         }
57 58
 
@@ -95,7 +96,8 @@  discard block
 block discarded – undo
95 96
     public function fetchCookies(array $header)
96 97
     {
97 98
         $result = [];
98
-        foreach ($header as $line) {
99
+        foreach ($header as $line)
100
+        {
99 101
             $cookie = explode('=', $line);
100 102
             $result[$cookie[0]] = rawurldecode(substr($cookie[1], 0, strpos($cookie[1], ';')));
101 103
         }
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/CacheTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
 
29 29
     public function testCache(): void
30 30
     {
31
-        $this->assertFileExists(__DIR__ . '/App/runtime/cache/routes.php');
32
-        $this->assertCount(2, include __DIR__ . '/App/runtime/cache/routes.php');
31
+        $this->assertFileExists(__DIR__.'/App/runtime/cache/routes.php');
32
+        $this->assertCount(2, include __DIR__.'/App/runtime/cache/routes.php');
33 33
 
34 34
         $this->app->getConsole()->run('route:reset');
35 35
 
36
-        $this->assertSame(null, include __DIR__ . '/App/runtime/cache/routes.php');
36
+        $this->assertSame(null, include __DIR__.'/App/runtime/cache/routes.php');
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
src/AnnotatedRoutes/tests/App/runtime/cache/routes.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php return array (
2
-  'index' => 
3
-  array (
2
+    'index' => 
3
+    array (
4 4
     'pattern' => '/',
5 5
     'controller' => 'Spiral\\Tests\\Router\\App\\Controller\\HomeController',
6 6
     'action' => 'index',
7 7
     'group' => 'default',
8 8
     'verbs' => 
9 9
     array (
10
-      0 => 'GET',
10
+        0 => 'GET',
11 11
     ),
12 12
     'defaults' => 
13 13
     array (
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
     'middleware' => 
16 16
     array (
17 17
     ),
18
-  ),
19
-  'method' => 
20
-  array (
18
+    ),
19
+    'method' => 
20
+    array (
21 21
     'pattern' => '/',
22 22
     'controller' => 'Spiral\\Tests\\Router\\App\\Controller\\HomeController',
23 23
     'action' => 'method',
24 24
     'group' => 'default',
25 25
     'verbs' => 
26 26
     array (
27
-      0 => 'POST',
27
+        0 => 'POST',
28 28
     ),
29 29
     'defaults' => 
30 30
     array (
@@ -32,5 +32,5 @@  discard block
 block discarded – undo
32 32
     'middleware' => 
33 33
     array (
34 34
     ),
35
-  ),
35
+    ),
36 36
 );
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@
 block discarded – undo
1
-<?php return array (
1
+<?php return array(
2 2
   'index' => 
3
-  array (
3
+  array(
4 4
     'pattern' => '/',
5 5
     'controller' => 'Spiral\\Tests\\Router\\App\\Controller\\HomeController',
6 6
     'action' => 'index',
7 7
     'group' => 'default',
8 8
     'verbs' => 
9
-    array (
9
+    array(
10 10
       0 => 'GET',
11 11
     ),
12 12
     'defaults' => 
13
-    array (
13
+    array(
14 14
     ),
15 15
     'middleware' => 
16
-    array (
16
+    array(
17 17
     ),
18 18
   ),
19 19
   'method' => 
20
-  array (
20
+  array(
21 21
     'pattern' => '/',
22 22
     'controller' => 'Spiral\\Tests\\Router\\App\\Controller\\HomeController',
23 23
     'action' => 'method',
24 24
     'group' => 'default',
25 25
     'verbs' => 
26
-    array (
26
+    array(
27 27
       0 => 'POST',
28 28
     ),
29 29
     'defaults' => 
30
-    array (
30
+    array(
31 31
     ),
32 32
     'middleware' => 
33
-    array (
33
+    array(
34 34
     ),
35 35
   ),
36 36
 );
37 37
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/src/Command/Database/EntityCommand.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         ['name', InputArgument::REQUIRED, 'Entity name'],
34 34
         ['format', InputArgument::OPTIONAL, 'Declaration format (annotated, xml?, yaml?, php?)', 'annotated'],
35 35
     ];
36
-    protected const OPTIONS     = [
36
+    protected const OPTIONS = [
37 37
         [
38 38
             'role',
39 39
             'r',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository')){
112 112
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 113
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 114
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         $declaration->setDatabase((string)$this->option('database'));
121 121
         $declaration->setInflection((string)$this->option('inflection'));
122 122
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
123
+        foreach ($this->option('field') as $field){
124
+            if (strpos($field, ':') === false){
125 125
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 126
             }
127 127
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
         $this->writeDeclaration($declaration);
137 137
 
138
-        if ($this->option('repository')) {
138
+        if ($this->option('repository')){
139 139
             $console->run('create:repository', [
140 140
                 'name' => $repository ?? $this->argument('name'),
141 141
             ]);
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
             AbstractDeclaration::ACCESS_PROTECTED,
163 163
             AbstractDeclaration::ACCESS_PRIVATE,
164 164
             ], true)
165
-        ) {
165
+        ){
166 166
             throw new ScaffolderException("Invalid accessibility value `$accessibility`");
167 167
         }
168 168
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,8 @@  discard block
 block discarded – undo
108 108
         $declaration = $this->createDeclaration();
109 109
 
110 110
         $repository = trimPostfix((string)$this->argument('name'), 'repository');
111
-        if ($this->option('repository')) {
111
+        if ($this->option('repository'))
112
+        {
112 113
             $repositoryClass = $config->className(RepositoryCommand::ELEMENT, $repository);
113 114
             $repositoryNamespace = $config->classNamespace(RepositoryCommand::ELEMENT, $repository);
114 115
             $declaration->setRepository("\\$repositoryNamespace\\$repositoryClass");
@@ -120,8 +121,10 @@  discard block
 block discarded – undo
120 121
         $declaration->setDatabase((string)$this->option('database'));
121 122
         $declaration->setInflection((string)$this->option('inflection'));
122 123
 
123
-        foreach ($this->option('field') as $field) {
124
-            if (strpos($field, ':') === false) {
124
+        foreach ($this->option('field') as $field)
125
+        {
126
+            if (strpos($field, ':') === false)
127
+            {
125 128
                 throw new ScaffolderException("Field definition must in 'name:type' or 'name:type' form");
126 129
             }
127 130
 
@@ -135,7 +138,8 @@  discard block
 block discarded – undo
135 138
 
136 139
         $this->writeDeclaration($declaration);
137 140
 
138
-        if ($this->option('repository')) {
141
+        if ($this->option('repository'))
142
+        {
139 143
             $console->run('create:repository', [
140 144
                 'name' => $repository ?? $this->argument('name'),
141 145
             ]);
Please login to merge, or discard this patch.