@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database; |
4 | 4 | |
5 | -use Illuminate\Support\Traits\Macroable; |
|
6 | 5 | use Illuminate\Database\Query\Expression; |
6 | +use Illuminate\Support\Traits\Macroable; |
|
7 | 7 | |
8 | 8 | abstract class Grammar |
9 | 9 | { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function wrapTable($table) |
37 | 37 | { |
38 | - if (! $this->isExpression($table)) { |
|
38 | + if (!$this->isExpression($table)) { |
|
39 | 39 | return $this->wrap($this->tablePrefix.$table, true); |
40 | 40 | } |
41 | 41 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function wrapSegments($segments) |
98 | 98 | { |
99 | - return collect($segments)->map(function ($segment, $key) use ($segments) { |
|
99 | + return collect($segments)->map(function($segment, $key) use ($segments) { |
|
100 | 100 | return $key == 0 && count($segments) > 1 |
101 | 101 | ? $this->wrapTable($segment) |
102 | 102 | : $this->wrapValue($segment); |
@@ -96,7 +96,7 @@ |
||
96 | 96 | */ |
97 | 97 | protected function wrapSegments($segments) |
98 | 98 | { |
99 | - return collect($segments)->map(function ($segment, $key) use ($segments) { |
|
99 | + return collect($segments)->map(function ($segment, $key) use ($segments){ |
|
100 | 100 | return $key == 0 && count($segments) > 1 |
101 | 101 | ? $this->wrapTable($segment) |
102 | 102 | : $this->wrapValue($segment); |
@@ -3,9 +3,9 @@ |
||
3 | 3 | namespace Illuminate\Database\Migrations; |
4 | 4 | |
5 | 5 | use Closure; |
6 | +use Illuminate\Filesystem\Filesystem; |
|
6 | 7 | use Illuminate\Support\Str; |
7 | 8 | use InvalidArgumentException; |
8 | -use Illuminate\Filesystem\Filesystem; |
|
9 | 9 | |
10 | 10 | class MigrationCreator |
11 | 11 | { |
@@ -117,7 +117,7 @@ |
||
117 | 117 | // Here we will replace the table place-holders with the table specified by |
118 | 118 | // the developer, which is useful for quickly creating a tables creation |
119 | 119 | // or update migration from the console instead of typing it manually. |
120 | - if (! is_null($table)) { |
|
120 | + if (!is_null($table)) { |
|
121 | 121 | $stub = str_replace('DummyTable', $table, $stub); |
122 | 122 | } |
123 | 123 |
@@ -77,7 +77,7 @@ |
||
77 | 77 | protected function ensureMigrationDoesntAlreadyExist($name) |
78 | 78 | { |
79 | 79 | if (class_exists($className = $this->getClassName($name))) { |
80 | - throw new InvalidArgumentException("A {$className} class already exists."); |
|
80 | + throw new InvalidArgumentException("a {$className} class already exists."); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 |
@@ -2,11 +2,11 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Migrations; |
4 | 4 | |
5 | +use Illuminate\Database\ConnectionResolverInterface as Resolver; |
|
6 | +use Illuminate\Filesystem\Filesystem; |
|
5 | 7 | use Illuminate\Support\Arr; |
6 | -use Illuminate\Support\Str; |
|
7 | 8 | use Illuminate\Support\Collection; |
8 | -use Illuminate\Filesystem\Filesystem; |
|
9 | -use Illuminate\Database\ConnectionResolverInterface as Resolver; |
|
9 | +use Illuminate\Support\Str; |
|
10 | 10 | |
11 | 11 | class Migrator |
12 | 12 | { |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | protected function pendingMigrations($files, $ran) |
108 | 108 | { |
109 | 109 | return Collection::make($files) |
110 | - ->reject(function ($file) use ($ran) { |
|
110 | + ->reject(function($file) use ($ran) { |
|
111 | 111 | return in_array($this->getMigrationName($file), $ran); |
112 | 112 | })->values()->all(); |
113 | 113 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | foreach ($migrations as $migration) { |
245 | 245 | $migration = (object) $migration; |
246 | 246 | |
247 | - if (! $file = Arr::get($files, $migration->migration)) { |
|
247 | + if (!$file = Arr::get($files, $migration->migration)) { |
|
248 | 248 | $this->note("<fg=red>Migration not found:</> {$migration->migration}"); |
249 | 249 | |
250 | 250 | continue; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | // Since the getRan method that retrieves the migration name just gives us the |
300 | 300 | // migration name, we will format the names into objects with the name as a |
301 | 301 | // property on the objects so that we can pass it to the rollback method. |
302 | - $migrations = collect($migrations)->map(function ($m) { |
|
302 | + $migrations = collect($migrations)->map(function($m){ |
|
303 | 303 | return (object) ['migration' => $m]; |
304 | 304 | })->all(); |
305 | 305 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $migration->getConnection() |
355 | 355 | ); |
356 | 356 | |
357 | - $callback = function () use ($migration, $method) { |
|
357 | + $callback = function() use ($migration, $method) { |
|
358 | 358 | if (method_exists($migration, $method)) { |
359 | 359 | $migration->{$method}(); |
360 | 360 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $migration->getConnection() |
399 | 399 | ); |
400 | 400 | |
401 | - return $db->pretend(function () use ($migration, $method) { |
|
401 | + return $db->pretend(function() use ($migration, $method) { |
|
402 | 402 | if (method_exists($migration, $method)) { |
403 | 403 | $migration->{$method}(); |
404 | 404 | } |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function getMigrationFiles($paths) |
428 | 428 | { |
429 | - return Collection::make($paths)->flatMap(function ($path) { |
|
429 | + return Collection::make($paths)->flatMap(function($path){ |
|
430 | 430 | return $this->files->glob($path.'/*_*.php'); |
431 | - })->filter()->sortBy(function ($file) { |
|
431 | + })->filter()->sortBy(function($file){ |
|
432 | 432 | return $this->getMigrationName($file); |
433 | - })->values()->keyBy(function ($file) { |
|
433 | + })->values()->keyBy(function($file){ |
|
434 | 434 | return $this->getMigrationName($file); |
435 | 435 | })->all(); |
436 | 436 | } |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | */ |
499 | 499 | public function setConnection($name) |
500 | 500 | { |
501 | - if (! is_null($name)) { |
|
501 | + if (!is_null($name)) { |
|
502 | 502 | $this->resolver->setDefaultConnection($name); |
503 | 503 | } |
504 | 504 |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | protected function pendingMigrations($files, $ran) |
108 | 108 | { |
109 | 109 | return Collection::make($files) |
110 | - ->reject(function ($file) use ($ran) { |
|
110 | + ->reject(function ($file) use ($ran){ |
|
111 | 111 | return in_array($this->getMigrationName($file), $ran); |
112 | 112 | })->values()->all(); |
113 | 113 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | // Since the getRan method that retrieves the migration name just gives us the |
300 | 300 | // migration name, we will format the names into objects with the name as a |
301 | 301 | // property on the objects so that we can pass it to the rollback method. |
302 | - $migrations = collect($migrations)->map(function ($m) { |
|
302 | + $migrations = collect($migrations)->map(function ($m){ |
|
303 | 303 | return (object) ['migration' => $m]; |
304 | 304 | })->all(); |
305 | 305 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $migration->getConnection() |
355 | 355 | ); |
356 | 356 | |
357 | - $callback = function () use ($migration, $method) { |
|
357 | + $callback = function () use ($migration, $method){ |
|
358 | 358 | if (method_exists($migration, $method)) { |
359 | 359 | $migration->{$method}(); |
360 | 360 | } |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $migration->getConnection() |
399 | 399 | ); |
400 | 400 | |
401 | - return $db->pretend(function () use ($migration, $method) { |
|
401 | + return $db->pretend(function () use ($migration, $method){ |
|
402 | 402 | if (method_exists($migration, $method)) { |
403 | 403 | $migration->{$method}(); |
404 | 404 | } |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function getMigrationFiles($paths) |
428 | 428 | { |
429 | - return Collection::make($paths)->flatMap(function ($path) { |
|
429 | + return Collection::make($paths)->flatMap(function ($path){ |
|
430 | 430 | return $this->files->glob($path.'/*_*.php'); |
431 | - })->filter()->sortBy(function ($file) { |
|
431 | + })->filter()->sortBy(function ($file){ |
|
432 | 432 | return $this->getMigrationName($file); |
433 | - })->values()->keyBy(function ($file) { |
|
433 | + })->values()->keyBy(function ($file){ |
|
434 | 434 | return $this->getMigrationName($file); |
435 | 435 | })->all(); |
436 | 436 | } |
@@ -76,7 +76,7 @@ |
||
76 | 76 | /** |
77 | 77 | * Get the services provided by the provider. |
78 | 78 | * |
79 | - * @return array |
|
79 | + * @return string[] |
|
80 | 80 | */ |
81 | 81 | public function provides() |
82 | 82 | { |
@@ -2,10 +2,10 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database; |
4 | 4 | |
5 | -use Illuminate\Support\ServiceProvider; |
|
6 | -use Illuminate\Database\Migrations\Migrator; |
|
7 | -use Illuminate\Database\Migrations\MigrationCreator; |
|
8 | 5 | use Illuminate\Database\Migrations\DatabaseMigrationRepository; |
6 | +use Illuminate\Database\Migrations\MigrationCreator; |
|
7 | +use Illuminate\Database\Migrations\Migrator; |
|
8 | +use Illuminate\Support\ServiceProvider; |
|
9 | 9 | |
10 | 10 | class MigrationServiceProvider extends ServiceProvider |
11 | 11 | { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function registerRepository() |
39 | 39 | { |
40 | - $this->app->singleton('migration.repository', function ($app) { |
|
40 | + $this->app->singleton('migration.repository', function($app){ |
|
41 | 41 | $table = $app['config']['database.migrations']; |
42 | 42 | |
43 | 43 | return new DatabaseMigrationRepository($app['db'], $table); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // The migrator is responsible for actually running and rollback the migration |
55 | 55 | // files in the application. We'll pass in our database connection resolver |
56 | 56 | // so the migrator can resolve any of these connections when it needs to. |
57 | - $this->app->singleton('migrator', function ($app) { |
|
57 | + $this->app->singleton('migrator', function($app){ |
|
58 | 58 | $repository = $app['migration.repository']; |
59 | 59 | |
60 | 60 | return new Migrator($repository, $app['db'], $app['files']); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function registerCreator() |
70 | 70 | { |
71 | - $this->app->singleton('migration.creator', function ($app) { |
|
71 | + $this->app->singleton('migration.creator', function($app){ |
|
72 | 72 | return new MigrationCreator($app['files']); |
73 | 73 | }); |
74 | 74 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected function registerRepository() |
39 | 39 | { |
40 | - $this->app->singleton('migration.repository', function ($app) { |
|
40 | + $this->app->singleton('migration.repository', function ($app){ |
|
41 | 41 | $table = $app['config']['database.migrations']; |
42 | 42 | |
43 | 43 | return new DatabaseMigrationRepository($app['db'], $table); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | // The migrator is responsible for actually running and rollback the migration |
55 | 55 | // files in the application. We'll pass in our database connection resolver |
56 | 56 | // so the migrator can resolve any of these connections when it needs to. |
57 | - $this->app->singleton('migrator', function ($app) { |
|
57 | + $this->app->singleton('migrator', function ($app){ |
|
58 | 58 | $repository = $app['migration.repository']; |
59 | 59 | |
60 | 60 | return new Migrator($repository, $app['db'], $app['files']); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function registerCreator() |
70 | 70 | { |
71 | - $this->app->singleton('migration.creator', function ($app) { |
|
71 | + $this->app->singleton('migration.creator', function ($app){ |
|
72 | 72 | return new MigrationCreator($app['files']); |
73 | 73 | }); |
74 | 74 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | /** |
332 | 332 | * Add a new select column to the query. |
333 | 333 | * |
334 | - * @param array|mixed $column |
|
334 | + * @param Expression $column |
|
335 | 335 | * @return $this |
336 | 336 | */ |
337 | 337 | public function addSelect($column) |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | * @param string $value |
674 | 674 | * @param string $operator |
675 | 675 | * @param bool $useDefault |
676 | - * @return array |
|
676 | + * @return string[] |
|
677 | 677 | * |
678 | 678 | * @throws \InvalidArgumentException |
679 | 679 | */ |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | * Prevents using Null values with invalid operators. |
695 | 695 | * |
696 | 696 | * @param string $operator |
697 | - * @param mixed $value |
|
697 | + * @param string $value |
|
698 | 698 | * @return bool |
699 | 699 | */ |
700 | 700 | protected function invalidOperatorAndValue($operator, $value) |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @param string $column |
1062 | 1062 | * @param string $operator |
1063 | - * @param mixed $value |
|
1063 | + * @param string $value |
|
1064 | 1064 | * @param string $boolean |
1065 | 1065 | * @return \Illuminate\Database\Query\Builder|static |
1066 | 1066 | */ |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @param string $column |
1097 | 1097 | * @param string $operator |
1098 | - * @param mixed $value |
|
1098 | + * @param string $value |
|
1099 | 1099 | * @param string $boolean |
1100 | 1100 | * @return \Illuminate\Database\Query\Builder|static |
1101 | 1101 | */ |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | * @param string $type |
1237 | 1237 | * @param string $column |
1238 | 1238 | * @param string $operator |
1239 | - * @param mixed $value |
|
1239 | + * @param string $value |
|
1240 | 1240 | * @param string $boolean |
1241 | 1241 | * @return $this |
1242 | 1242 | */ |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | * |
1541 | 1541 | * @param string $segment |
1542 | 1542 | * @param string $connector |
1543 | - * @param array $parameters |
|
1543 | + * @param string $parameters |
|
1544 | 1544 | * @param int $index |
1545 | 1545 | * @return void |
1546 | 1546 | */ |
@@ -1805,7 +1805,7 @@ discard block |
||
1805 | 1805 | * Constrain the query to the next "page" of results after a given ID. |
1806 | 1806 | * |
1807 | 1807 | * @param int $perPage |
1808 | - * @param int|null $lastId |
|
1808 | + * @param integer $lastId |
|
1809 | 1809 | * @param string $column |
1810 | 1810 | * @return \Illuminate\Database\Query\Builder|static |
1811 | 1811 | */ |
@@ -2529,7 +2529,7 @@ discard block |
||
2529 | 2529 | * Increment a column's value by a given amount. |
2530 | 2530 | * |
2531 | 2531 | * @param string $column |
2532 | - * @param float|int $amount |
|
2532 | + * @param integer $amount |
|
2533 | 2533 | * @param array $extra |
2534 | 2534 | * @return int |
2535 | 2535 | */ |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | * Decrement a column's value by a given amount. |
2551 | 2551 | * |
2552 | 2552 | * @param string $column |
2553 | - * @param float|int $amount |
|
2553 | + * @param integer $amount |
|
2554 | 2554 | * @param array $extra |
2555 | 2555 | * @return int |
2556 | 2556 | */ |
@@ -2767,7 +2767,7 @@ discard block |
||
2767 | 2767 | /** |
2768 | 2768 | * Clone the query without the given properties. |
2769 | 2769 | * |
2770 | - * @param array $properties |
|
2770 | + * @param string[] $properties |
|
2771 | 2771 | * @return static |
2772 | 2772 | */ |
2773 | 2773 | public function cloneWithout(array $properties) |
@@ -2782,7 +2782,7 @@ discard block |
||
2782 | 2782 | /** |
2783 | 2783 | * Clone the query without the given bindings. |
2784 | 2784 | * |
2785 | - * @param array $except |
|
2785 | + * @param string[] $except |
|
2786 | 2786 | * @return static |
2787 | 2787 | */ |
2788 | 2788 | public function cloneWithoutBindings(array $except) |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Query; |
4 | 4 | |
5 | -use Closure; |
|
6 | -use RuntimeException; |
|
7 | 5 | use BadMethodCallException; |
8 | -use Illuminate\Support\Arr; |
|
9 | -use Illuminate\Support\Str; |
|
10 | -use InvalidArgumentException; |
|
11 | -use Illuminate\Support\Collection; |
|
12 | -use Illuminate\Pagination\Paginator; |
|
13 | -use Illuminate\Support\Traits\Macroable; |
|
6 | +use Closure; |
|
14 | 7 | use Illuminate\Contracts\Support\Arrayable; |
15 | -use Illuminate\Database\ConnectionInterface; |
|
16 | 8 | use Illuminate\Database\Concerns\BuildsQueries; |
9 | +use Illuminate\Database\ConnectionInterface; |
|
10 | +use Illuminate\Database\Eloquent\Builder as EloquentBuilder; |
|
17 | 11 | use Illuminate\Database\Query\Grammars\Grammar; |
18 | 12 | use Illuminate\Database\Query\Processors\Processor; |
19 | -use Illuminate\Database\Eloquent\Builder as EloquentBuilder; |
|
13 | +use Illuminate\Pagination\Paginator; |
|
14 | +use Illuminate\Support\Arr; |
|
15 | +use Illuminate\Support\Collection; |
|
16 | +use Illuminate\Support\Str; |
|
17 | +use Illuminate\Support\Traits\Macroable; |
|
18 | +use InvalidArgumentException; |
|
19 | +use RuntimeException; |
|
20 | 20 | |
21 | 21 | class Builder |
22 | 22 | { |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | 'type', 'column', 'operator', 'value', 'boolean' |
640 | 640 | ); |
641 | 641 | |
642 | - if (! $value instanceof Expression) { |
|
642 | + if (!$value instanceof Expression) { |
|
643 | 643 | $this->addBinding($value, 'where'); |
644 | 644 | } |
645 | 645 | |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | */ |
657 | 657 | protected function addArrayOfWheres($column, $boolean, $method = 'where') |
658 | 658 | { |
659 | - return $this->whereNested(function ($query) use ($column, $method, $boolean) { |
|
659 | + return $this->whereNested(function($query) use ($column, $method, $boolean) { |
|
660 | 660 | foreach ($column as $key => $value) { |
661 | 661 | if (is_numeric($key) && is_array($value)) { |
662 | 662 | $query->{$method}(...array_values($value)); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | protected function invalidOperatorAndValue($operator, $value) |
701 | 701 | { |
702 | 702 | return is_null($value) && in_array($operator, $this->operators) && |
703 | - ! in_array($operator, ['=', '<>', '!=']); |
|
703 | + !in_array($operator, ['=', '<>', '!=']); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | /** |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | */ |
712 | 712 | protected function invalidOperator($operator) |
713 | 713 | { |
714 | - return ! in_array(strtolower($operator), $this->operators, true) && |
|
715 | - ! in_array(strtolower($operator), $this->grammar->getOperators(), true); |
|
714 | + return !in_array(strtolower($operator), $this->operators, true) && |
|
715 | + !in_array(strtolower($operator), $this->grammar->getOperators(), true); |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | /** |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | // in which case we will just skip over it since it will be the query as a raw |
858 | 858 | // string and not as a parameterized place-holder to be replaced by the PDO. |
859 | 859 | foreach ($values as $value) { |
860 | - if (! $value instanceof Expression) { |
|
860 | + if (!$value instanceof Expression) { |
|
861 | 861 | $this->addBinding($value, 'where'); |
862 | 862 | } |
863 | 863 | } |
@@ -1244,7 +1244,7 @@ discard block |
||
1244 | 1244 | { |
1245 | 1245 | $this->wheres[] = compact('column', 'type', 'boolean', 'operator', 'value'); |
1246 | 1246 | |
1247 | - if (! $value instanceof Expression) { |
|
1247 | + if (!$value instanceof Expression) { |
|
1248 | 1248 | $this->addBinding($value, 'where'); |
1249 | 1249 | } |
1250 | 1250 | |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | |
1449 | 1449 | $this->wheres[] = compact('type', 'column', 'value', 'boolean', 'not'); |
1450 | 1450 | |
1451 | - if (! $value instanceof Expression) { |
|
1451 | + if (!$value instanceof Expression) { |
|
1452 | 1452 | $this->addBinding($this->grammar->prepareBindingForJsonContains($value)); |
1453 | 1453 | } |
1454 | 1454 | |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | |
1602 | 1602 | $this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean'); |
1603 | 1603 | |
1604 | - if (! $value instanceof Expression) { |
|
1604 | + if (!$value instanceof Expression) { |
|
1605 | 1605 | $this->addBinding($value, 'having'); |
1606 | 1606 | } |
1607 | 1607 | |
@@ -1813,7 +1813,7 @@ discard block |
||
1813 | 1813 | { |
1814 | 1814 | $this->orders = $this->removeExistingOrdersFor($column); |
1815 | 1815 | |
1816 | - if (! is_null($lastId)) { |
|
1816 | + if (!is_null($lastId)) { |
|
1817 | 1817 | $this->where($column, '>', $lastId); |
1818 | 1818 | } |
1819 | 1819 | |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | protected function removeExistingOrdersFor($column) |
1831 | 1831 | { |
1832 | 1832 | return Collection::make($this->orders) |
1833 | - ->reject(function ($order) use ($column) { |
|
1833 | + ->reject(function($order) use ($column) { |
|
1834 | 1834 | return isset($order['column']) |
1835 | 1835 | ? $order['column'] === $column : false; |
1836 | 1836 | })->values()->all(); |
@@ -1877,7 +1877,7 @@ discard block |
||
1877 | 1877 | { |
1878 | 1878 | $this->lock = $value; |
1879 | 1879 | |
1880 | - if (! is_null($this->lock)) { |
|
1880 | + if (!is_null($this->lock)) { |
|
1881 | 1881 | $this->useWritePdo(); |
1882 | 1882 | } |
1883 | 1883 | |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | */ |
1948 | 1948 | public function get($columns = ['*']) |
1949 | 1949 | { |
1950 | - return collect($this->onceWithColumns($columns, function () { |
|
1950 | + return collect($this->onceWithColumns($columns, function(){ |
|
1951 | 1951 | return $this->processor->processSelect($this, $this->runSelect()); |
1952 | 1952 | })); |
1953 | 1953 | } |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | protected function runSelect() |
1961 | 1961 | { |
1962 | 1962 | return $this->connection->select( |
1963 | - $this->toSql(), $this->getBindings(), ! $this->useWritePdo |
|
1963 | + $this->toSql(), $this->getBindings(), !$this->useWritePdo |
|
1964 | 1964 | ); |
1965 | 1965 | } |
1966 | 1966 | |
@@ -2025,7 +2025,7 @@ discard block |
||
2025 | 2025 | // just return the count of the entire results set since that will be correct. |
2026 | 2026 | if (isset($this->groups)) { |
2027 | 2027 | return count($results); |
2028 | - } elseif (! isset($results[0])) { |
|
2028 | + } elseif (!isset($results[0])) { |
|
2029 | 2029 | return 0; |
2030 | 2030 | } elseif (is_object($results[0])) { |
2031 | 2031 | return (int) $results[0]->aggregate; |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | */ |
2057 | 2057 | protected function withoutSelectAliases(array $columns) |
2058 | 2058 | { |
2059 | - return array_map(function ($column) { |
|
2059 | + return array_map(function($column){ |
|
2060 | 2060 | return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false |
2061 | 2061 | ? substr($column, 0, $aliasPosition) : $column; |
2062 | 2062 | }, $columns); |
@@ -2074,7 +2074,7 @@ discard block |
||
2074 | 2074 | } |
2075 | 2075 | |
2076 | 2076 | return $this->connection->cursor( |
2077 | - $this->toSql(), $this->getBindings(), ! $this->useWritePdo |
|
2077 | + $this->toSql(), $this->getBindings(), !$this->useWritePdo |
|
2078 | 2078 | ); |
2079 | 2079 | } |
2080 | 2080 | |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | // the results and get the exact data that was requested for the query. |
2151 | 2151 | $queryResult = $this->onceWithColumns( |
2152 | 2152 | is_null($key) ? [$column] : [$column, $key], |
2153 | - function () { |
|
2153 | + function(){ |
|
2154 | 2154 | return $this->processor->processSelect( |
2155 | 2155 | $this, $this->runSelect() |
2156 | 2156 | ); |
@@ -2254,7 +2254,7 @@ discard block |
||
2254 | 2254 | public function exists() |
2255 | 2255 | { |
2256 | 2256 | $results = $this->connection->select( |
2257 | - $this->grammar->compileExists($this), $this->getBindings(), ! $this->useWritePdo |
|
2257 | + $this->grammar->compileExists($this), $this->getBindings(), !$this->useWritePdo |
|
2258 | 2258 | ); |
2259 | 2259 | |
2260 | 2260 | // If the results has rows, we will get the row and see if the exists column is a |
@@ -2276,7 +2276,7 @@ discard block |
||
2276 | 2276 | */ |
2277 | 2277 | public function doesntExist() |
2278 | 2278 | { |
2279 | - return ! $this->exists(); |
|
2279 | + return !$this->exists(); |
|
2280 | 2280 | } |
2281 | 2281 | |
2282 | 2282 | /** |
@@ -2361,7 +2361,7 @@ discard block |
||
2361 | 2361 | ->setAggregate($function, $columns) |
2362 | 2362 | ->get($columns); |
2363 | 2363 | |
2364 | - if (! $results->isEmpty()) { |
|
2364 | + if (!$results->isEmpty()) { |
|
2365 | 2365 | return array_change_key_case((array) $results[0])['aggregate']; |
2366 | 2366 | } |
2367 | 2367 | } |
@@ -2380,7 +2380,7 @@ discard block |
||
2380 | 2380 | // If there is no result, we can obviously just return 0 here. Next, we will check |
2381 | 2381 | // if the result is an integer or float. If it is already one of these two data |
2382 | 2382 | // types we can just return the result as-is, otherwise we will convert this. |
2383 | - if (! $result) { |
|
2383 | + if (!$result) { |
|
2384 | 2384 | return 0; |
2385 | 2385 | } |
2386 | 2386 | |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | return true; |
2455 | 2455 | } |
2456 | 2456 | |
2457 | - if (! is_array(reset($values))) { |
|
2457 | + if (!is_array(reset($values))) { |
|
2458 | 2458 | $values = [$values]; |
2459 | 2459 | } |
2460 | 2460 | |
@@ -2518,7 +2518,7 @@ discard block |
||
2518 | 2518 | */ |
2519 | 2519 | public function updateOrInsert(array $attributes, array $values = []) |
2520 | 2520 | { |
2521 | - if (! $this->where($attributes)->exists()) { |
|
2521 | + if (!$this->where($attributes)->exists()) { |
|
2522 | 2522 | return $this->insert(array_merge($attributes, $values)); |
2523 | 2523 | } |
2524 | 2524 | |
@@ -2535,7 +2535,7 @@ discard block |
||
2535 | 2535 | */ |
2536 | 2536 | public function increment($column, $amount = 1, array $extra = []) |
2537 | 2537 | { |
2538 | - if (! is_numeric($amount)) { |
|
2538 | + if (!is_numeric($amount)) { |
|
2539 | 2539 | throw new InvalidArgumentException('Non-numeric value passed to increment method.'); |
2540 | 2540 | } |
2541 | 2541 | |
@@ -2556,7 +2556,7 @@ discard block |
||
2556 | 2556 | */ |
2557 | 2557 | public function decrement($column, $amount = 1, array $extra = []) |
2558 | 2558 | { |
2559 | - if (! is_numeric($amount)) { |
|
2559 | + if (!is_numeric($amount)) { |
|
2560 | 2560 | throw new InvalidArgumentException('Non-numeric value passed to decrement method.'); |
2561 | 2561 | } |
2562 | 2562 | |
@@ -2578,7 +2578,7 @@ discard block |
||
2578 | 2578 | // If an ID is passed to the method, we will set the where clause to check the |
2579 | 2579 | // ID to let developers to simply and quickly remove a single row from this |
2580 | 2580 | // database without manually specifying the "where" clauses on the query. |
2581 | - if (! is_null($id)) { |
|
2581 | + if (!is_null($id)) { |
|
2582 | 2582 | $this->where($this->from.'.id', '=', $id); |
2583 | 2583 | } |
2584 | 2584 | |
@@ -2663,7 +2663,7 @@ discard block |
||
2663 | 2663 | */ |
2664 | 2664 | public function setBindings(array $bindings, $type = 'where') |
2665 | 2665 | { |
2666 | - if (! array_key_exists($type, $this->bindings)) { |
|
2666 | + if (!array_key_exists($type, $this->bindings)) { |
|
2667 | 2667 | throw new InvalidArgumentException("Invalid binding type: {$type}."); |
2668 | 2668 | } |
2669 | 2669 | |
@@ -2683,7 +2683,7 @@ discard block |
||
2683 | 2683 | */ |
2684 | 2684 | public function addBinding($value, $type = 'where') |
2685 | 2685 | { |
2686 | - if (! array_key_exists($type, $this->bindings)) { |
|
2686 | + if (!array_key_exists($type, $this->bindings)) { |
|
2687 | 2687 | throw new InvalidArgumentException("Invalid binding type: {$type}."); |
2688 | 2688 | } |
2689 | 2689 | |
@@ -2717,8 +2717,8 @@ discard block |
||
2717 | 2717 | */ |
2718 | 2718 | protected function cleanBindings(array $bindings) |
2719 | 2719 | { |
2720 | - return array_values(array_filter($bindings, function ($binding) { |
|
2721 | - return ! $binding instanceof Expression; |
|
2720 | + return array_values(array_filter($bindings, function($binding){ |
|
2721 | + return !$binding instanceof Expression; |
|
2722 | 2722 | })); |
2723 | 2723 | } |
2724 | 2724 | |
@@ -2772,7 +2772,7 @@ discard block |
||
2772 | 2772 | */ |
2773 | 2773 | public function cloneWithout(array $properties) |
2774 | 2774 | { |
2775 | - return tap(clone $this, function ($clone) use ($properties) { |
|
2775 | + return tap(clone $this, function($clone) use ($properties) { |
|
2776 | 2776 | foreach ($properties as $property) { |
2777 | 2777 | $clone->{$property} = null; |
2778 | 2778 | } |
@@ -2787,7 +2787,7 @@ discard block |
||
2787 | 2787 | */ |
2788 | 2788 | public function cloneWithoutBindings(array $except) |
2789 | 2789 | { |
2790 | - return tap(clone $this, function ($clone) use ($except) { |
|
2790 | + return tap(clone $this, function($clone) use ($except) { |
|
2791 | 2791 | foreach ($except as $type) { |
2792 | 2792 | $clone->bindings[$type] = []; |
2793 | 2793 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | */ |
657 | 657 | protected function addArrayOfWheres($column, $boolean, $method = 'where') |
658 | 658 | { |
659 | - return $this->whereNested(function ($query) use ($column, $method, $boolean) { |
|
659 | + return $this->whereNested(function ($query) use ($column, $method, $boolean){ |
|
660 | 660 | foreach ($column as $key => $value) { |
661 | 661 | if (is_numeric($key) && is_array($value)) { |
662 | 662 | $query->{$method}(...array_values($value)); |
@@ -1830,7 +1830,7 @@ discard block |
||
1830 | 1830 | protected function removeExistingOrdersFor($column) |
1831 | 1831 | { |
1832 | 1832 | return Collection::make($this->orders) |
1833 | - ->reject(function ($order) use ($column) { |
|
1833 | + ->reject(function ($order) use ($column){ |
|
1834 | 1834 | return isset($order['column']) |
1835 | 1835 | ? $order['column'] === $column : false; |
1836 | 1836 | })->values()->all(); |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | */ |
1948 | 1948 | public function get($columns = ['*']) |
1949 | 1949 | { |
1950 | - return collect($this->onceWithColumns($columns, function () { |
|
1950 | + return collect($this->onceWithColumns($columns, function (){ |
|
1951 | 1951 | return $this->processor->processSelect($this, $this->runSelect()); |
1952 | 1952 | })); |
1953 | 1953 | } |
@@ -2056,7 +2056,7 @@ discard block |
||
2056 | 2056 | */ |
2057 | 2057 | protected function withoutSelectAliases(array $columns) |
2058 | 2058 | { |
2059 | - return array_map(function ($column) { |
|
2059 | + return array_map(function ($column){ |
|
2060 | 2060 | return is_string($column) && ($aliasPosition = stripos($column, ' as ')) !== false |
2061 | 2061 | ? substr($column, 0, $aliasPosition) : $column; |
2062 | 2062 | }, $columns); |
@@ -2150,7 +2150,7 @@ discard block |
||
2150 | 2150 | // the results and get the exact data that was requested for the query. |
2151 | 2151 | $queryResult = $this->onceWithColumns( |
2152 | 2152 | is_null($key) ? [$column] : [$column, $key], |
2153 | - function () { |
|
2153 | + function (){ |
|
2154 | 2154 | return $this->processor->processSelect( |
2155 | 2155 | $this, $this->runSelect() |
2156 | 2156 | ); |
@@ -2717,7 +2717,7 @@ discard block |
||
2717 | 2717 | */ |
2718 | 2718 | protected function cleanBindings(array $bindings) |
2719 | 2719 | { |
2720 | - return array_values(array_filter($bindings, function ($binding) { |
|
2720 | + return array_values(array_filter($bindings, function ($binding){ |
|
2721 | 2721 | return ! $binding instanceof Expression; |
2722 | 2722 | })); |
2723 | 2723 | } |
@@ -2772,7 +2772,7 @@ discard block |
||
2772 | 2772 | */ |
2773 | 2773 | public function cloneWithout(array $properties) |
2774 | 2774 | { |
2775 | - return tap(clone $this, function ($clone) use ($properties) { |
|
2775 | + return tap(clone $this, function ($clone) use ($properties){ |
|
2776 | 2776 | foreach ($properties as $property) { |
2777 | 2777 | $clone->{$property} = null; |
2778 | 2778 | } |
@@ -2787,7 +2787,7 @@ discard block |
||
2787 | 2787 | */ |
2788 | 2788 | public function cloneWithoutBindings(array $except) |
2789 | 2789 | { |
2790 | - return tap(clone $this, function ($clone) use ($except) { |
|
2790 | + return tap(clone $this, function ($clone) use ($except){ |
|
2791 | 2791 | foreach ($except as $type) { |
2792 | 2792 | $clone->bindings[$type] = []; |
2793 | 2793 | } |
@@ -2,12 +2,12 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Query\Grammars; |
4 | 4 | |
5 | -use RuntimeException; |
|
6 | -use Illuminate\Support\Arr; |
|
7 | -use Illuminate\Support\Str; |
|
5 | +use Illuminate\Database\Grammar as BaseGrammar; |
|
8 | 6 | use Illuminate\Database\Query\Builder; |
9 | 7 | use Illuminate\Database\Query\JoinClause; |
10 | -use Illuminate\Database\Grammar as BaseGrammar; |
|
8 | +use Illuminate\Support\Arr; |
|
9 | +use Illuminate\Support\Str; |
|
10 | +use RuntimeException; |
|
11 | 11 | |
12 | 12 | class Grammar extends BaseGrammar |
13 | 13 | { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | // To compile the query, we'll spin through each component of the query and |
82 | 82 | // see if that component exists. If it does we'll just call the compiler |
83 | 83 | // function for the component which is responsible for making the SQL. |
84 | - if (! is_null($query->$component)) { |
|
84 | + if (!is_null($query->$component)) { |
|
85 | 85 | $method = 'compile'.ucfirst($component); |
86 | 86 | |
87 | 87 | $sql[$component] = $this->$method($query, $query->$component); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | // If the query is actually performing an aggregating select, we will let that |
125 | 125 | // compiler handle the building of the select clauses, as it will need some |
126 | 126 | // more syntax that is best handled by that function to keep things neat. |
127 | - if (! is_null($query->aggregate)) { |
|
127 | + if (!is_null($query->aggregate)) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function compileJoins(Builder $query, $joins) |
156 | 156 | { |
157 | - return collect($joins)->map(function ($join) use ($query) { |
|
157 | + return collect($joins)->map(function($join) use ($query) { |
|
158 | 158 | $table = $this->wrapTable($join->table); |
159 | 159 | |
160 | 160 | $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function compileWheresToArray($query) |
198 | 198 | { |
199 | - return collect($query->wheres)->map(function ($where) use ($query) { |
|
199 | + return collect($query->wheres)->map(function($where) use ($query) { |
|
200 | 200 | return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); |
201 | 201 | })->all(); |
202 | 202 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | */ |
251 | 251 | protected function whereIn(Builder $query, $where) |
252 | 252 | { |
253 | - if (! empty($where['values'])) { |
|
253 | + if (!empty($where['values'])) { |
|
254 | 254 | return $this->wrap($where['column']).' in ('.$this->parameterize($where['values']).')'; |
255 | 255 | } |
256 | 256 | |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | protected function whereNotIn(Builder $query, $where) |
268 | 268 | { |
269 | - if (! empty($where['values'])) { |
|
269 | + if (!empty($where['values'])) { |
|
270 | 270 | return $this->wrap($where['column']).' not in ('.$this->parameterize($where['values']).')'; |
271 | 271 | } |
272 | 272 | |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | protected function compileOrders(Builder $query, $orders) |
607 | 607 | { |
608 | - if (! empty($orders)) { |
|
608 | + if (!empty($orders)) { |
|
609 | 609 | return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders)); |
610 | 610 | } |
611 | 611 | |
@@ -621,8 +621,8 @@ discard block |
||
621 | 621 | */ |
622 | 622 | protected function compileOrdersToArray(Builder $query, $orders) |
623 | 623 | { |
624 | - return array_map(function ($order) { |
|
625 | - return ! isset($order['sql']) |
|
624 | + return array_map(function($order){ |
|
625 | + return !isset($order['sql']) |
|
626 | 626 | ? $this->wrap($order['column']).' '.$order['direction'] |
627 | 627 | : $order['sql']; |
628 | 628 | }, $orders); |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | $sql .= $this->compileUnion($union); |
678 | 678 | } |
679 | 679 | |
680 | - if (! empty($query->unionOrders)) { |
|
680 | + if (!empty($query->unionOrders)) { |
|
681 | 681 | $sql .= ' '.$this->compileOrders($query, $query->unionOrders); |
682 | 682 | } |
683 | 683 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | // basic routine regardless of an amount of records given to us to insert. |
733 | 733 | $table = $this->wrapTable($query->from); |
734 | 734 | |
735 | - if (! is_array(reset($values))) { |
|
735 | + if (!is_array(reset($values))) { |
|
736 | 736 | $values = [$values]; |
737 | 737 | } |
738 | 738 | |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | // We need to build a list of parameter place-holders of values that are bound |
742 | 742 | // to the query. Each insert should have the exact same amount of parameter |
743 | 743 | // bindings so we will loop through the record and parameterize them all. |
744 | - $parameters = collect($values)->map(function ($record) { |
|
744 | + $parameters = collect($values)->map(function($record){ |
|
745 | 745 | return '('.$this->parameterize($record).')'; |
746 | 746 | })->implode(', '); |
747 | 747 | |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | // Each one of the columns in the update statements needs to be wrapped in the |
776 | 776 | // keyword identifiers, also a place-holder needs to be created for each of |
777 | 777 | // the values in the list of bindings so we can make the sets statements. |
778 | - $columns = collect($values)->map(function ($value, $key) { |
|
778 | + $columns = collect($values)->map(function($value, $key){ |
|
779 | 779 | return $this->wrap($key).' = '.$this->parameter($value); |
780 | 780 | })->implode(', '); |
781 | 781 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | protected function concatenate($segments) |
964 | 964 | { |
965 | - return implode(' ', array_filter($segments, function ($value) { |
|
965 | + return implode(' ', array_filter($segments, function($value){ |
|
966 | 966 | return (string) $value !== ''; |
967 | 967 | })); |
968 | 968 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | protected function compileJoins(Builder $query, $joins) |
156 | 156 | { |
157 | - return collect($joins)->map(function ($join) use ($query) { |
|
157 | + return collect($joins)->map(function ($join) use ($query){ |
|
158 | 158 | $table = $this->wrapTable($join->table); |
159 | 159 | |
160 | 160 | $nestedJoins = is_null($join->joins) ? '' : ' '.$this->compileJoins($query, $join->joins); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | protected function compileWheresToArray($query) |
198 | 198 | { |
199 | - return collect($query->wheres)->map(function ($where) use ($query) { |
|
199 | + return collect($query->wheres)->map(function ($where) use ($query){ |
|
200 | 200 | return $where['boolean'].' '.$this->{"where{$where['type']}"}($query, $where); |
201 | 201 | })->all(); |
202 | 202 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | protected function compileOrdersToArray(Builder $query, $orders) |
623 | 623 | { |
624 | - return array_map(function ($order) { |
|
624 | + return array_map(function ($order){ |
|
625 | 625 | return ! isset($order['sql']) |
626 | 626 | ? $this->wrap($order['column']).' '.$order['direction'] |
627 | 627 | : $order['sql']; |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | // We need to build a list of parameter place-holders of values that are bound |
742 | 742 | // to the query. Each insert should have the exact same amount of parameter |
743 | 743 | // bindings so we will loop through the record and parameterize them all. |
744 | - $parameters = collect($values)->map(function ($record) { |
|
744 | + $parameters = collect($values)->map(function ($record){ |
|
745 | 745 | return '('.$this->parameterize($record).')'; |
746 | 746 | })->implode(', '); |
747 | 747 | |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | // Each one of the columns in the update statements needs to be wrapped in the |
776 | 776 | // keyword identifiers, also a place-holder needs to be created for each of |
777 | 777 | // the values in the list of bindings so we can make the sets statements. |
778 | - $columns = collect($values)->map(function ($value, $key) { |
|
778 | + $columns = collect($values)->map(function ($value, $key){ |
|
779 | 779 | return $this->wrap($key).' = '.$this->parameter($value); |
780 | 780 | })->implode(', '); |
781 | 781 | |
@@ -962,7 +962,7 @@ discard block |
||
962 | 962 | */ |
963 | 963 | protected function concatenate($segments) |
964 | 964 | { |
965 | - return implode(' ', array_filter($segments, function ($value) { |
|
965 | + return implode(' ', array_filter($segments, function ($value){ |
|
966 | 966 | return (string) $value !== ''; |
967 | 967 | })); |
968 | 968 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * |
244 | 244 | * @param \Illuminate\Database\Query\Builder $query |
245 | 245 | * @param string $table |
246 | - * @param array $where |
|
246 | + * @param string $where |
|
247 | 247 | * @return string |
248 | 248 | */ |
249 | 249 | protected function compileDeleteWithoutJoins($query, $table, $where) |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @param \Illuminate\Database\Query\Builder $query |
271 | 271 | * @param string $table |
272 | - * @param array $where |
|
272 | + * @param string $where |
|
273 | 273 | * @return string |
274 | 274 | */ |
275 | 275 | protected function compileDeleteWithJoins($query, $table, $where) |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Query\Grammars; |
4 | 4 | |
5 | -use Illuminate\Support\Arr; |
|
6 | 5 | use Illuminate\Database\Query\Builder; |
7 | 6 | use Illuminate\Database\Query\JsonExpression; |
7 | +use Illuminate\Support\Arr; |
|
8 | 8 | |
9 | 9 | class MySqlGrammar extends Grammar |
10 | 10 | { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function compileLock(Builder $query, $value) |
98 | 98 | { |
99 | - if (! is_string($value)) { |
|
99 | + if (!is_string($value)) { |
|
100 | 100 | return $value ? 'for update' : 'lock in share mode'; |
101 | 101 | } |
102 | 102 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | // If the query has an order by clause we will compile it since MySQL supports |
139 | 139 | // order bys on update statements. We'll compile them using the typical way |
140 | 140 | // of compiling order bys. Then they will be appended to the SQL queries. |
141 | - if (! empty($query->orders)) { |
|
141 | + if (!empty($query->orders)) { |
|
142 | 142 | $sql .= ' '.$this->compileOrders($query, $query->orders); |
143 | 143 | } |
144 | 144 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected function compileUpdateColumns($values) |
162 | 162 | { |
163 | - return collect($values)->map(function ($value, $key) { |
|
163 | + return collect($values)->map(function($value, $key){ |
|
164 | 164 | if ($this->isJsonSelector($key)) { |
165 | 165 | return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); |
166 | 166 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function prepareBindingsForUpdate(array $bindings, array $values) |
200 | 200 | { |
201 | - $values = collect($values)->reject(function ($value, $column) { |
|
201 | + $values = collect($values)->reject(function($value, $column){ |
|
202 | 202 | return $this->isJsonSelector($column) && |
203 | 203 | in_array(gettype($value), ['boolean', 'integer', 'double']); |
204 | 204 | })->all(); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // When using MySQL, delete statements may contain order by statements and limits |
254 | 254 | // so we will compile both of those here. Once we have finished compiling this |
255 | 255 | // we will return the completed SQL statement so it will be executed for us. |
256 | - if (! empty($query->orders)) { |
|
256 | + if (!empty($query->orders)) { |
|
257 | 257 | $sql .= ' '.$this->compileOrders($query, $query->orders); |
258 | 258 | } |
259 | 259 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | $field = $this->wrapSegments(explode('.', array_shift($path))); |
311 | 311 | |
312 | - return sprintf('%s'.$delimiter.'\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
312 | + return sprintf('%s'.$delimiter.'\'$.%s\'', $field, collect($path)->map(function($part){ |
|
313 | 313 | return '"'.$part.'"'; |
314 | 314 | })->implode('.')); |
315 | 315 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | */ |
161 | 161 | protected function compileUpdateColumns($values) |
162 | 162 | { |
163 | - return collect($values)->map(function ($value, $key) { |
|
163 | + return collect($values)->map(function ($value, $key){ |
|
164 | 164 | if ($this->isJsonSelector($key)) { |
165 | 165 | return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); |
166 | 166 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function prepareBindingsForUpdate(array $bindings, array $values) |
200 | 200 | { |
201 | - $values = collect($values)->reject(function ($value, $column) { |
|
201 | + $values = collect($values)->reject(function ($value, $column){ |
|
202 | 202 | return $this->isJsonSelector($column) && |
203 | 203 | in_array(gettype($value), ['boolean', 'integer', 'double']); |
204 | 204 | })->all(); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | |
310 | 310 | $field = $this->wrapSegments(explode('.', array_shift($path))); |
311 | 311 | |
312 | - return sprintf('%s'.$delimiter.'\'$.%s\'', $field, collect($path)->map(function ($part) { |
|
312 | + return sprintf('%s'.$delimiter.'\'$.%s\'', $field, collect($path)->map(function ($part){ |
|
313 | 313 | return '"'.$part.'"'; |
314 | 314 | })->implode('.')); |
315 | 315 | } |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Query\Grammars; |
4 | 4 | |
5 | -use Illuminate\Support\Arr; |
|
6 | 5 | use Illuminate\Database\Query\Builder; |
6 | +use Illuminate\Support\Arr; |
|
7 | 7 | |
8 | 8 | class PostgresGrammar extends Grammar |
9 | 9 | { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | protected function compileLock(Builder $query, $value) |
88 | 88 | { |
89 | - if (! is_string($value)) { |
|
89 | + if (!is_string($value)) { |
|
90 | 90 | return $value ? 'for update' : 'for share'; |
91 | 91 | } |
92 | 92 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // When gathering the columns for an update statement, we'll wrap each of the |
157 | 157 | // columns and convert it to a parameter value. Then we will concatenate a |
158 | 158 | // list of the columns that can be added into this update query clauses. |
159 | - return collect($values)->map(function ($value, $key) { |
|
159 | + return collect($values)->map(function($value, $key){ |
|
160 | 160 | return $this->wrap($key).' = '.$this->parameter($value); |
161 | 161 | })->implode(', '); |
162 | 162 | } |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | */ |
170 | 170 | protected function compileUpdateFrom(Builder $query) |
171 | 171 | { |
172 | - if (! isset($query->joins)) { |
|
172 | + if (!isset($query->joins)) { |
|
173 | 173 | return ''; |
174 | 174 | } |
175 | 175 | |
176 | 176 | // When using Postgres, updates with joins list the joined tables in the from |
177 | 177 | // clause, which is different than other systems like MySQL. Here, we will |
178 | 178 | // compile out the tables that are joined and add them to a from clause. |
179 | - $froms = collect($query->joins)->map(function ($join) { |
|
179 | + $froms = collect($query->joins)->map(function($join){ |
|
180 | 180 | return $this->wrapTable($join->table); |
181 | 181 | })->all(); |
182 | 182 | |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | { |
196 | 196 | $baseWheres = $this->compileWheres($query); |
197 | 197 | |
198 | - if (! isset($query->joins)) { |
|
198 | + if (!isset($query->joins)) { |
|
199 | 199 | return $baseWheres; |
200 | 200 | } |
201 | 201 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | protected function compileDeleteWithJoins($query, $table) |
280 | 280 | { |
281 | - $using = ' USING '.collect($query->joins)->map(function ($join) { |
|
281 | + $using = ' USING '.collect($query->joins)->map(function($join){ |
|
282 | 282 | return $this->wrapTable($join->table); |
283 | 283 | })->implode(', '); |
284 | 284 | |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | $attribute = array_pop($wrappedPath); |
316 | 316 | |
317 | - if (! empty($wrappedPath)) { |
|
317 | + if (!empty($wrappedPath)) { |
|
318 | 318 | return $field.'->'.implode('->', $wrappedPath).'->>'.$attribute; |
319 | 319 | } |
320 | 320 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | protected function wrapJsonPathAttributes($path) |
331 | 331 | { |
332 | - return array_map(function ($attribute) { |
|
332 | + return array_map(function($attribute){ |
|
333 | 333 | return "'$attribute'"; |
334 | 334 | }, $path); |
335 | 335 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // When gathering the columns for an update statement, we'll wrap each of the |
157 | 157 | // columns and convert it to a parameter value. Then we will concatenate a |
158 | 158 | // list of the columns that can be added into this update query clauses. |
159 | - return collect($values)->map(function ($value, $key) { |
|
159 | + return collect($values)->map(function ($value, $key){ |
|
160 | 160 | return $this->wrap($key).' = '.$this->parameter($value); |
161 | 161 | })->implode(', '); |
162 | 162 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | // When using Postgres, updates with joins list the joined tables in the from |
177 | 177 | // clause, which is different than other systems like MySQL. Here, we will |
178 | 178 | // compile out the tables that are joined and add them to a from clause. |
179 | - $froms = collect($query->joins)->map(function ($join) { |
|
179 | + $froms = collect($query->joins)->map(function ($join){ |
|
180 | 180 | return $this->wrapTable($join->table); |
181 | 181 | })->all(); |
182 | 182 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | */ |
279 | 279 | protected function compileDeleteWithJoins($query, $table) |
280 | 280 | { |
281 | - $using = ' USING '.collect($query->joins)->map(function ($join) { |
|
281 | + $using = ' USING '.collect($query->joins)->map(function ($join){ |
|
282 | 282 | return $this->wrapTable($join->table); |
283 | 283 | })->implode(', '); |
284 | 284 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | */ |
330 | 330 | protected function wrapJsonPathAttributes($path) |
331 | 331 | { |
332 | - return array_map(function ($attribute) { |
|
332 | + return array_map(function ($attribute){ |
|
333 | 333 | return "'$attribute'"; |
334 | 334 | }, $path); |
335 | 335 | } |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Illuminate\Database\Query\Grammars; |
4 | 4 | |
5 | +use Illuminate\Database\Query\Builder; |
|
5 | 6 | use Illuminate\Support\Arr; |
6 | 7 | use Illuminate\Support\Str; |
7 | -use Illuminate\Database\Query\Builder; |
|
8 | 8 | |
9 | 9 | class SQLiteGrammar extends Grammar |
10 | 10 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | // basic routine regardless of an amount of records given to us to insert. |
158 | 158 | $table = $this->wrapTable($query->from); |
159 | 159 | |
160 | - if (! is_array(reset($values))) { |
|
160 | + if (!is_array(reset($values))) { |
|
161 | 161 | $values = [$values]; |
162 | 162 | } |
163 | 163 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | $table = $this->wrapTable($query->from); |
199 | 199 | |
200 | - $columns = collect($values)->map(function ($value, $key) use ($query) { |
|
200 | + $columns = collect($values)->map(function($value, $key) use ($query) { |
|
201 | 201 | return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value); |
202 | 202 | })->implode(', '); |
203 | 203 |
@@ -197,7 +197,7 @@ |
||
197 | 197 | { |
198 | 198 | $table = $this->wrapTable($query->from); |
199 | 199 | |
200 | - $columns = collect($values)->map(function ($value, $key) use ($query) { |
|
200 | + $columns = collect($values)->map(function ($value, $key) use ($query){ |
|
201 | 201 | return $this->wrap(Str::after($key, $query->from.'.')).' = '.$this->parameter($value); |
202 | 202 | })->implode(', '); |
203 | 203 |