diff --git a/docs/6/api-reference/directives.md b/docs/6/api-reference/directives.md index d53a98e6f..8129321f2 100644 --- a/docs/6/api-reference/directives.md +++ b/docs/6/api-reference/directives.md @@ -896,7 +896,10 @@ final class ComplexityAnalyzer ```graphql """ -Replaces `""` with `null`. +Replaces incoming empty strings `""` with `null`. + +When used upon fields, empty strings for non-nullable inputs will pass unchanged. +Only explicitly placing this on non-nullable inputs will force the conversion. """ directive @convertEmptyStringsToNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINITION ``` diff --git a/docs/master/api-reference/directives.md b/docs/master/api-reference/directives.md index d53a98e6f..8129321f2 100644 --- a/docs/master/api-reference/directives.md +++ b/docs/master/api-reference/directives.md @@ -896,7 +896,10 @@ final class ComplexityAnalyzer ```graphql """ -Replaces `""` with `null`. +Replaces incoming empty strings `""` with `null`. + +When used upon fields, empty strings for non-nullable inputs will pass unchanged. +Only explicitly placing this on non-nullable inputs will force the conversion. """ directive @convertEmptyStringsToNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINITION ``` diff --git a/phpstan.neon b/phpstan.neon index b6d259e77..02d1c6d32 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -46,7 +46,7 @@ parameters: - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder|Illuminate\\Database\\Eloquent\\Relations\\Relation|Illuminate\\Database\\Query\\Builder::(orderBy|where|whereIn|whereNotIn|whereBetween|whereJsonContains|whereNotBetween)\(\)\.#' # Laravel 11 added generics that are handled differently, so we just omit them - - '#generic class Illuminate\\Database\\Eloquent\\Builder but does not specify its types#' + - '#generic class (Illuminate\\Database\\Eloquent\\Builder|Laravel\\Scout\\Builder)( but)? does not specify its types#' # This test cheats and uses reflection to make assertions - path: tests/Unit/Schema/Directives/BaseDirectiveTest.php diff --git a/src/Schema/Directives/ConvertEmptyStringsToNullDirective.php b/src/Schema/Directives/ConvertEmptyStringsToNullDirective.php index 8b9f19645..4fe6c8940 100644 --- a/src/Schema/Directives/ConvertEmptyStringsToNullDirective.php +++ b/src/Schema/Directives/ConvertEmptyStringsToNullDirective.php @@ -16,7 +16,10 @@ public static function definition(): string { return /** @lang GraphQL */ <<<'GRAPHQL' """ -Replaces `""` with `null`. +Replaces incoming empty strings `""` with `null`. + +When used upon fields, empty strings for non-nullable inputs will pass unchanged. +Only explicitly placing this on non-nullable inputs will force the conversion. """ directive @convertEmptyStringsToNull on ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | FIELD_DEFINITION GRAPHQL; diff --git a/tests/Utils/Mutations/ReturnReceivedInput.php b/tests/Utils/Mutations/ReturnReceivedInput.php index 066fcec38..bf9a5ca0e 100644 --- a/tests/Utils/Mutations/ReturnReceivedInput.php +++ b/tests/Utils/Mutations/ReturnReceivedInput.php @@ -5,7 +5,7 @@ final class ReturnReceivedInput { /** - * @param array $args + * @param array $args * * @return array */