diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 7265ab86..a5c3e413 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -32,7 +32,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: - php-version: 8.3 + php-version: 8.4 coverage: none # Remove unnecessary dependencies not needed in this context diff --git a/.github/workflows/integration_tests.yml b/.github/workflows/integration_tests.yml index 050862c5..6b0cfc1f 100644 --- a/.github/workflows/integration_tests.yml +++ b/.github/workflows/integration_tests.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2, 8.3] + php: [8.1, 8.2, 8.3, 8.4] laravel: [^10.0, ^11.0] exclude: - php: 8.1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7bc187e6..4e1f6330 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.1, 8.2, 8.3] + php: [8.1, 8.2, 8.3, 8.4] laravel: [^10.0, ^11.0] stability: [prefer-lowest, prefer-stable] exclude: @@ -42,6 +42,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} + ini-file: development coverage: none extensions: pdo_sqlite diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ad33d5..e284d466 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,13 @@ CHANGELOG ========= -[Next release](https://github.com/rebing/graphql-laravel/compare/9.6.0...master) +[Next release](https://github.com/rebing/graphql-laravel/compare/9.7.0...master) + +2024-11-22, 9.7.0 +----------------- + +## Fixed +- Fixes for implicit nullability deprecation (PHP 8.4 compat) [\#1152 / duncanmcclean](https://github.com/rebing/graphql-laravel/pull/1152) 2024-08-23, 9.6.0 ----------------- diff --git a/composer.json b/composer.json index dd865b18..f188dd4f 100644 --- a/composer.json +++ b/composer.json @@ -44,13 +44,15 @@ }, "require-dev": { "ext-pdo_sqlite": "*", + "fakerphp/faker": "^1.6", "friendsofphp/php-cs-fixer": "^3", + "larastan/larastan": "^2", + "laravel/framework": "^10.0|^11.0", "mfn/php-cs-fixer-config": "^2", - "mockery/mockery": "^1.2", + "mockery/mockery": "^1.5", + "orchestra/testbench-core": "^8.0|^9.0", "phpstan/phpstan": "^1", - "larastan/larastan": "^2", - "orchestra/testbench": "^8.0|^9.0", - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^10.5.32", "thecodingmachine/phpstan-safe-rule": "^1" }, "autoload": { @@ -68,7 +70,7 @@ "phpstan-baseline": "phpstan analyse --memory-limit=512M --generate-baseline", "lint": "php-cs-fixer fix --diff --dry-run", "fix-style": "php-cs-fixer fix", - "tests": "phpunit" + "tests": "LOG_DEPRECATIONS_CHANNEL=errorlog phpunit" }, "extra": { "branch-alias": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 10afaaeb..3906d290 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -21,7 +21,7 @@ parameters: path: src/GraphQL.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, non\\-empty\\-array\\\\|\\(ArrayAccess&Rebing\\\\GraphQL\\\\Support\\\\Field\\)\\>\\|string\\> given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, \\.\\.\\.\\}, non\\-empty\\-array\\\\|\\(ArrayAccess&Rebing\\\\GraphQL\\\\Support\\\\Field\\)\\>\\|string\\> given\\.$#" count: 1 path: src/GraphQL.php @@ -31,7 +31,7 @@ parameters: path: src/GraphQL.php - - message: "#^Property GraphQL\\\\Type\\\\Definition\\\\ObjectType\\:\\:\\$config \\(array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}\\) does not accept non\\-empty\\-array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|\\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|iterable\\|string\\|null\\>\\.$#" + message: "#^Property GraphQL\\\\Type\\\\Definition\\\\ObjectType\\:\\:\\$config \\(array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, \\.\\.\\.\\}\\) does not accept array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|string\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|string\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable\\|string, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>\\|string, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|string\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|string\\|null, \\.\\.\\.\\}\\.$#" count: 1 path: src/GraphQL.php @@ -101,7 +101,7 @@ parameters: path: src/Support/AliasArguments/ArrayKeyChange.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\EnumType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, values\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\EnumTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\EnumType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, values\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\EnumTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" count: 1 path: src/Support/EnumType.php @@ -110,6 +110,66 @@ parameters: count: 1 path: src/Support/ExecutionMiddleware/AbstractExecutionMiddleware.php + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method buildSchemaFromConfig\\(\\) parameter \\#1 \\$schemaConfig with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method execute\\(\\) return type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method formatError\\(\\) return type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method getGlobalResolverMiddlewares\\(\\) return type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method getSchemas\\(\\) return type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method objectType\\(\\) parameter \\#1 \\$type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method objectType\\(\\) parameter \\#2 \\$opts with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method query\\(\\) parameter \\#2 \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method query\\(\\) parameter \\#3 \\$opts with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method query\\(\\) return type with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method queryAndReturnResult\\(\\) parameter \\#2 \\$params with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + + - + message: "#^Class Rebing\\\\GraphQL\\\\Support\\\\Facades\\\\GraphQL has PHPDoc tag @method for method queryAndReturnResult\\(\\) parameter \\#3 \\$opts with no value type specified in iterable type array\\.$#" + count: 1 + path: src/Support/Facades/GraphQL.php + - message: "#^Cannot call method getName\\(\\) on ReflectionType\\|null\\.$#" count: 1 @@ -186,12 +246,12 @@ parameters: path: src/Support/Field.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\InputObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, fields\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\, parseValue\\?\\: callable\\(array\\\\)\\: mixed, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\InputObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\InputObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, fields\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\, parseValue\\?\\: callable\\(array\\\\)\\: mixed, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\InputObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" count: 1 path: src/Support/InputType.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\InterfaceType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, resolveType\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\ObjectType\\|string\\|null\\)\\|GraphQL\\\\Deferred\\|GraphQL\\\\Type\\\\Definition\\\\ObjectType\\|string\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\InterfaceTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\InterfaceType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, resolveType\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\ObjectType\\|string\\|null\\)\\|GraphQL\\\\Deferred\\|GraphQL\\\\Type\\\\Definition\\\\ObjectType\\|string\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\InterfaceTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" count: 1 path: src/Support/InterfaceType.php @@ -336,17 +396,17 @@ parameters: path: src/Support/SelectFields.php - - message: "#^Offset 'always' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\FieldDefinitionNode\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" + message: "#^Offset 'always' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" count: 1 path: src/Support/SelectFields.php - - message: "#^Offset 'privacy' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\FieldDefinitionNode\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" + message: "#^Offset 'privacy' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" count: 1 path: src/Support/SelectFields.php - - message: "#^Offset 'selectable' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\FieldDefinitionNode\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" + message: "#^Offset 'selectable' on array\\{name\\: string, type\\: \\(callable\\(\\)\\: \\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\)\\)\\|\\(GraphQL\\\\Type\\\\Definition\\\\OutputType&GraphQL\\\\Type\\\\Definition\\\\Type\\), resolve\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, args\\?\\: iterable\\\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, description\\?\\: string\\|null, visible\\?\\: bool\\|\\(callable\\(\\)\\: bool\\), deprecationReason\\?\\: string\\|null, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" count: 1 path: src/Support/SelectFields.php @@ -386,7 +446,7 @@ parameters: path: src/Support/Type.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\ given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, \\.\\.\\.\\}, array\\ given\\.$#" count: 1 path: src/Support/Type.php @@ -561,7 +621,7 @@ parameters: path: tests/Database/SelectFields/InterfaceTests/ExampleInterfaceType.php - - message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: void\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'id' given\\.$#" + message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\)\\: mixed\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'id' given\\.$#" count: 1 path: tests/Database/SelectFields/InterfaceTests/ExampleInterfaceType.php @@ -641,12 +701,12 @@ parameters: path: tests/Database/SelectFields/MorphRelationshipTests/UsersQuery.php - - message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: void\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'comments\\.flag' given\\.$#" + message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\)\\: mixed\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'comments\\.flag' given\\.$#" count: 1 path: tests/Database/SelectFields/NestedRelationLoadingTests/PostType.php - - message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: void\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'posts\\.flag' given\\.$#" + message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\)\\: mixed\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'posts\\.flag' given\\.$#" count: 2 path: tests/Database/SelectFields/NestedRelationLoadingTests/UserType.php @@ -716,12 +776,12 @@ parameters: path: tests/Database/SelectFields/QueryArgsAndContextTests/GraphQLContext.php - - message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: void\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'comments\\.flag' given\\.$#" + message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\)\\: mixed\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'comments\\.flag' given\\.$#" count: 2 path: tests/Database/SelectFields/QueryArgsAndContextTests/PostType.php - - message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Relations\\\\HasMany\\)\\: void\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'posts\\.flag' given\\.$#" + message: "#^Parameter \\#1 \\$column of method Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\:\\:where\\(\\) expects array\\\\|\\(Closure\\(Illuminate\\\\Database\\\\Eloquent\\\\Builder\\\\)\\: mixed\\)\\|Illuminate\\\\Contracts\\\\Database\\\\Query\\\\Expression\\|model property of Illuminate\\\\Database\\\\Eloquent\\\\Model, 'posts\\.flag' given\\.$#" count: 3 path: tests/Database/SelectFields/QueryArgsAndContextTests/UserType.php @@ -1456,7 +1516,7 @@ parameters: path: tests/Unit/GraphQLTest.php - - message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, extensionASTNodes\\?\\: array\\\\|null\\}, array\\{name\\: 'ObjectType'\\} given\\.$#" + message: "#^Parameter \\#1 \\$config of class GraphQL\\\\Type\\\\Definition\\\\ObjectType constructor expects array\\{name\\?\\: string\\|null, description\\?\\: string\\|null, resolveField\\?\\: \\(callable\\(mixed, array\\, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: mixed\\)\\|null, argsMapper\\?\\: \\(callable\\(array\\, GraphQL\\\\Type\\\\Definition\\\\FieldDefinition, GraphQL\\\\Language\\\\AST\\\\FieldNode, mixed\\)\\: mixed\\)\\|null, fields\\: \\(callable\\(\\)\\: iterable\\)\\|iterable, interfaces\\?\\: \\(callable\\(\\)\\: iterable\\\\)\\|iterable\\<\\(callable\\(\\)\\: GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\)\\|GraphQL\\\\Type\\\\Definition\\\\InterfaceType\\>, isTypeOf\\?\\: \\(callable\\(mixed, mixed, GraphQL\\\\Type\\\\Definition\\\\ResolveInfo\\)\\: \\(bool\\|GraphQL\\\\Deferred\\|null\\)\\)\\|null, astNode\\?\\: GraphQL\\\\Language\\\\AST\\\\ObjectTypeDefinitionNode\\|null, \\.\\.\\.\\}, array\\{name\\: 'ObjectType'\\} given\\.$#" count: 1 path: tests/Unit/GraphQLTest.php diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e7eb04f5..0c8245ad 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,20 @@ diff --git a/src/GraphQL.php b/src/GraphQL.php index 69c55763..fdae1846 100644 --- a/src/GraphQL.php +++ b/src/GraphQL.php @@ -227,7 +227,7 @@ public function addTypes(array $types): void /** * @param object|string $class */ - public function addType($class, string $name = null): void + public function addType($class, ?string $name = null): void { if (!$name) { $type = \is_object($class) ? $class : $this->app->make($class); @@ -487,7 +487,7 @@ protected function clearTypeInstances(): void $this->typesInstances = []; } - public function paginate(string $typeName, string $customName = null): Type + public function paginate(string $typeName, ?string $customName = null): Type { $name = $customName ?: $typeName . 'Pagination'; @@ -499,7 +499,7 @@ public function paginate(string $typeName, string $customName = null): Type return $this->typesInstances[$name]; } - public function simplePaginate(string $typeName, string $customName = null): Type + public function simplePaginate(string $typeName, ?string $customName = null): Type { $name = $customName ?: $typeName . 'SimplePagination'; diff --git a/src/Support/ExecutionMiddleware/ValidateOperationParamsMiddleware.php b/src/Support/ExecutionMiddleware/ValidateOperationParamsMiddleware.php index 1c6958fe..431bad3e 100644 --- a/src/Support/ExecutionMiddleware/ValidateOperationParamsMiddleware.php +++ b/src/Support/ExecutionMiddleware/ValidateOperationParamsMiddleware.php @@ -23,6 +23,7 @@ public function __construct(Helper $helper) public function handle(string $schemaName, Schema $schema, OperationParams $params, $rootValue, $contextValue, Closure $next): ExecutionResult { + /** @phpstan-var list $errors */ $errors = $this->helper->validateOperationParams($params); if ($errors) { diff --git a/src/Support/Field.php b/src/Support/Field.php index c1f81a81..2857afc9 100644 --- a/src/Support/Field.php +++ b/src/Support/Field.php @@ -34,7 +34,7 @@ abstract class Field * @param mixed $root * @param mixed $ctx */ - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return true; } diff --git a/src/Support/PaginationType.php b/src/Support/PaginationType.php index 795a6102..faea86ab 100644 --- a/src/Support/PaginationType.php +++ b/src/Support/PaginationType.php @@ -11,7 +11,7 @@ class PaginationType extends ObjectType { - public function __construct(string $typeName, string $customName = null) + public function __construct(string $typeName, ?string $customName = null) { $name = $customName ?: $typeName . 'Pagination'; diff --git a/src/Support/SimplePaginationType.php b/src/Support/SimplePaginationType.php index 6925e471..a904c112 100644 --- a/src/Support/SimplePaginationType.php +++ b/src/Support/SimplePaginationType.php @@ -11,7 +11,7 @@ class SimplePaginationType extends ObjectType { - public function __construct(string $typeName, string $customName = null) + public function __construct(string $typeName, ?string $customName = null) { $name = $customName ?: $typeName . 'SimplePagination'; diff --git a/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php b/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php index 6944c77b..52baa1cb 100644 --- a/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php +++ b/tests/Database/AuthorizeArgsTests/TestAuthorizationArgsQuery.php @@ -34,8 +34,8 @@ public function authorize( $root, array $args, $ctx, - ResolveInfo $resolveInfo = null, - Closure $getSelectFields = null + ?ResolveInfo $resolveInfo = null, + ?Closure $getSelectFields = null ): bool { Assert::assertNull($root); diff --git a/tests/Support/Models/Post.php b/tests/Support/Models/Post.php index 5bc3022e..538823ba 100644 --- a/tests/Support/Models/Post.php +++ b/tests/Support/Models/Post.php @@ -18,7 +18,7 @@ * @property string $title * @property string|null $body * @property int|null $user_id - * @property array|null $properties + * @property array{name:?string,title:?string}|null $properties * @property bool $flag * @property Carbon|null $published_at * @property bool $is_published diff --git a/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php b/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php index e6f95823..1566e4ef 100644 --- a/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php +++ b/tests/Support/Objects/ExamplesAuthorizeMessageQuery.php @@ -15,7 +15,7 @@ class ExamplesAuthorizeMessageQuery extends Query 'name' => 'Examples authorize query', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return false; } diff --git a/tests/Support/Objects/ExamplesAuthorizeQuery.php b/tests/Support/Objects/ExamplesAuthorizeQuery.php index c702119b..01985e8a 100644 --- a/tests/Support/Objects/ExamplesAuthorizeQuery.php +++ b/tests/Support/Objects/ExamplesAuthorizeQuery.php @@ -15,7 +15,7 @@ class ExamplesAuthorizeQuery extends Query 'name' => 'Examples authorize query', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return false; } diff --git a/tests/Support/Traits/MakeCommandAssertionTrait.php b/tests/Support/Traits/MakeCommandAssertionTrait.php index 05e67597..6bd772c3 100644 --- a/tests/Support/Traits/MakeCommandAssertionTrait.php +++ b/tests/Support/Traits/MakeCommandAssertionTrait.php @@ -18,7 +18,7 @@ protected function assertMakeCommand( string $expectedFilename, string $expectedNamespace, string $expectedClassDefinition, - string $expectedGraphqlName = null + ?string $expectedGraphqlName = null ): void { $filesystemMock = $this ->getMockBuilder(Filesystem::class) diff --git a/tests/Support/database/factories/CommentFactory.php b/tests/Support/database/factories/CommentFactory.php index bb2a336f..064cc6ec 100644 --- a/tests/Support/database/factories/CommentFactory.php +++ b/tests/Support/database/factories/CommentFactory.php @@ -16,8 +16,8 @@ class CommentFactory extends Factory public function definition(): array { return [ - 'title' => fake()->title, - 'body' => fake()->sentence, + 'title' => fake()->title(), + 'body' => fake()->sentence(), ]; } } diff --git a/tests/Support/database/factories/PostFactory.php b/tests/Support/database/factories/PostFactory.php index 4683c1e9..32881304 100644 --- a/tests/Support/database/factories/PostFactory.php +++ b/tests/Support/database/factories/PostFactory.php @@ -16,8 +16,8 @@ class PostFactory extends Factory public function definition(): array { return [ - 'title' => fake()->title, - 'body' => fake()->sentence, + 'title' => fake()->title(), + 'body' => fake()->sentence(), ]; } } diff --git a/tests/Support/database/factories/UserFactory.php b/tests/Support/database/factories/UserFactory.php index a2392ed4..8eee3664 100644 --- a/tests/Support/database/factories/UserFactory.php +++ b/tests/Support/database/factories/UserFactory.php @@ -16,7 +16,7 @@ class UserFactory extends Factory public function definition(): array { return [ - 'name' => fake()->name, + 'name' => fake()->name(), ]; } } diff --git a/tests/TestCase.php b/tests/TestCase.php index afecd991..881b9253 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -71,6 +71,17 @@ protected function getEnvironmentSetUp($app): void ]); $app['config']->set('app.debug', true); + + $deprecationChannel = $app['config']->get('logging.deprecations.channel'); + + if ($deprecationChannel) { + // By setting `logging.channels.deprecations` here manually we + // override some behaviour in `\Orchestra\Testbench\Bootstrap\HandleExceptions::ensureDeprecationLoggerIsConfigured` + // and avoid enabling the stacktrace + $app['config']->set('logging.channels.deprecations', [ + 'driver' => $deprecationChannel, + ]); + } } protected function assertGraphQLSchema($schema): void diff --git a/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php b/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php index 10f0b6ed..68397806 100644 --- a/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php +++ b/tests/Unit/ValidationAuthorizationTests/ValidationAndAuthorizationMutation.php @@ -14,7 +14,7 @@ class ValidationAndAuthorizationMutation extends Mutation 'name' => 'validationAndAuthorization', ]; - public function authorize($root, array $args, $ctx, ResolveInfo $resolveInfo = null, Closure $getSelectFields = null): bool + public function authorize($root, array $args, $ctx, ?ResolveInfo $resolveInfo = null, ?Closure $getSelectFields = null): bool { return 'value1' === $args['arg1']; }