Skip to content

Commit df3c361

Browse files
authored
Merge pull request #686 from mfn/mfn-5.x-php8
[5.x] PHP 8 compatibility
2 parents ca3327c + 4577d74 commit df3c361

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

.github/workflows/integration_tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
- uses: shivammathur/setup-php@v2
1919
with:
2020
php-version: '7.4'
21+
tools: composer:v1
2122
coverage: none
2223

2324
# Due to version incompatibility with older Laravels we test, we remove it

.github/workflows/tests.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
integration:
77
strategy:
88
matrix:
9-
php: [7.1, 7.2, 7.3, 7.4]
9+
php: [7.1, 7.2, 7.3, 7.4, 8.0]
1010
laravel: [5.5.*, ^6.0, ^7.0, ^8.0]
1111
exclude:
1212
- php: 7.1
@@ -19,6 +19,10 @@ jobs:
1919
laravel: ^8.0
2020
- php: 7.4
2121
laravel: 5.5.*
22+
- php: 8.0
23+
laravel: 5.5.*
24+
- php: 8.0
25+
laravel: ^6.0
2226
name: PHP ${{ matrix.php }} Laravel ${{ matrix.laravel }}
2327
runs-on: ubuntu-18.04
2428
env:
@@ -37,6 +41,7 @@ jobs:
3741
- run: composer remove --dev matt-allan/laravel-code-style --no-update
3842
- run: composer require illuminate/contracts:${{ matrix.laravel }} --no-update
3943
- run: composer remove --dev nunomaduro/larastan --no-update
44+
- run: composer remove --dev friendsofphp/php-cs-fixer --no-update
4045
- run: composer require --dev laravel/legacy-factories --no-update
4146
if: matrix.laravel == '^8.0'
4247

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ CHANGELOG
44
[Next release](https://github.com/rebing/graphql-laravel/compare/5.1.4...master)
55
--------------
66

7+
### Added
8+
- Support for PHP 8 [\#686 / mfn](https://github.com/rebing/graphql-laravel/pull/686)
9+
710
2020-09-03, 5.1.4
811
-----------------
912
Hotfix release to replace 5.1.3

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"require-dev": {
4343
"orchestra/testbench": "3.5.*|3.6.*|3.7.*|3.8.*|3.9.*|4.0.*|5.0.*|^6.0",
44-
"phpunit/phpunit": "^5.5|~6.0|~7.0|~8.0",
44+
"phpunit/phpunit": "^5.5|~6.0|~7.0|~8.0|^9",
4545
"mockery/mockery": "^1.2",
4646
"friendsofphp/php-cs-fixer": "^2.15",
4747
"matt-allan/laravel-code-style": "0.5.0"

src/Console/PublishCommand.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,6 @@ protected function createParentDirectory(string $directory): void
8585
*/
8686
protected function status(string $from, string $to): void
8787
{
88-
$from = str_replace(base_path(), '', realpath($from));
89-
$to = str_replace(base_path(), '', realpath($to));
9088
$this->line("<info>Copied File</info> <comment>[{$from}]</comment> <info>To</info> <comment>[{$to}]</comment>");
9189
}
9290
}

src/Support/Field.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,15 @@ protected function getResolver(): ?Closure
162162
$additionalParams = array_slice($method->getParameters(), 3);
163163

164164
$additionalArguments = array_map(function ($param) use ($arguments, $fieldsAndArguments) {
165-
$className = null !== $param->getClass() ? $param->getClass()->getName() : null;
165+
$paramType = $param->getType();
166166

167-
if (null === $className) {
167+
if ($paramType->isBuiltin()) {
168168
throw new InvalidArgumentException("'{$param->name}' could not be injected");
169169
}
170170

171-
if (Closure::class === $param->getType()->getName()) {
171+
$className = $param->getType()->getName();
172+
173+
if (Closure::class === $className) {
172174
return function (int $depth = null) use ($arguments, $fieldsAndArguments): SelectFields {
173175
return $this->instanciateSelectFields($arguments, $fieldsAndArguments, $depth);
174176
};

0 commit comments

Comments
 (0)