Skip to content

Commit 82ffe3c

Browse files
GrahamCampbelldriesvintstaylorotwell
authoredOct 19, 2020
Provisional support for PHP 8.0 (#34884)
Co-Authored-By: Dries Vints <594614+driesvints@users.noreply.github.com> Co-Authored-By: Taylor Otwell <taylor@laravel.com> Co-authored-by: Dries Vints <594614+driesvints@users.noreply.github.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
1 parent c937c9b commit 82ffe3c

40 files changed

+130
-71
lines changed
 

‎composer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
"ext-mbstring": "*",
2121
"ext-openssl": "*",
2222
"doctrine/inflector": "^1.4|^2.0",
23-
"dragonmantank/cron-expression": "^2.0",
23+
"dragonmantank/cron-expression": "^2.3.1",
2424
"egulias/email-validator": "^2.1.10",
2525
"league/commonmark": "^1.3",
26-
"league/flysystem": "^1.0.34",
26+
"league/flysystem": "^1.1",
2727
"monolog/monolog": "^1.12|^2.0",
28-
"nesbot/carbon": "^2.0",
29-
"opis/closure": "^3.1",
28+
"nesbot/carbon": "^2.31",
29+
"opis/closure": "^3.6",
3030
"psr/container": "^1.0",
3131
"psr/simple-cache": "^1.0",
3232
"ramsey/uuid": "^3.7",
@@ -79,14 +79,14 @@
7979
"require-dev": {
8080
"aws/aws-sdk-php": "^3.0",
8181
"doctrine/dbal": "^2.6",
82-
"filp/whoops": "^2.4",
82+
"filp/whoops": "^2.8",
8383
"guzzlehttp/guzzle": "^6.3|^7.0",
8484
"league/flysystem-cached-adapter": "^1.0",
85-
"mockery/mockery": "^1.3.1",
85+
"mockery/mockery": "~1.3.3|^1.4.2",
8686
"moontoast/math": "^1.1",
8787
"orchestra/testbench-core": "^4.0",
8888
"pda/pheanstalk": "^4.0",
89-
"phpunit/phpunit": "^7.5.15|^8.4|^9.0",
89+
"phpunit/phpunit": "^7.5.15|^8.4|^9.3.3",
9090
"predis/predis": "^1.1.1",
9191
"symfony/cache": "^4.3.4"
9292
},
@@ -121,7 +121,7 @@
121121
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
122122
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
123123
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).",
124-
"filp/whoops": "Required for friendly error pages in development (^2.4).",
124+
"filp/whoops": "Required for friendly error pages in development (^2.8).",
125125
"fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).",
126126
"guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0|^7.0).",
127127
"laravel/tinker": "Required to use the tinker console command (^2.0).",

‎src/Illuminate/Cache/RedisTaggedCache.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ protected function deleteValues($referenceKey)
179179

180180
if (count($values) > 0) {
181181
foreach (array_chunk($values, 1000) as $valuesChunk) {
182-
call_user_func_array([$this->store->connection(), 'del'], $valuesChunk);
182+
$this->store->connection()->del(...$valuesChunk);
183183
}
184184
}
185185
}

‎src/Illuminate/Console/Concerns/HasParameters.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ protected function specifyParameters()
2121
if ($arguments instanceof InputArgument) {
2222
$this->getDefinition()->addArgument($arguments);
2323
} else {
24-
call_user_func_array([$this, 'addArgument'], $arguments);
24+
$this->addArgument(...array_values($arguments));
2525
}
2626
}
2727

2828
foreach ($this->getOptions() as $options) {
2929
if ($options instanceof InputOption) {
3030
$this->getDefinition()->addOption($options);
3131
} else {
32-
call_user_func_array([$this, 'addOption'], $options);
32+
$this->addOption(...array_values($options));
3333
}
3434
}
3535
}

‎src/Illuminate/Console/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
},
3333
"suggest": {
34-
"dragonmantank/cron-expression": "Required to use scheduler (^2.0).",
34+
"dragonmantank/cron-expression": "Required to use scheduler (^2.3.1).",
3535
"guzzlehttp/guzzle": "Required to use the ping methods on schedules (^6.0|^7.0).",
3636
"illuminate/bus": "Required to use the scheduled job dispatcher (^6.0)",
3737
"illuminate/container": "Required to use the scheduler (^6.0)",

‎src/Illuminate/Container/BoundMethod.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public static function call($container, $callback, array $parameters = [], $defa
2828
}
2929

3030
return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
31-
return call_user_func_array(
32-
$callback, static::getMethodDependencies($container, $callback, $parameters)
33-
);
31+
return $callback(...static::getMethodDependencies($container, $callback, $parameters));
Has conversations. Original line has conversations.
3432
});
3533
}
3634

@@ -121,7 +119,7 @@ protected static function getMethodDependencies($container, $callback, array $pa
121119
static::addDependencyForCallParameter($container, $parameter, $parameters, $dependencies);
122120
}
123121

124-
return array_merge($dependencies, $parameters);
122+
return array_merge($dependencies, array_values($parameters));
125123
}
126124

127125
/**

‎src/Illuminate/Cookie/CookieJar.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function queue(...$parameters)
143143
if (head($parameters) instanceof Cookie) {
144144
$cookie = head($parameters);
145145
} else {
146-
$cookie = call_user_func_array([$this, 'make'], $parameters);
146+
$cookie = $this->make(...array_values($parameters));
147147
}
148148

149149
if (! isset($this->queued[$cookie->getName()])) {

‎src/Illuminate/Database/Eloquent/Builder.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -1359,14 +1359,16 @@ public function __call($method, $parameters)
13591359
}
13601360

13611361
if (static::hasGlobalMacro($method)) {
1362-
if (static::$macros[$method] instanceof Closure) {
1363-
return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters);
1362+
$callable = static::$macros[$method];
1363+
1364+
if ($callable instanceof Closure) {
1365+
$callable = $callable->bindTo($this, static::class);
13641366
}
13651367

1366-
return call_user_func_array(static::$macros[$method], $parameters);
1368+
return $callable(...$parameters);
13671369
}
13681370

1369-
if (method_exists($this->model, $scope = 'scope'.ucfirst($method))) {
1371+
if ($this->model !== null && method_exists($this->model, $scope = 'scope'.ucfirst($method))) {
13701372
return $this->callScope([$this->model, $scope], $parameters);
13711373
}
13721374

@@ -1404,11 +1406,13 @@ public static function __callStatic($method, $parameters)
14041406
static::throwBadMethodCallException($method);
14051407
}
14061408

1407-
if (static::$macros[$method] instanceof Closure) {
1408-
return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters);
1409+
$callable = static::$macros[$method];
1410+
1411+
if ($callable instanceof Closure) {
1412+
$callable = $callable->bindTo(null, static::class);
14091413
}
14101414

1411-
return call_user_func_array(static::$macros[$method], $parameters);
1415+
return $callable(...$parameters);
14121416
}
14131417

14141418
/**

‎src/Illuminate/Database/Eloquent/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ public function keys()
451451
*/
452452
public function zip($items)
453453
{
454-
return call_user_func_array([$this->toBase(), 'zip'], func_get_args());
454+
return $this->toBase()->zip(...func_get_args());
455455
}
456456

457457
/**

‎src/Illuminate/Database/Eloquent/Relations/Concerns/InteractsWithPivotTable.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -537,11 +537,11 @@ public function newPivotQuery()
537537
$query = $this->newPivotStatement();
538538

539539
foreach ($this->pivotWheres as $arguments) {
540-
call_user_func_array([$query, 'where'], $arguments);
540+
$query->where(...$arguments);
541541
}
542542

543543
foreach ($this->pivotWhereIns as $arguments) {
544-
call_user_func_array([$query, 'whereIn'], $arguments);
544+
$query->whereIn(...$arguments);
545545
}
546546

547547
return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey});

‎src/Illuminate/Database/MigrationServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ protected function registerCreator()
102102
protected function registerCommands(array $commands)
103103
{
104104
foreach (array_keys($commands) as $command) {
105-
call_user_func_array([$this, "register{$command}Command"], []);
105+
$this->{"register{$command}Command"}();
106106
}
107107

108108
$this->commands(array_values($commands));

‎src/Illuminate/Database/Schema/Grammars/RenameColumn.php

+14-1
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,22 @@ protected static function getRenamedDiff(Grammar $grammar, Blueprint $blueprint,
6161
protected static function setRenamedColumns(TableDiff $tableDiff, Fluent $command, Column $column)
6262
{
6363
$tableDiff->renamedColumns = [
64-
$command->from => new Column($command->to, $column->getType(), $column->toArray()),
64+
$command->from => new Column($command->to, $column->getType(), self::getWritableColumnOptions($column)),
6565
];
6666

6767
return $tableDiff;
6868
}
69+
70+
/**
71+
* Get the writable column options.
72+
*
73+
* @param \Doctrine\DBAL\Schema\Column $column
74+
* @return array
75+
*/
76+
private static function getWritableColumnOptions(Column $column)
77+
{
78+
return array_filter($column->toArray(), function (string $name) use ($column) {
79+
return method_exists($column, 'set'.$name);
80+
}, ARRAY_FILTER_USE_KEY);
81+
}
6982
}

‎src/Illuminate/Events/CallQueuedListener.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,15 @@ public function handle(Container $container)
8989
$this->job, $container->make($this->class)
9090
);
9191

92-
call_user_func_array(
93-
[$handler, $this->method], $this->data
94-
);
92+
$handler->{$this->method}(...array_values($this->data));
9593
}
9694

9795
/**
9896
* Set the job instance of the given class if necessary.
9997
*
10098
* @param \Illuminate\Contracts\Queue\Job $job
101-
* @param mixed $instance
102-
* @return mixed
99+
* @param object $instance
100+
* @return object
103101
*/
104102
protected function setJobInstanceIfNecessary(Job $job, $instance)
105103
{
@@ -124,10 +122,10 @@ public function failed($e)
124122

125123
$handler = Container::getInstance()->make($this->class);
126124

127-
$parameters = array_merge($this->data, [$e]);
125+
$parameters = array_merge(array_values($this->data), [$e]);
128126

129127
if (method_exists($handler, 'failed')) {
130-
call_user_func_array([$handler, 'failed'], $parameters);
128+
$handler->failed(...$parameters);
131129
}
132130
}
133131

‎src/Illuminate/Events/Dispatcher.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,9 @@ public function createClassListener($listener, $wildcard = false)
384384
return call_user_func($this->createClassCallable($listener), $event, $payload);
385385
}
386386

387-
return call_user_func_array(
388-
$this->createClassCallable($listener), $payload
389-
);
387+
$callable = $this->createClassCallable($listener);
388+
389+
return $callable(...array_values($payload));
390390
};
391391
}
392392

‎src/Illuminate/Filesystem/FilesystemAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,6 @@ protected function parseVisibility($visibility)
739739
*/
740740
public function __call($method, array $parameters)
741741
{
742-
return call_user_func_array([$this->driver, $method], $parameters);
742+
return $this->driver->{$method}(...array_values($parameters));
743743
}
744744
}

‎src/Illuminate/Filesystem/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"suggest": {
3333
"ext-ftp": "Required to use the Flysystem FTP driver.",
34-
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.0.34).",
34+
"league/flysystem": "Required to use the Flysystem local and FTP drivers (^1.1).",
3535
"league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).",
3636
"league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).",
3737
"league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).",

‎src/Illuminate/Foundation/Console/QueuedCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ public function __construct($data)
3737
*/
3838
public function handle(KernelContract $kernel)
3939
{
40-
call_user_func_array([$kernel, 'call'], $this->data);
40+
$kernel->call(...array_values($this->data));
4141
}
4242
}

‎src/Illuminate/Foundation/Providers/ArtisanServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public function register()
168168
protected function registerCommands(array $commands)
169169
{
170170
foreach (array_keys($commands) as $command) {
171-
call_user_func_array([$this, "register{$command}Command"], []);
171+
$this->{"register{$command}Command"}();
172172
}
173173

174174
$this->commands(array_values($commands));

‎src/Illuminate/Http/ResponseTrait.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function withHeaders($headers)
9696
*/
9797
public function cookie($cookie)
9898
{
99-
return call_user_func_array([$this, 'withCookie'], func_get_args());
99+
return $this->withCookie(...func_get_args());
100100
}
101101

102102
/**
@@ -108,7 +108,7 @@ public function cookie($cookie)
108108
public function withCookie($cookie)
109109
{
110110
if (is_string($cookie) && function_exists('cookie')) {
111-
$cookie = call_user_func_array('cookie', func_get_args());
111+
$cookie = cookie(...func_get_args());
112112
}
113113

114114
$this->headers->setCookie($cookie);

‎src/Illuminate/Queue/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"illuminate/filesystem": "^6.0",
2424
"illuminate/pipeline": "^6.0",
2525
"illuminate/support": "^6.0",
26-
"opis/closure": "^3.1",
26+
"opis/closure": "^3.6",
2727
"symfony/debug": "^4.3.4",
2828
"symfony/process": "^4.3.4"
2929
},

‎src/Illuminate/Redis/Connections/PredisConnection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function createSubscription($channels, Closure $callback, $method = 'subs
4242
{
4343
$loop = $this->pubSubLoop();
4444

45-
call_user_func_array([$loop, $method], (array) $channels);
45+
$loop->{$method}(...array_values((array) $channels));
4646

4747
foreach ($loop as $message) {
4848
if ($message->kind === 'message' || $message->kind === 'pmessage') {

‎src/Illuminate/Routing/Controller.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function getMiddleware()
5151
*/
5252
public function callAction($method, $parameters)
5353
{
54-
return call_user_func_array([$this, $method], $parameters);
54+
return $this->{$method}(...array_values($parameters));
5555
}
5656

5757
/**

‎src/Illuminate/Routing/Pipeline.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function handleException($passable, Exception $e)
5050

5151
$response = $handler->render($passable, $e);
5252

53-
if (method_exists($response, 'withException')) {
53+
if (is_object($response) && method_exists($response, 'withException')) {
5454
$response->withException($e);
5555
}
5656

‎src/Illuminate/Routing/Route.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -790,9 +790,9 @@ public function gatherMiddleware()
790790

791791
$this->computedMiddleware = [];
792792

793-
return $this->computedMiddleware = array_unique(array_merge(
793+
return $this->computedMiddleware = Router::uniqueMiddleware(array_merge(
794794
$this->middleware(), $this->controllerMiddleware()
795-
), SORT_REGULAR);
795+
));
796796
}
797797

798798
/**

‎src/Illuminate/Routing/Router.php

+23
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,29 @@ public function setRoutes(RouteCollection $routes)
12731273
$this->container->instance('routes', $this->routes);
12741274
}
12751275

1276+
/**
1277+
* Remove any duplicate middleware from the given array.
1278+
*
1279+
* @param array $middleware
1280+
* @return array
1281+
*/
1282+
public static function uniqueMiddleware(array $middleware)
1283+
{
1284+
$seen = [];
1285+
$result = [];
1286+
1287+
foreach ($middleware as $value) {
1288+
$key = \is_object($value) ? \spl_object_id($value) : $value;
1289+
1290+
if (! isset($seen[$key])) {
1291+
$seen[$key] = true;
1292+
$result[] = $value;
1293+
}
1294+
}
1295+
1296+
return $result;
1297+
}
1298+
12761299
/**
12771300
* Dynamically handle calls into the router instance.
12781301
*

‎src/Illuminate/Routing/SortedMiddleware.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function sortMiddleware($priorityMap, $middlewares)
6262
}
6363
}
6464

65-
return array_values(array_unique($middlewares, SORT_REGULAR));
65+
return Router::uniqueMiddleware($middlewares);
6666
}
6767

6868
/**

‎src/Illuminate/Support/Collection.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1210,7 +1210,7 @@ public function zip($items)
12101210
return new static(func_get_args());
12111211
}, $this->items], $arrayableItems);
12121212

1213-
return new static(call_user_func_array('array_map', $params));
1213+
return new static(array_map(...$params));
12141214
}
12151215

12161216
/**

0 commit comments

Comments
 (0)
Please sign in to comment.