mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 11:33:49 +00:00
fixes for normalising accompanying periods in docgen context
This commit is contained in:
@@ -42,7 +42,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac
|
||||
throw new UnexpectedValueException('Object cannot be null or empty when format is json');
|
||||
}
|
||||
if ('docgen' === $format && !($object instanceof AccompanyingPeriodWork || null === $object)) {
|
||||
throw new UnexpectedValueException(sprintf('Object must be an instanceof AccompanyingPeriodWork or null when format is docgen, %s given', is_object($object) ? get_class($object) : gettype($object)));
|
||||
throw new UnexpectedValueException(sprintf('Object must be an instanceof AccompanyingPeriodWork or null when format is docgen, %s given', get_debug_type($object)));
|
||||
}
|
||||
|
||||
$cleanContext = array_filter($context, fn (string|int $key) => !in_array($key, ['docgen:expects', self::IGNORE_WORK], true), ARRAY_FILTER_USE_KEY);
|
||||
@@ -134,7 +134,7 @@ class AccompanyingPeriodWorkNormalizer implements ContextAwareNormalizerInterfac
|
||||
{
|
||||
return match ($format) {
|
||||
'json' => $data instanceof AccompanyingPeriodWork && ($context[self::IGNORE_WORK] ?? null) !== spl_object_hash($data),
|
||||
'docgen' => ($data instanceof AccompanyingPeriodWork || ($context['docgen:expects'] ?? null) === AccompanyingPeriodWork::class)
|
||||
'docgen' => ($data instanceof AccompanyingPeriodWork || (null === $data && ($context['docgen:expects'] ?? null) === AccompanyingPeriodWork::class))
|
||||
&& !array_key_exists(self::IGNORE_WORK, $context),
|
||||
default => false,
|
||||
};
|
||||
|
Reference in New Issue
Block a user