Skip to content

Commit

Permalink
[6.x] PHP 7.4 support (#29482)
Browse files Browse the repository at this point in the history
* Add PHP 7.4 build

* Fix array_key_exists call on object

* Fix CreateMembersTable resolving

* Fix array call on null for Facade

* Rebind $this for static closure macros

* Try reverting unbinding closure

* Use argument unpacking

* Require new minimum mockery version

* Fix PHP 7.4 support for email package

* Make Symfony 4.3.4 the new minimum requirement

* Bump PHPUnit to 8.3

* Remove 7.4 build from failures
  • Loading branch information
driesvints authored and taylorotwell committed Sep 3, 2019
1 parent f9ccf59 commit 6fd0aa0
Show file tree
Hide file tree
Showing 17 changed files with 48 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ matrix:
- php: 7.3
- php: 7.3
env: SETUP=lowest
- php: 7.4snapshot
- php: 7.4snapshot
env: SETUP=lowest

cache:
directories:
Expand Down
22 changes: 11 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"ext-openssl": "*",
"doctrine/inflector": "^1.1",
"dragonmantank/cron-expression": "^2.0",
"egulias/email-validator": "^2.0",
"egulias/email-validator": "^2.1.10",
"erusev/parsedown": "^1.7",
"league/flysystem": "^1.0.8",
"monolog/monolog": "^1.12|^2.0",
Expand All @@ -31,14 +31,14 @@
"psr/simple-cache": "^1.0",
"ramsey/uuid": "^3.7",
"swiftmailer/swiftmailer": "^6.0",
"symfony/console": "^4.3",
"symfony/debug": "^4.3",
"symfony/finder": "^4.3",
"symfony/http-foundation": "^4.3",
"symfony/http-kernel": "^4.3",
"symfony/process": "^4.3",
"symfony/routing": "^4.3",
"symfony/var-dumper": "^4.3",
"symfony/console": "^4.3.4",
"symfony/debug": "^4.3.4",
"symfony/finder": "^4.3.4",
"symfony/http-foundation": "^4.3.4",
"symfony/http-kernel": "^4.3.4",
"symfony/process": "^4.3.4",
"symfony/routing": "^4.3.4",
"symfony/var-dumper": "^4.3.4",
"tijsverkoyen/css-to-inline-styles": "^2.2.1",
"vlucas/phpdotenv": "^3.3"
},
Expand Down Expand Up @@ -81,11 +81,11 @@
"filp/whoops": "^2.4",
"guzzlehttp/guzzle": "^6.3",
"league/flysystem-cached-adapter": "^1.0",
"mockery/mockery": "^1.0",
"mockery/mockery": "^1.2.3",
"moontoast/math": "^1.1",
"orchestra/testbench-core": "^4.0",
"pda/pheanstalk": "^4.0",
"phpunit/phpunit": "^8.0",
"phpunit/phpunit": "^8.3",
"predis/predis": "^1.1.1",
"symfony/cache": "^4.3",
"true/punycode": "^2.1"
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Console/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"php": "^7.2",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"symfony/console": "^4.3",
"symfony/process": "^4.3"
"symfony/console": "^4.3.4",
"symfony/process": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Cookie/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"php": "^7.2",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"symfony/http-foundation": "^4.3",
"symfony/http-kernel": "^4.3"
"symfony/http-foundation": "^4.3.4",
"symfony/http-kernel": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Filesystem/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": "^7.2",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"symfony/finder": "^4.3"
"symfony/finder": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Http/Resources/DelegatesToResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function resolveRouteBinding($value)
*/
public function offsetExists($offset)
{
return array_key_exists($offset, $this->resource);
return isset($this->resource[$offset]);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Http/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"ext-json": "*",
"illuminate/session": "^6.0",
"illuminate/support": "^6.0",
"symfony/http-foundation": "^4.3",
"symfony/http-kernel": "^4.3"
"symfony/http-foundation": "^4.3.4",
"symfony/http-kernel": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Queue/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"illuminate/pipeline": "^6.0",
"illuminate/support": "^6.0",
"opis/closure": "^3.1",
"symfony/debug": "^4.3",
"symfony/process": "^4.3"
"symfony/debug": "^4.3.4",
"symfony/process": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Routing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"illuminate/pipeline": "^6.0",
"illuminate/session": "^6.0",
"illuminate/support": "^6.0",
"symfony/debug": "^4.3",
"symfony/http-foundation": "^4.3",
"symfony/http-kernel": "^4.3",
"symfony/routing": "^4.3"
"symfony/debug": "^4.3.4",
"symfony/http-foundation": "^4.3.4",
"symfony/http-kernel": "^4.3.4",
"symfony/routing": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Session/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"illuminate/contracts": "^6.0",
"illuminate/filesystem": "^6.0",
"illuminate/support": "^6.0",
"symfony/finder": "^4.3",
"symfony/http-foundation": "^4.3"
"symfony/finder": "^4.3.4",
"symfony/http-foundation": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 3 additions & 1 deletion src/Illuminate/Support/Facades/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ protected static function resolveFacadeInstance($name)
return static::$resolvedInstance[$name];
}

return static::$resolvedInstance[$name] = static::$app[$name];
if (static::$app) {
return static::$resolvedInstance[$name] = static::$app[$name];
}
}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/Illuminate/Support/Traits/Macroable.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ public static function __callStatic($method, $parameters)
));
}

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

if ($macro instanceof Closure) {
return call_user_func_array(Closure::bind($macro, null, static::class), $parameters);
}

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

/**
Expand All @@ -110,6 +112,6 @@ public function __call($method, $parameters)
return call_user_func_array($macro->bindTo($this, static::class), $parameters);
}

return call_user_func_array($macro, $parameters);
return $macro(...$parameters);
}
}
4 changes: 2 additions & 2 deletions src/Illuminate/Support/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"illuminate/filesystem": "Required to use the composer class (^6.0).",
"moontoast/math": "Required to use ordered UUIDs (^1.1).",
"ramsey/uuid": "Required to use Str::uuid() (^3.7).",
"symfony/process": "Required to use the composer class (^4.3).",
"symfony/var-dumper": "Required to use the dd function (^4.3).",
"symfony/process": "Required to use the composer class (^4.3.4).",
"symfony/var-dumper": "Required to use the dd function (^4.3.4).",
"vlucas/phpdotenv": "Required to use the Env class and env helper (^3.3)."
},
"config": {
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Validation/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
"require": {
"php": "^7.2",
"ext-json": "*",
"egulias/email-validator": "^2.0",
"egulias/email-validator": "^2.1.10",
"illuminate/container": "^6.0",
"illuminate/contracts": "^6.0",
"illuminate/support": "^6.0",
"illuminate/translation": "^6.0",
"symfony/http-foundation": "^4.3"
"symfony/http-foundation": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/View/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"illuminate/events": "^6.0",
"illuminate/filesystem": "^6.0",
"illuminate/support": "^6.0",
"symfony/debug": "^4.3"
"symfony/debug": "^4.3.4"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/Migration/MigratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testDontDisplayOutputWhenOutputObjectIsNotAvailable()

$migrator->run([__DIR__.'/fixtures']);

$this->assertTrue($this->tableExists('members'));
$this->assertTrue($this->tableExists('people'));
}

private function tableExists($table): bool
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?php

namespace Illuminate\Tests\Integration\Migration\fixtures;

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMembersTable extends Migration
class CreatePeopleTable extends Migration
{
/**
* Run the migrations.
Expand All @@ -15,7 +13,7 @@ class CreateMembersTable extends Migration
*/
public function up()
{
Schema::create('members', function (Blueprint $table) {
Schema::create('people', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
Expand All @@ -32,6 +30,6 @@ public function up()
*/
public function down()
{
Schema::drop('members');
Schema::drop('people');
}
}

0 comments on commit 6fd0aa0

Please sign in to comment.