Skip to content

Commit 1ec905f

Browse files
committed
formatting
2 parents f6640f8 + 3ab9f7a commit 1ec905f

27 files changed

+182
-60
lines changed

src/Illuminate/Cache/Lock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ protected function isOwnedByCurrentProcess()
153153
}
154154

155155
/**
156-
* Specify the number of milliseconds to sleep in between blocked lock aquisition attempts.
156+
* Specify the number of milliseconds to sleep in between blocked lock acquisition attempts.
157157
*
158158
* @param int $milliseconds
159159
* @return $this

src/Illuminate/Database/DatabaseTransactionRecord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DatabaseTransactionRecord
3030
*
3131
* @param string $connection
3232
* @param int $level
33-
* @retunr void
33+
* @return void
3434
*/
3535
public function __construct($connection, $level)
3636
{

src/Illuminate/Database/Eloquent/Builder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ public function sole($columns = ['*'])
544544
try {
545545
return $this->baseSole($columns);
546546
} catch (RecordsNotFoundException $exception) {
547-
throw new ModelNotFoundException($this->model);
547+
throw (new ModelNotFoundException)->setModel(get_class($this->model));
548548
}
549549
}
550550

src/Illuminate/Database/PostgresConnection.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Database\Schema\Grammars\PostgresGrammar as SchemaGrammar;
99
use Illuminate\Database\Schema\PostgresBuilder;
1010
use Illuminate\Database\Schema\PostgresSchemaState;
11+
use Illuminate\Filesystem\Filesystem;
1112
use PDO;
1213

1314
class PostgresConnection extends Connection
@@ -75,7 +76,7 @@ protected function getDefaultSchemaGrammar()
7576
/**
7677
* Get the schema state for the connection.
7778
*
78-
* @param \Illuminate\Database\Filesystem|null $files
79+
* @param \Illuminate\Filesystem\Filesystem|null $files
7980
* @param callable|null $processFactory
8081
* @return \Illuminate\Database\Schema\PostgresSchemaState
8182
*/

src/Illuminate/Database/Query/Builder.php

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ public function joinWhere($table, $first, $operator, $second, $type = 'inner')
491491
/**
492492
* Add a subquery join clause to the query.
493493
*
494-
* @param \Closure|\Illuminate\Database\Query\Builder|string $query
494+
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
495495
* @param string $as
496496
* @param \Closure|string $first
497497
* @param string|null $operator
@@ -544,7 +544,7 @@ public function leftJoinWhere($table, $first, $operator, $second)
544544
/**
545545
* Add a subquery left join to the query.
546546
*
547-
* @param \Closure|\Illuminate\Database\Query\Builder|string $query
547+
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
548548
* @param string $as
549549
* @param \Closure|string $first
550550
* @param string|null $operator
@@ -587,7 +587,7 @@ public function rightJoinWhere($table, $first, $operator, $second)
587587
/**
588588
* Add a subquery right join to the query.
589589
*
590-
* @param \Closure|\Illuminate\Database\Query\Builder|string $query
590+
* @param \Closure|\Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder|string $query
591591
* @param string $as
592592
* @param \Closure|string $first
593593
* @param string|null $operator
@@ -752,7 +752,7 @@ public function where($column, $operator = null, $value = null, $boolean = 'and'
752752
);
753753

754754
if (! $value instanceof Expression) {
755-
$this->addBinding(is_array($value) ? head($value) : $value, 'where');
755+
$this->addBinding($this->flattenValue($value), 'where');
756756
}
757757

758758
return $this;
@@ -1121,7 +1121,7 @@ public function whereBetween($column, array $values, $boolean = 'and', $not = fa
11211121

11221122
$this->wheres[] = compact('type', 'column', 'values', 'boolean', 'not');
11231123

1124-
$this->addBinding(array_slice($this->cleanBindings($values), 0, 2), 'where');
1124+
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'where');
11251125

11261126
return $this;
11271127
}
@@ -1244,7 +1244,7 @@ public function whereDate($column, $operator, $value = null, $boolean = 'and')
12441244
$value, $operator, func_num_args() === 2
12451245
);
12461246

1247-
$value = is_array($value) ? head($value) : $value;
1247+
$value = $this->flattenValue($value);
12481248

12491249
if ($value instanceof DateTimeInterface) {
12501250
$value = $value->format('Y-m-d');
@@ -1285,7 +1285,7 @@ public function whereTime($column, $operator, $value = null, $boolean = 'and')
12851285
$value, $operator, func_num_args() === 2
12861286
);
12871287

1288-
$value = is_array($value) ? head($value) : $value;
1288+
$value = $this->flattenValue($value);
12891289

12901290
if ($value instanceof DateTimeInterface) {
12911291
$value = $value->format('H:i:s');
@@ -1326,7 +1326,7 @@ public function whereDay($column, $operator, $value = null, $boolean = 'and')
13261326
$value, $operator, func_num_args() === 2
13271327
);
13281328

1329-
$value = is_array($value) ? head($value) : $value;
1329+
$value = $this->flattenValue($value);
13301330

13311331
if ($value instanceof DateTimeInterface) {
13321332
$value = $value->format('d');
@@ -1371,7 +1371,7 @@ public function whereMonth($column, $operator, $value = null, $boolean = 'and')
13711371
$value, $operator, func_num_args() === 2
13721372
);
13731373

1374-
$value = is_array($value) ? head($value) : $value;
1374+
$value = $this->flattenValue($value);
13751375

13761376
if ($value instanceof DateTimeInterface) {
13771377
$value = $value->format('m');
@@ -1416,7 +1416,7 @@ public function whereYear($column, $operator, $value = null, $boolean = 'and')
14161416
$value, $operator, func_num_args() === 2
14171417
);
14181418

1419-
$value = is_array($value) ? head($value) : $value;
1419+
$value = $this->flattenValue($value);
14201420

14211421
if ($value instanceof DateTimeInterface) {
14221422
$value = $value->format('Y');
@@ -1726,7 +1726,7 @@ public function whereJsonLength($column, $operator, $value = null, $boolean = 'a
17261726
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
17271727

17281728
if (! $value instanceof Expression) {
1729-
$this->addBinding((int) $value);
1729+
$this->addBinding((int) $this->flattenValue($value));
17301730
}
17311731

17321732
return $this;
@@ -1875,7 +1875,7 @@ public function having($column, $operator = null, $value = null, $boolean = 'and
18751875
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
18761876

18771877
if (! $value instanceof Expression) {
1878-
$this->addBinding(is_array($value) ? head($value) : $value, 'having');
1878+
$this->addBinding($this->flattenValue($value), 'having');
18791879
}
18801880

18811881
return $this;
@@ -1913,7 +1913,7 @@ public function havingBetween($column, array $values, $boolean = 'and', $not = f
19131913

19141914
$this->havings[] = compact('type', 'column', 'values', 'boolean', 'not');
19151915

1916-
$this->addBinding($this->cleanBindings($values), 'having');
1916+
$this->addBinding(array_slice($this->cleanBindings(Arr::flatten($values)), 0, 2), 'having');
19171917

19181918
return $this;
19191919
}
@@ -3178,6 +3178,17 @@ public function cleanBindings(array $bindings)
31783178
}));
31793179
}
31803180

3181+
/**
3182+
* Get a scalar type value from an unknown type of input.
3183+
*
3184+
* @param mixed $value
3185+
* @return mixed
3186+
*/
3187+
protected function flattenValue($value)
3188+
{
3189+
return is_array($value) ? head(Arr::flatten($value)) : $value;
3190+
}
3191+
31813192
/**
31823193
* Get the default key name of the table.
31833194
*

src/Illuminate/Database/Schema/PostgresSchemaState.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ class PostgresSchemaState extends SchemaState
1616
*/
1717
public function dump(Connection $connection, $path)
1818
{
19+
$searchPath = $connection->getConfig('search_path') ?: 'public';
20+
21+
$searchPath = $searchPath === 'public' ? '' : $searchPath.'.';
22+
1923
$excludedTables = collect($connection->getSchemaBuilder()->getAllTables())
2024
->map->tablename
2125
->reject(function ($table) {
2226
return $table === $this->migrationTable;
23-
})->map(function ($table) {
24-
return '--exclude-table-data='.$table;
27+
})->map(function ($table) use ($searchPath) {
28+
return '--exclude-table-data='.$searchPath.$table;
2529
})->implode(' ');
2630

2731
$this->makeProcess(

src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ protected function cleanParameterBag(ParameterBag $bag)
5858
*/
5959
protected function cleanArray(array $data, $keyPrefix = '')
6060
{
61-
return collect($data)->map(function ($value, $key) use ($keyPrefix) {
62-
return $this->cleanValue($keyPrefix.$key, $value);
63-
})->all();
61+
foreach ($data as $key => $value) {
62+
$data[$key] = $this->cleanValue($keyPrefix.$key, $value);
63+
}
64+
65+
return collect($data)->all();
6466
}
6567

6668
/**

src/Illuminate/Foundation/Testing/Concerns/InteractsWithConsole.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ trait InteractsWithConsole
3030
public $unexpectedOutput = [];
3131

3232
/**
33-
* All of the expected ouput tables.
33+
* All of the expected output tables.
3434
*
3535
* @var array
3636
*/

src/Illuminate/Queue/Console/WorkCommand.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,9 @@ protected function runWorker($connection, $queue)
133133
*/
134134
protected function gatherWorkerOptions()
135135
{
136-
$backoff = $this->hasOption('backoff')
137-
? $this->option('backoff')
138-
: $this->option('delay');
139-
140136
return new WorkerOptions(
141137
$this->option('name'),
142-
$backoff,
138+
max($this->option('backoff'), $this->option('delay')),
143139
$this->option('memory'),
144140
$this->option('timeout'),
145141
$this->option('sleep'),

src/Illuminate/Queue/Middleware/RateLimited.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,21 @@ protected function getTimeUntilNextRetry($key)
126126
*
127127
* @return array
128128
*/
129-
public function __serialize()
129+
public function __sleep()
130130
{
131131
return [
132-
'limiterName' => $this->limiterName,
133-
'shouldRelease' => $this->shouldRelease,
132+
'limiterName',
133+
'shouldRelease',
134134
];
135135
}
136136

137137
/**
138138
* Prepare the object after unserialization.
139139
*
140-
* @param array $data
141140
* @return void
142141
*/
143-
public function __unserialize(array $data)
142+
public function __wakeup()
144143
{
145144
$this->limiter = Container::getInstance()->make(RateLimiter::class);
146-
147-
$this->limiterName = $data['limiterName'];
148-
$this->shouldRelease = $data['shouldRelease'];
149145
}
150146
}

0 commit comments

Comments
 (0)