Completed
Push — 6.0 ( 7dc248...c1d76c )
by liu
04:32
created
src/think/model/relation/BelongsToMany.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         // 关联查询
160 160
         $pk = $this->parent->getPk();
161 161
 
162
-        $condition = ['pivot.' . $localKey, '=', $this->parent->$pk];
162
+        $condition = ['pivot.'.$localKey, '=', $this->parent->$pk];
163 163
 
164 164
         return $this->belongsToManyQuery($foreignKey, $localKey, [$condition]);
165 165
     }
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
      */
295 295
     public function wherePivot($field, $op = null, $condition = null)
296 296
     {
297
-        $this->query->where('pivot.' . $field, $op, $condition);
297
+        $this->query->where('pivot.'.$field, $op, $condition);
298 298
         return $this;
299 299
     }
300 300
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         if (!empty($range)) {
324 324
             // 查询关联数据
325 325
             $data = $this->eagerlyManyToMany([
326
-                ['pivot.' . $localKey, 'in', $range],
326
+                ['pivot.'.$localKey, 'in', $range],
327 327
             ], $relation, $subRelation, $closure);
328 328
 
329 329
             // 关联属性名
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
             $pk = $result->$pk;
358 358
             // 查询管理数据
359 359
             $data = $this->eagerlyManyToMany([
360
-                ['pivot.' . $this->localKey, '=', $pk],
360
+                ['pivot.'.$this->localKey, '=', $pk],
361 361
             ], $relation, $subRelation, $closure);
362 362
 
363 363
             // 关联数据封装
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
         }
395 395
 
396 396
         return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [
397
-            ['pivot.' . $this->localKey, '=', $pk],
397
+            ['pivot.'.$this->localKey, '=', $pk],
398 398
         ])->$aggregate($field);
399 399
     }
400 400
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
         return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [
417 417
             [
418
-                'pivot.' . $this->localKey, 'exp', new Raw('=' . $this->parent->db(false)->getTable() . '.' . $this->parent->getPk()),
418
+                'pivot.'.$this->localKey, 'exp', new Raw('='.$this->parent->db(false)->getTable().'.'.$this->parent->getPk()),
419 419
             ],
420 420
         ])->fetchSql()->$aggregate($field);
421 421
     }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
         if (empty($this->baseQuery)) {
495 495
             $relationFk = $this->query->getPk();
496
-            $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk)
496
+            $query->join([$table => 'pivot'], 'pivot.'.$foreignKey.'='.$tableName.'.'.$relationFk)
497 497
                 ->where($condition);
498 498
         }
499 499
 
Please login to merge, or discard this patch.
src/think/route/RuleGroup.php 1 patch
Spacing   +12 added lines, -12 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\route;
14 14
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         }
110 110
 
111 111
         if ($this->parent && $this->parent->getFullName()) {
112
-            $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : '');
112
+            $this->fullName = $this->parent->getFullName().($this->name ? '/'.$this->name : '');
113 113
         } else {
114 114
             $this->fullName = $this->name;
115 115
         }
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
     protected function checkMergeRuleRegex(Request $request, array &$rules, string $url, bool $completeMatch)
305 305
     {
306 306
         $depr  = $this->router->config('pathinfo_depr');
307
-        $url   = $depr . str_replace('|', $depr, $url);
307
+        $url   = $depr.str_replace('|', $depr, $url);
308 308
         $regex = [];
309 309
         $items = [];
310 310
 
311 311
         foreach ($rules as $key => $item) {
312 312
             if ($item instanceof RuleItem) {
313
-                $rule = $depr . str_replace('/', $depr, $item->getRule());
313
+                $rule = $depr.str_replace('/', $depr, $item->getRule());
314 314
                 if ($depr == $rule && $depr != $url) {
315 315
                     unset($rules[$key]);
316 316
                     continue;
@@ -327,21 +327,21 @@  discard block
 block discarded – undo
327 327
                     continue;
328 328
                 }
329 329
 
330
-                $slash = preg_quote('/-' . $depr, '/');
330
+                $slash = preg_quote('/-'.$depr, '/');
331 331
 
332
-                if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) {
332
+                if ($matchRule = preg_split('/['.$slash.']<\w+\??>/', $rule, 2)) {
333 333
                     if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) {
334 334
                         unset($rules[$key]);
335 335
                         continue;
336 336
                     }
337 337
                 }
338 338
 
339
-                if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) {
339
+                if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) {
340 340
                     unset($rules[$key]);
341 341
                     $pattern = array_merge($this->getPattern(), $item->getPattern());
342 342
                     $option  = array_merge($this->getOption(), $item->getOption());
343 343
 
344
-                    $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key);
344
+                    $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_'.$key);
345 345
                     $items[$key] = $item;
346 346
                 }
347 347
             }
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
         }
353 353
 
354 354
         try {
355
-            $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match);
355
+            $result = preg_match('/^(?:'.implode('|', $regex).')/u', $url, $match);
356 356
         } catch (\Exception $e) {
357 357
             throw new Exception('route pattern error');
358 358
         }
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 
370 370
             if (!isset($pos)) {
371 371
                 foreach ($regex as $key => $item) {
372
-                    if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) {
372
+                    if (0 === strpos(str_replace(['\/', '\-', '\\'.$depr], ['/', '-', $depr], $item), $match[0])) {
373 373
                         $pos = $key;
374 374
                         break;
375 375
                     }
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      * @access public
399 399
      * @return RuleItem|null
400 400
      */
401
-    public function getMissRule():  ? RuleItem
401
+    public function getMissRule(): ? RuleItem
402 402
     {
403 403
         return $this->miss;
404 404
     }
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
     public function prefix(string $prefix)
485 485
     {
486 486
         if ($this->parent && $this->parent->getOption('prefix')) {
487
-            $prefix = $this->parent->getOption('prefix') . $prefix;
487
+            $prefix = $this->parent->getOption('prefix').$prefix;
488 488
         }
489 489
 
490 490
         return $this->setOption('prefix', $prefix);
Please login to merge, or discard this patch.
src/think/route/Resource.php 1 patch
Spacing   +6 added lines, -6 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\route;
14 14
 
@@ -109,10 +109,10 @@  discard block
 block discarded – undo
109 109
             $item  = [];
110 110
 
111 111
             foreach ($array as $val) {
112
-                $item[] = $val . '/<' . ($option['var'][$val] ?? $val . '_id') . '>';
112
+                $item[] = $val.'/<'.($option['var'][$val] ?? $val.'_id').'>';
113 113
             }
114 114
 
115
-            $rule = implode('/', $item) . '/' . $last;
115
+            $rule = implode('/', $item).'/'.$last;
116 116
         }
117 117
 
118 118
         $prefix = substr($rule, strlen($this->name) + 1);
@@ -125,12 +125,12 @@  discard block
 block discarded – undo
125 125
             }
126 126
 
127 127
             if (isset($last) && strpos($val[1], '<id>') && isset($option['var'][$last])) {
128
-                $val[1] = str_replace('<id>', '<' . $option['var'][$last] . '>', $val[1]);
128
+                $val[1] = str_replace('<id>', '<'.$option['var'][$last].'>', $val[1]);
129 129
             } elseif (strpos($val[1], '<id>') && isset($option['var'][$rule])) {
130
-                $val[1] = str_replace('<id>', '<' . $option['var'][$rule] . '>', $val[1]);
130
+                $val[1] = str_replace('<id>', '<'.$option['var'][$rule].'>', $val[1]);
131 131
             }
132 132
 
133
-            $ruleItem = $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]);
133
+            $ruleItem = $this->addRule(trim($prefix.$val[1], '/'), $this->route.'/'.$val[2], $val[0]);
134 134
 
135 135
             foreach (['model', 'validate', 'middleware'] as $name) {
136 136
                 if (isset($this->$name[$key])) {
Please login to merge, or discard this patch.
src/think/Model.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think;
14 14
 
@@ -310,12 +310,12 @@  discard block
 block discarded – undo
310 310
             $query = $this->queryInstance;
311 311
         } else {
312 312
             $query = $this->db->connect($this->connection)
313
-                ->name($this->name . $this->suffix)
313
+                ->name($this->name.$this->suffix)
314 314
                 ->pk($this->pk);
315 315
         }
316 316
 
317 317
         if (!empty($this->table)) {
318
-            $query->table($this->table . $this->suffix);
318
+            $query->table($this->table.$this->suffix);
319 319
         }
320 320
 
321 321
         $query->model($this)
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
                 $this->field = array_keys(array_merge($this->schema, $this->jsonType));
516 516
             } else {
517 517
                 $query = $this->db();
518
-                $table = $this->table ? $this->table . $this->suffix : $query->getTable();
518
+                $table = $this->table ? $this->table.$this->suffix : $query->getTable();
519 519
 
520 520
                 $this->field = $query->getConnection()->getTableFields($table);
521 521
             }
Please login to merge, or discard this patch.
src/think/Log.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         if (!isset($this->config['channels'][$name])) {
129
-            throw new InvalidArgumentException('Undefined log config:' . $name);
129
+            throw new InvalidArgumentException('Undefined log config:'.$name);
130 130
         }
131 131
 
132 132
         if (isset($this->config['channels'][$name]['processor'])) {
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         if (is_string($msg) && !empty($context)) {
187 187
             $replace = [];
188 188
             foreach ($context as $key => $val) {
189
-                $replace['{' . $key . '}'] = $val;
189
+                $replace['{'.$key.'}'] = $val;
190 190
             }
191 191
 
192 192
             $msg = strtr($msg, $replace);
Please login to merge, or discard this patch.
src/think/log/driver/File.php 1 patch
Spacing   +18 added lines, -18 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\log\driver;
14 14
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                     $msg = var_export($msg, true);
81 81
                 }
82 82
 
83
-                $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg;
83
+                $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg;
84 84
             }
85 85
 
86 86
             if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) {
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
     protected function getMasterLogFile(): string
139 139
     {
140 140
         if (empty($this->config['path'])) {
141
-            $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR;
141
+            $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR;
142 142
         } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) {
143 143
             $this->config['path'] .= DIRECTORY_SEPARATOR;
144 144
         }
145 145
 
146 146
         if ($this->config['max_files']) {
147
-            $files = glob($this->config['path'] . '*.log');
147
+            $files = glob($this->config['path'].'*.log');
148 148
 
149 149
             try {
150 150
                 if (count($files) > $this->config['max_files']) {
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
         if ($this->config['single']) {
159 159
             $name        = is_string($this->config['single']) ? $this->config['single'] : 'single';
160 160
             $cli         = $this->isCli ? '_cli' : '';
161
-            $destination = $this->config['path'] . $name . $cli . '.log';
161
+            $destination = $this->config['path'].$name.$cli.'.log';
162 162
         } else {
163 163
             $cli = $this->isCli ? '_cli' : '';
164 164
 
165 165
             if ($this->config['max_files']) {
166
-                $filename = date('Ymd') . $cli . '.log';
166
+                $filename = date('Ymd').$cli.'.log';
167 167
             } else {
168
-                $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log';
168
+                $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log';
169 169
             }
170 170
 
171
-            $destination = $this->config['path'] . $filename;
171
+            $destination = $this->config['path'].$filename;
172 172
         }
173 173
 
174 174
         return $destination;
@@ -188,14 +188,14 @@  discard block
 block discarded – undo
188 188
         if ($this->config['single']) {
189 189
             $name = is_string($this->config['single']) ? $this->config['single'] : 'single';
190 190
 
191
-            $name .= '_' . $type;
191
+            $name .= '_'.$type;
192 192
         } elseif ($this->config['max_files']) {
193
-            $name = date('Ymd') . '_' . $type . $cli;
193
+            $name = date('Ymd').'_'.$type.$cli;
194 194
         } else {
195
-            $name = date('d') . '_' . $type . $cli;
195
+            $name = date('d').'_'.$type.$cli;
196 196
         }
197 197
 
198
-        return $path . DIRECTORY_SEPARATOR . $name . '.log';
198
+        return $path.DIRECTORY_SEPARATOR.$name.'.log';
199 199
     }
200 200
 
201 201
     /**
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) {
210 210
             try {
211
-                rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination));
211
+                rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination));
212 212
             } catch (\Exception $e) {
213 213
                 //
214 214
             }
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
     protected function parseCliLog(array $info): string
225 225
     {
226 226
         if ($this->config['json']) {
227
-            $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL;
227
+            $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL;
228 228
         } else {
229 229
             $now = $info['timestamp'];
230 230
             unset($info['timestamp']);
231 231
 
232 232
             $message = implode(PHP_EOL, $info);
233 233
 
234
-            $message = "[{$now}]" . $message . PHP_EOL;
234
+            $message = "[{$now}]".$message.PHP_EOL;
235 235
         }
236 236
 
237 237
         return $message;
@@ -254,13 +254,13 @@  discard block
 block discarded – undo
254 254
 
255 255
         if ($this->config['json']) {
256 256
             $info = $requestInfo + $info;
257
-            return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . PHP_EOL;
257
+            return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES).PHP_EOL;
258 258
         }
259 259
 
260
-        array_unshift($info, "---------------------------------------------------------------" . PHP_EOL . "[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}");
260
+        array_unshift($info, "---------------------------------------------------------------".PHP_EOL."[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}");
261 261
         unset($info['timestamp']);
262 262
 
263
-        return implode(PHP_EOL, $info) . PHP_EOL;
263
+        return implode(PHP_EOL, $info).PHP_EOL;
264 264
     }
265 265
 
266 266
 }
Please login to merge, or discard this patch.
src/think/db/concern/TimeFieldQuery.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: liu21st <[email protected]>
10 10
 // +----------------------------------------------------------------------
11
-declare (strict_types = 1);
11
+declare(strict_types=1);
12 12
 
13 13
 namespace think\db\concern;
14 14
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
             $op = is_array($range) ? 'between' : '>=';
65 65
         }
66 66
 
67
-        return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true);
67
+        return $this->parseWhereExp($logic, $field, strtolower($op).' time', $range, [], true);
68 68
     }
69 69
 
70 70
     /**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     public function whereTimeInterval(string $field, string $start, string $interval = 'day', int $step = 1, string $logic = 'AND')
81 81
     {
82 82
         $startTime = strtotime($start);
83
-        $endTime   = strtotime(($step > 0 ? '+' : '-') . abs($step) . ' ' . $interval . (abs($step) > 1 ? 's' : ''), $startTime);
83
+        $endTime   = strtotime(($step > 0 ? '+' : '-').abs($step).' '.$interval.(abs($step) > 1 ? 's' : ''), $startTime);
84 84
 
85 85
         return $this->whereTime($field, 'between', $step > 0 ? [$startTime, $endTime] : [$endTime, $startTime], $logic);
86 86
     }
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $year = date('Y', strtotime($year));
137 137
         }
138 138
 
139
-        return $this->whereTimeInterval($field, $year . '-1-1', 'year', $step, $logic);
139
+        return $this->whereTimeInterval($field, $year.'-1-1', 'year', $step, $logic);
140 140
     }
141 141
 
142 142
     /**
Please login to merge, or discard this patch.
src/think/model/concern/Attribute.php 1 patch
Spacing   +5 added lines, -5 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\model\concern;
14 14
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
             return $this->relation[$name];
283 283
         }
284 284
 
285
-        throw new InvalidArgumentException('property not exists:' . static::class . '->' . $name);
285
+        throw new InvalidArgumentException('property not exists:'.static::class.'->'.$name);
286 286
     }
287 287
 
288 288
     /**
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function getChangedData(): array
294 294
     {
295
-        $data = $this->force ? $this->data : array_udiff_assoc($this->data, $this->origin, function ($a, $b) {
295
+        $data = $this->force ? $this->data : array_udiff_assoc($this->data, $this->origin, function($a, $b) {
296 296
             if ((empty($a) || empty($b)) && $a !== $b) {
297 297
                 return 1;
298 298
             }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
             $value = $this->autoWriteTimestamp();
360 360
         } else {
361 361
             // 检测修改器
362
-            $method = 'set' . App::parseName($name, 1) . 'Attr';
362
+            $method = 'set'.App::parseName($name, 1).'Attr';
363 363
 
364 364
             if (method_exists($this, $method)) {
365 365
                 $array = $this->data;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
     {
483 483
         // 检测属性获取器
484 484
         $fieldName = $this->getRealFieldName($name);
485
-        $method    = 'get' . App::parseName($name, 1) . 'Attr';
485
+        $method    = 'get'.App::parseName($name, 1).'Attr';
486 486
 
487 487
         if (isset($this->withAttr[$fieldName])) {
488 488
             if ($relation) {
Please login to merge, or discard this patch.