Skip to content

Commit

Permalink
Improve docs for @convertEmptyStringsToNull
Browse files Browse the repository at this point in the history
  • Loading branch information
spawnia committed Sep 6, 2024
1 parent b7f196e commit 45e1cbb
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion docs/6/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
5 changes: 4 additions & 1 deletion docs/master/api-reference/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ parameters:
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder<Illuminate\\Database\\Eloquent\\Model>|Illuminate\\Database\\Eloquent\\Relations\\Relation<Illuminate\\Database\\Eloquent\\Model>|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
Expand Down
5 changes: 4 additions & 1 deletion src/Schema/Directives/ConvertEmptyStringsToNullDirective.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/Utils/Mutations/ReturnReceivedInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
final class ReturnReceivedInput
{
/**
* @param array<string, mixed> $args
* @param array<string, mixed> $args
*
* @return array<string, mixed>
*/
Expand Down

0 comments on commit 45e1cbb

Please sign in to comment.