function AbstractNormalizer::validateCallbackContext
Validate callbacks set in context.
Parameters
string $contextType Used to specify which context is invalid in exceptions:
Throws
3 calls to AbstractNormalizer::validateCallbackContext()
- AbstractNormalizer::__construct in vendor/
symfony/ serializer/ Normalizer/ AbstractNormalizer.php - Sets the {@link ClassMetadataFactoryInterface} to use.
- AbstractObjectNormalizer::denormalize in vendor/
symfony/ serializer/ Normalizer/ AbstractObjectNormalizer.php - Denormalizes data back into an object of the given class.
- AbstractObjectNormalizer::normalize in vendor/
symfony/ serializer/ Normalizer/ AbstractObjectNormalizer.php - Normalizes data into a set of arrays/scalars.
File
-
vendor/
symfony/ serializer/ Normalizer/ AbstractNormalizer.php, line 510
Class
- AbstractNormalizer
- Normalizer implementation.
Namespace
Symfony\Component\Serializer\NormalizerCode
protected final function validateCallbackContext(array $context, string $contextType = '') : void {
if (!isset($context[self::CALLBACKS])) {
return;
}
if (!\is_array($context[self::CALLBACKS])) {
throw new InvalidArgumentException(\sprintf('The "%s"%s context option must be an array of callables.', self::CALLBACKS, '' !== $contextType ? " {$contextType}" : ''));
}
foreach ($context[self::CALLBACKS] as $attribute => $callback) {
if (!\is_callable($callback)) {
throw new InvalidArgumentException(\sprintf('Invalid callback found for attribute "%s" in the "%s"%s context option.', $attribute, self::CALLBACKS, '' !== $contextType ? " {$contextType}" : ''));
}
}
}