diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index e04dcb56..22ad9e0d 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -18,6 +18,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: '7.4' + tools: composer:v1 coverage: none # Due to version incompatibility with older Laravels we test, we remove it diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ea982c90..600304e9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: integration: strategy: matrix: - php: [7.1, 7.2, 7.3, 7.4] + php: [7.1, 7.2, 7.3, 7.4, 8.0] laravel: [5.5.*, ^6.0, ^7.0, ^8.0] exclude: - php: 7.1 @@ -19,6 +19,10 @@ jobs: laravel: ^8.0 - php: 7.4 laravel: 5.5.* + - php: 8.0 + laravel: 5.5.* + - php: 8.0 + laravel: ^6.0 name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }} runs-on: ubuntu-18.04 env: @@ -37,6 +41,7 @@ jobs: - run: composer remove --dev matt-allan/laravel-code-style --no-update - run: composer require illuminate/contracts:${{ matrix.laravel }} --no-update - run: composer remove --dev nunomaduro/larastan --no-update + - run: composer remove --dev friendsofphp/php-cs-fixer --no-update - run: composer require --dev laravel/legacy-factories --no-update if: matrix.laravel == '^8.0' diff --git a/CHANGELOG.md b/CHANGELOG.md index a04066d1..19cdbc62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ CHANGELOG [Next release](https://github.com/rebing/graphql-laravel/compare/5.1.4...master) -------------- +### Added +- Support for PHP 8 [\#686 / mfn](https://github.com/rebing/graphql-laravel/pull/686) + 2020-09-03, 5.1.4 ----------------- Hotfix release to replace 5.1.3 diff --git a/composer.json b/composer.json index e88f4cfb..96b1c5db 100644 --- a/composer.json +++ b/composer.json @@ -41,7 +41,7 @@ }, "require-dev": { "orchestra/testbench": "3.5.*|3.6.*|3.7.*|3.8.*|3.9.*|4.0.*|5.0.*|^6.0", - "phpunit/phpunit": "^5.5|~6.0|~7.0|~8.0", + "phpunit/phpunit": "^5.5|~6.0|~7.0|~8.0|^9", "mockery/mockery": "^1.2", "friendsofphp/php-cs-fixer": "^2.15", "matt-allan/laravel-code-style": "0.5.0" diff --git a/src/Console/PublishCommand.php b/src/Console/PublishCommand.php index 08c4cdfd..b8734974 100644 --- a/src/Console/PublishCommand.php +++ b/src/Console/PublishCommand.php @@ -85,8 +85,6 @@ protected function createParentDirectory(string $directory): void */ protected function status(string $from, string $to): void { - $from = str_replace(base_path(), '', realpath($from)); - $to = str_replace(base_path(), '', realpath($to)); $this->line("Copied File [{$from}] To [{$to}]"); } } diff --git a/src/Support/Field.php b/src/Support/Field.php index e904a440..d85f391e 100644 --- a/src/Support/Field.php +++ b/src/Support/Field.php @@ -162,13 +162,15 @@ protected function getResolver(): ?Closure $additionalParams = array_slice($method->getParameters(), 3); $additionalArguments = array_map(function ($param) use ($arguments, $fieldsAndArguments) { - $className = null !== $param->getClass() ? $param->getClass()->getName() : null; + $paramType = $param->getType(); - if (null === $className) { + if ($paramType->isBuiltin()) { throw new InvalidArgumentException("'{$param->name}' could not be injected"); } - if (Closure::class === $param->getType()->getName()) { + $className = $param->getType()->getName(); + + if (Closure::class === $className) { return function (int $depth = null) use ($arguments, $fieldsAndArguments): SelectFields { return $this->instanciateSelectFields($arguments, $fieldsAndArguments, $depth); };