Merge pull request #2076 from acelaya-forks/feature/fix-array-inputs

Make sure tags fallback to empty array when null
This commit is contained in:
Alejandro Celaya 2024-03-27 19:08:06 +01:00 committed by GitHub
commit 14702063f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ final readonly class ShortUrlCreation implements TitleResolutionModelInterface
ShortUrlInputFilter::SHORT_CODE_LENGTH,
) ?? DEFAULT_SHORT_CODES_LENGTH,
apiKey: $inputFilter->getValue(ShortUrlInputFilter::API_KEY),
tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS),
tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS) ?? [],
title: $inputFilter->getValue(ShortUrlInputFilter::TITLE),
crawlable: $inputFilter->getValue(ShortUrlInputFilter::CRAWLABLE),
forwardQuery: getOptionalBoolFromInputFilter($inputFilter, ShortUrlInputFilter::FORWARD_QUERY) ?? true,

View File

@ -60,7 +60,7 @@ final readonly class ShortUrlEdition implements TitleResolutionModelInterface
maxVisitsPropWasProvided: array_key_exists(ShortUrlInputFilter::MAX_VISITS, $data),
maxVisits: getOptionalIntFromInputFilter($inputFilter, ShortUrlInputFilter::MAX_VISITS),
tagsPropWasProvided: array_key_exists(ShortUrlInputFilter::TAGS, $data),
tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS),
tags: $inputFilter->getValue(ShortUrlInputFilter::TAGS) ?? [],
titlePropWasProvided: array_key_exists(ShortUrlInputFilter::TITLE, $data),
title: $inputFilter->getValue(ShortUrlInputFilter::TITLE),
crawlablePropWasProvided: array_key_exists(ShortUrlInputFilter::CRAWLABLE, $data),