Completed
Push — 6.0 ( 6d3b4b...d9c211 )
by liu
06:00
created
src/think/Validate.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public function hasScene(string $name): bool
369 369
     {
370
-        return isset($this->scene[$name]) || method_exists($this, 'scene' . $name);
370
+        return isset($this->scene[$name]) || method_exists($this, 'scene'.$name);
371 371
     }
372 372
 
373 373
     /**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
             if (strpos($field, '_confirm')) {
720 720
                 $rule = strstr($field, '_confirm', true);
721 721
             } else {
722
-                $rule = $field . '_confirm';
722
+                $rule = $field.'_confirm';
723 723
             }
724 724
         }
725 725
 
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
                 if (isset($this->type[$rule])) {
871 871
                     // 注册的验证规则
872 872
                     $result = call_user_func_array($this->type[$rule], [$value]);
873
-                } elseif (function_exists('ctype_' . $rule)) {
873
+                } elseif (function_exists('ctype_'.$rule)) {
874 874
                     // ctype验证规则
875
-                    $ctypeFun = 'ctype_' . $rule;
875
+                    $ctypeFun = 'ctype_'.$rule;
876 876
                     $result   = $ctypeFun($value);
877 877
                 } elseif (isset($this->filter[$rule])) {
878 878
                     // Filter_var验证规则
@@ -1510,7 +1510,7 @@  discard block
 block discarded – undo
1510 1510
 
1511 1511
         if (is_string($rule) && 0 !== strpos($rule, '/') && !preg_match('/\/[imsU]{0,4}$/', $rule)) {
1512 1512
             // 不是正则表达式则两端补上/
1513
-            $rule = '/^' . $rule . '$/';
1513
+            $rule = '/^'.$rule.'$/';
1514 1514
         }
1515 1515
 
1516 1516
         return is_scalar($value) && 1 === preg_match($rule, (string) $value);
@@ -1560,8 +1560,8 @@  discard block
 block discarded – undo
1560 1560
      */
1561 1561
     protected function getRuleMsg(string $attribute, string $title, string $type, $rule)
1562 1562
     {
1563
-        if (isset($this->message[$attribute . '.' . $type])) {
1564
-            $msg = $this->message[$attribute . '.' . $type];
1563
+        if (isset($this->message[$attribute.'.'.$type])) {
1564
+            $msg = $this->message[$attribute.'.'.$type];
1565 1565
         } elseif (isset($this->message[$attribute][$type])) {
1566 1566
             $msg = $this->message[$attribute][$type];
1567 1567
         } elseif (isset($this->message[$attribute])) {
@@ -1571,7 +1571,7 @@  discard block
 block discarded – undo
1571 1571
         } elseif (0 === strpos($type, 'require')) {
1572 1572
             $msg = $this->typeMsg['require'];
1573 1573
         } else {
1574
-            $msg = $title . $this->lang->get('not conform to the rules');
1574
+            $msg = $title.$this->lang->get('not conform to the rules');
1575 1575
         }
1576 1576
 
1577 1577
         if (is_array($msg)) {
@@ -1633,8 +1633,8 @@  discard block
 block discarded – undo
1633 1633
     {
1634 1634
         $this->only = $this->append = $this->remove = [];
1635 1635
 
1636
-        if (method_exists($this, 'scene' . $scene)) {
1637
-            call_user_func([$this, 'scene' . $scene]);
1636
+        if (method_exists($this, 'scene'.$scene)) {
1637
+            call_user_func([$this, 'scene'.$scene]);
1638 1638
         } elseif (isset($this->scene[$scene])) {
1639 1639
             // 如果设置了验证适用场景
1640 1640
             $this->only = $this->scene[$scene];
Please login to merge, or discard this patch.
tests/EventTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $this->event->bind(['foo' => 'baz']);
44 44
 
45
-        $this->event->listen('foo', function ($bar) {
45
+        $this->event->listen('foo', function($bar) {
46 46
             $this->assertEquals('bar', $bar);
47 47
         });
48 48
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 
58 58
     public function testOnceEvent()
59 59
     {
60
-        $this->event->listen('AppInit', function ($bar) {
60
+        $this->event->listen('AppInit', function($bar) {
61 61
             $this->assertEquals('bar', $bar);
62 62
             return 'foo';
63 63
         });
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     {
82 82
         $listener = m::mock("overload:SomeListener", TestListener::class);
83 83
 
84
-        $listener->shouldReceive('subscribe')->andReturnUsing(function (Event $event) use ($listener) {
84
+        $listener->shouldReceive('subscribe')->andReturnUsing(function(Event $event) use ($listener) {
85 85
 
86 86
             $listener->shouldReceive('onBar')->once()->andReturnFalse();
87 87
 
Please login to merge, or discard this patch.
src/think/Event.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         foreach ($methods as $method) {
222 222
             $name = $method->getName();
223 223
             if (0 === strpos($name, 'on')) {
224
-                $this->listen($prefix . substr($name, 2), [$observer, $name]);
224
+                $this->listen($prefix.substr($name, 2), [$observer, $name]);
225 225
             }
226 226
         }
227 227
 
Please login to merge, or discard this patch.
src/think/filesystem/Driver.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\filesystem;
14 14
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     public function putFileAs(string $path, File $file, string $name, array $options = [])
116 116
     {
117 117
         $stream = fopen($file->getRealPath(), 'r');
118
-        $path = trim($path . '/' . $name, '/');
118
+        $path = trim($path.'/'.$name, '/');
119 119
 
120 120
         $result = $this->putStream($path, $stream, $options);
121 121
 
Please login to merge, or discard this patch.
src/think/Middleware.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: Slince <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
     public function pipeline(string $type = 'global')
129 129
     {
130 130
         return (new Pipeline())
131
-            ->through(array_map(function ($middleware) {
132
-                return function ($request, $next) use ($middleware) {
131
+            ->through(array_map(function($middleware) {
132
+                return function($request, $next) use ($middleware) {
133 133
                     list($call, $param) = $middleware;
134 134
                     if (is_array($call) && is_string($call[0])) {
135 135
                         $call = [$this->app->make($call[0]), $call[1]];
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     protected function sortMiddleware(array $middlewares)
227 227
     {
228 228
         $priority = $this->app->config->get('middleware.priority', []);
229
-        uasort($middlewares, function ($a, $b) use ($priority) {
229
+        uasort($middlewares, function($a, $b) use ($priority) {
230 230
             $aPriority = $this->getMiddlewarePriority($priority, $a);
231 231
             $bPriority = $this->getMiddlewarePriority($priority, $b);
232 232
             return $bPriority - $aPriority;
Please login to merge, or discard this patch.
tests/HttpTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
         $route = m::mock(Route::class);
49 49
 
50
-        $route->shouldReceive('dispatch')->withArgs(function ($req, $withRoute) use ($request) {
50
+        $route->shouldReceive('dispatch')->withArgs(function($req, $withRoute) use ($request) {
51 51
             if ($withRoute) {
52 52
                 $withRoute();
53 53
             }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
             ],
78 78
         ]);
79 79
 
80
-        $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url() . DIRECTORY_SEPARATOR);
81
-        $this->app->shouldReceive('getRootPath')->andReturn($root->url() . DIRECTORY_SEPARATOR);
80
+        $this->app->shouldReceive('getBasePath')->andReturn($root->getChild('app')->url().DIRECTORY_SEPARATOR);
81
+        $this->app->shouldReceive('getRootPath')->andReturn($root->url().DIRECTORY_SEPARATOR);
82 82
 
83 83
         $request  = m::mock(Request::class)->makePartial();
84 84
         $response = m::mock(Response::class)->makePartial();
Please login to merge, or discard this patch.
src/think/Http.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         $this->app = $app;
54 54
 
55
-        $this->routePath = $this->app->getRootPath() . 'route' . DIRECTORY_SEPARATOR;
55
+        $this->routePath = $this->app->getRootPath().'route'.DIRECTORY_SEPARATOR;
56 56
     }
57 57
 
58 58
     /**
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
 
200 200
         return $this->app->middleware->pipeline()
201 201
             ->send($request)
202
-            ->then(function ($request) {
202
+            ->then(function($request) {
203 203
                 return $this->dispatchToRoute($request);
204 204
             });
205 205
     }
206 206
 
207 207
     protected function dispatchToRoute($request)
208 208
     {
209
-        $withRoute = $this->app->config->get('app.with_route', true) ? function () {
209
+        $withRoute = $this->app->config->get('app.with_route', true) ? function() {
210 210
             $this->loadRoutes();
211 211
         } : null;
212 212
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
      */
219 219
     protected function loadMiddleware(): void
220 220
     {
221
-        if (is_file($this->app->getBasePath() . 'middleware.php')) {
222
-            $this->app->middleware->import(include $this->app->getBasePath() . 'middleware.php');
221
+        if (is_file($this->app->getBasePath().'middleware.php')) {
222
+            $this->app->middleware->import(include $this->app->getBasePath().'middleware.php');
223 223
         }
224 224
     }
225 225
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $routePath = $this->getRoutePath();
235 235
 
236 236
         if (is_dir($routePath)) {
237
-            $files = glob($routePath . '*.php');
237
+            $files = glob($routePath.'*.php');
238 238
             foreach ($files as $file) {
239 239
                 include $file;
240 240
             }
Please login to merge, or discard this patch.
src/think/console/Command.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: yunwuxin <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\console;
14 14
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         ];
405 405
         $replacements = [
406 406
             $name,
407
-            $_SERVER['PHP_SELF'] . ' ' . $name,
407
+            $_SERVER['PHP_SELF'].' '.$name,
408 408
         ];
409 409
 
410 410
         return str_replace($placeholders, $replacements, $this->getHelp());
Please login to merge, or discard this patch.
src/think/view/driver/Php.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 // +----------------------------------------------------------------------
9 9
 // | Author: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\view\driver;
14 14
 
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 
79 79
         // 模板不存在 抛出异常
80 80
         if (!is_file($template)) {
81
-            throw new RuntimeException('template not exists:' . $template);
81
+            throw new RuntimeException('template not exists:'.$template);
82 82
         }
83 83
 
84 84
         $this->template = $template;
85 85
 
86 86
         // 记录视图信息
87 87
         $this->app->log
88
-            ->record('[ VIEW ] ' . $template . ' [ ' . var_export(array_keys($data), true) . ' ]');
88
+            ->record('[ VIEW ] '.$template.' [ '.var_export(array_keys($data), true).' ]');
89 89
 
90 90
         extract($data, EXTR_OVERWRITE);
91 91
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $this->content = $content;
105 105
 
106 106
         extract($data, EXTR_OVERWRITE);
107
-        eval('?>' . $this->content);
107
+        eval('?>'.$this->content);
108 108
     }
109 109
 
110 110
     /**
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
             $appName = isset($app) ? $app : $this->app->http->getName();
130 130
             $view    = $this->config['view_dir_name'];
131 131
 
132
-            if (is_dir($this->app->getAppPath() . $view)) {
133
-                $path = isset($app) ? $this->app->getBasePath() . ($appName ? $appName . DIRECTORY_SEPARATOR : '') . $view . DIRECTORY_SEPARATOR : $this->app->getAppPath() . $view . DIRECTORY_SEPARATOR;
132
+            if (is_dir($this->app->getAppPath().$view)) {
133
+                $path = isset($app) ? $this->app->getBasePath().($appName ? $appName.DIRECTORY_SEPARATOR : '').$view.DIRECTORY_SEPARATOR : $this->app->getAppPath().$view.DIRECTORY_SEPARATOR;
134 134
             } else {
135
-                $path = $this->app->getRootPath() . $view . DIRECTORY_SEPARATOR . ($appName ? $appName . DIRECTORY_SEPARATOR : '');
135
+                $path = $this->app->getRootPath().$view.DIRECTORY_SEPARATOR.($appName ? $appName.DIRECTORY_SEPARATOR : '');
136 136
             }
137 137
         }
138 138
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
             $controller = $request->controller();
144 144
             if (strpos($controller, '.')) {
145 145
                 $pos        = strrpos($controller, '.');
146
-                $controller = substr($controller, 0, $pos) . '.' . Str::snake(substr($controller, $pos + 1));
146
+                $controller = substr($controller, 0, $pos).'.'.Str::snake(substr($controller, $pos + 1));
147 147
             } else {
148 148
                 $controller = Str::snake($controller);
149 149
             }
@@ -159,16 +159,16 @@  discard block
 block discarded – undo
159 159
                         $template = Str::snake($request->action());
160 160
                     }
161 161
 
162
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
162
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
163 163
                 } elseif (false === strpos($template, $depr)) {
164
-                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller) . $depr . $template;
164
+                    $template = str_replace('.', DIRECTORY_SEPARATOR, $controller).$depr.$template;
165 165
                 }
166 166
             }
167 167
         } else {
168 168
             $template = str_replace(['/', ':'], $depr, substr($template, 1));
169 169
         }
170 170
 
171
-        return $path . ltrim($template, '/') . '.' . ltrim($this->config['view_suffix'], '.');
171
+        return $path.ltrim($template, '/').'.'.ltrim($this->config['view_suffix'], '.');
172 172
     }
173 173
 
174 174
     /**
Please login to merge, or discard this patch.