diff --git a/src/FieldDescription/TypeGuesserChain.php b/src/FieldDescription/TypeGuesserChain.php index d4abee8554..9f8a29ba97 100644 --- a/src/FieldDescription/TypeGuesserChain.php +++ b/src/FieldDescription/TypeGuesserChain.php @@ -56,7 +56,7 @@ public function __construct(array $guessers) $this->guessers = array_merge(...$allGuessers); } - public function guess(FieldDescriptionInterface $fieldDescription): TypeGuess + public function guess(FieldDescriptionInterface $fieldDescription): ?TypeGuess { $guesses = []; @@ -69,7 +69,10 @@ public function guess(FieldDescriptionInterface $fieldDescription): TypeGuess )); } - $guesses[] = $guesser->guess($fieldDescription); + $guess = $guesser->guess($fieldDescription); + if (null !== $guess) { + $guesses[] = $guess; + } } return TypeGuess::getBestGuess($guesses); diff --git a/src/FieldDescription/TypeGuesserInterface.php b/src/FieldDescription/TypeGuesserInterface.php index b97363ef87..a8731d5479 100644 --- a/src/FieldDescription/TypeGuesserInterface.php +++ b/src/FieldDescription/TypeGuesserInterface.php @@ -17,5 +17,5 @@ interface TypeGuesserInterface { - public function guess(FieldDescriptionInterface $fieldDescription): TypeGuess; + public function guess(FieldDescriptionInterface $fieldDescription): ?TypeGuess; }