Skip to content

Commit

Permalink
Test on PHP 8
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Aug 14, 2020
1 parent 19db246 commit a854297
Show file tree
Hide file tree
Showing 77 changed files with 516 additions and 116 deletions.
67 changes: 58 additions & 9 deletions .github/workflows/tests.yml
Expand Up @@ -25,9 +25,9 @@ jobs:
- 6379:6379
options: --entrypoint redis-server
strategy:
fail-fast: true
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
php: [7.2, 7.3, 7.4, 8.0]
stability: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
Expand All @@ -47,8 +47,32 @@ jobs:
- name: Setup Memcached
uses: niden/actions-memcached@v7

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP 7 dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-dist --no-interaction --no-progress
if: "matrix.php < 8"

- name: Setup PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "phpunit/phpunit:^9.3.2" "doctrine/dbal:^3.0" --no-update --no-interaction
if: "matrix.php >= 8"

- name: Install PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --ignore-platform-req=php
if: "matrix.php >= 8"

- name: Execute tests
run: vendor/bin/phpunit --verbose
Expand All @@ -60,16 +84,18 @@ jobs:

runs-on: windows-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4]
php: [7.2, 7.3, 7.4, 8.0]
include:
- php: 7.2
stability: prefer-lowest
- php: 7.3
stability: prefer-stable
- php: 7.4
stability: prefer-stable
- php: 8.0
stability: prefer-stable

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - Windows

Expand All @@ -89,10 +115,33 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, gd, pdo_mysql, fileinfo, ftp
tools: composer:v2
coverage: none
ini-values: memory_limit=512M

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install PHP 7 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --prefer-dist --no-interaction --no-progress
if: "matrix.php < 8"

- name: Setup PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer require "phpunit/phpunit:^9.3.2" "doctrine/dbal:^3.0" --no-update --no-interaction
if: "matrix.php >= 8"

- name: Install PHP 8 Dependencies
uses: nick-invision/retry@v1
with:
timeout_minutes: 5
max_attempts: 5
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress --ignore-platform-req=php
if: "matrix.php >= 8"

- name: Execute tests
run: vendor/bin/phpunit --verbose
14 changes: 7 additions & 7 deletions composer.json
Expand Up @@ -15,17 +15,17 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"ext-json": "*",
"ext-mbstring": "*",
"ext-openssl": "*",
"doctrine/inflector": "^1.4|^2.0",
"dragonmantank/cron-expression": "^2.0",
"egulias/email-validator": "^2.1.10",
"league/commonmark": "^1.3",
"league/flysystem": "^1.0.34",
"league/flysystem": "^1.1",
"monolog/monolog": "^1.12|^2.0",
"nesbot/carbon": "^2.0",
"nesbot/carbon": "^2.31",
"opis/closure": "^3.1",
"psr/container": "^1.0",
"psr/simple-cache": "^1.0",
Expand Down Expand Up @@ -78,15 +78,15 @@
},
"require-dev": {
"aws/aws-sdk-php": "^3.0",
"doctrine/dbal": "^2.6",
"doctrine/dbal": "^2.6|^3.0",
"filp/whoops": "^2.4",
"guzzlehttp/guzzle": "^6.3|^7.0",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.3.1",
"mockery/mockery": "~1.3.3|^1.4.2",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "^4.0",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^7.5.15|^8.4|^9.0",
"phpunit/phpunit": "^7.5.15|^8.4|^9.3",
"predis/predis": "^1.1.1",
"symfony/cache": "^4.3.4"
},
Expand Down Expand Up @@ -120,7 +120,7 @@
"ext-posix": "Required to use all features of the queue worker.",
"ext-redis": "Required to use the Redis cache and queue drivers (^4.0|^5.0).",
"aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).",
"doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6|^3.0).",
"filp/whoops": "Required for friendly error pages in development (^2.4).",
"fzaninotto/faker": "Required to use the eloquent factory builder (^1.9.1).",
"guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0|^7.0).",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Auth/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/http": "^6.0",
"illuminate/queue": "^6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Broadcasting/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"ext-json": "*",
"psr/log": "^1.0",
"illuminate/bus": "^6.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Bus/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/pipeline": "^6.0",
"illuminate/support": "^6.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/RedisTaggedCache.php
Expand Up @@ -179,7 +179,7 @@ protected function deleteValues($referenceKey)

if (count($values) > 0) {
foreach (array_chunk($values, 1000) as $valuesChunk) {
call_user_func_array([$this->store->connection(), 'del'], $valuesChunk);
$this->store->connection()->del(...$valuesChunk);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cache/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Config/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Console/Concerns/HasParameters.php
Expand Up @@ -21,15 +21,15 @@ protected function specifyParameters()
if ($arguments instanceof InputArgument) {
$this->getDefinition()->addArgument($arguments);
} else {
call_user_func_array([$this, 'addArgument'], $arguments);
$this->addArgument(...array_values($arguments));
}
}

foreach ($this->getOptions() as $options) {
if ($options instanceof InputOption) {
$this->getDefinition()->addOption($options);
} else {
call_user_func_array([$this, 'addOption'], $options);
$this->addOption(...array_values($options));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Console/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"symfony/console": "^4.3.4",
Expand Down
6 changes: 2 additions & 4 deletions src/Illuminate/Container/BoundMethod.php
Expand Up @@ -28,9 +28,7 @@ public static function call($container, $callback, array $parameters = [], $defa
}

return static::callBoundMethod($container, $callback, function () use ($container, $callback, $parameters) {
return call_user_func_array(
$callback, static::getMethodDependencies($container, $callback, $parameters)
);
return $callback(...static::getMethodDependencies($container, $callback, $parameters));
});
}

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

return array_merge($dependencies, $parameters);
return array_merge($dependencies, array_values($parameters));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Container/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"psr/container": "^1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Contracts/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"psr/container": "^1.0",
"psr/simple-cache": "^1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cookie/CookieJar.php
Expand Up @@ -143,7 +143,7 @@ public function queue(...$parameters)
if (head($parameters) instanceof Cookie) {
$cookie = head($parameters);
} else {
$cookie = call_user_func_array([$this, 'make'], $parameters);
$cookie = $this->make(...array_values($parameters));
}

if (! isset($this->queued[$cookie->getName()])) {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Cookie/composer.json
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.2",
"php": "^7.2|^8.0",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"symfony/http-foundation": "^4.3.4",
Expand Down
11 changes: 9 additions & 2 deletions src/Illuminate/Database/Connection.php
Expand Up @@ -889,7 +889,14 @@ public function getDoctrineColumn($table, $column)
*/
public function getDoctrineSchemaManager()
{
return $this->getDoctrineDriver()->getSchemaManager($this->getDoctrineConnection());
$connection = $this->getDoctrineConnection();

// v2 expects only one param, and v3 two. We don't need to care about
// this, and can always pass them both. In v2, the 2nd is ignored.
return $this->getDoctrineDriver()->getSchemaManager(
$connection,
$connection->getDatabasePlatform()
);
}

/**
Expand All @@ -905,7 +912,7 @@ public function getDoctrineConnection()
$this->doctrineConnection = new DoctrineConnection(array_filter([
'pdo' => $this->getPdo(),
'dbname' => $this->getDatabaseName(),
'driver' => $driver->getName(),
'driver' => method_exists($driver, 'getName') ? $driver->getName() : null,
'serverVersion' => $this->getConfig('server_version'),
]), $driver);
}
Expand Down
18 changes: 11 additions & 7 deletions src/Illuminate/Database/Eloquent/Builder.php
Expand Up @@ -1351,14 +1351,16 @@ public function __call($method, $parameters)
}

if (static::hasGlobalMacro($method)) {
if (static::$macros[$method] instanceof Closure) {
return call_user_func_array(static::$macros[$method]->bindTo($this, static::class), $parameters);
$callable = static::$macros[$method];

if ($callable instanceof Closure) {
$callable = $callable->bindTo($this, static::class);
}

return call_user_func_array(static::$macros[$method], $parameters);
return $callable(...$parameters);
}

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

Expand Down Expand Up @@ -1396,11 +1398,13 @@ public static function __callStatic($method, $parameters)
static::throwBadMethodCallException($method);
}

if (static::$macros[$method] instanceof Closure) {
return call_user_func_array(Closure::bind(static::$macros[$method], null, static::class), $parameters);
$callable = static::$macros[$method];

if ($callable instanceof Closure) {
$callable = $callable->bindTo(null, static::class);
}

return call_user_func_array(static::$macros[$method], $parameters);
return $callable(...$parameters);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Collection.php
Expand Up @@ -451,7 +451,7 @@ public function keys()
*/
public function zip($items)
{
return call_user_func_array([$this->toBase(), 'zip'], func_get_args());
return $this->toBase()->zip(...func_get_args());
}

/**
Expand Down
Expand Up @@ -537,11 +537,11 @@ public function newPivotQuery()
$query = $this->newPivotStatement();

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

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

return $query->where($this->foreignPivotKey, $this->parent->{$this->parentKey});
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Database/MigrationServiceProvider.php
Expand Up @@ -102,7 +102,7 @@ protected function registerCreator()
protected function registerCommands(array $commands)
{
foreach (array_keys($commands) as $command) {
call_user_func_array([$this, "register{$command}Command"], []);
$this->{"register{$command}Command"}();
}

$this->commands(array_values($commands));
Expand Down

0 comments on commit a854297

Please sign in to comment.