function Context::__construct
Same name in this branch
- 11.1.x vendor/open-telemetry/api/Instrumentation/AutoInstrumentation/Context.php \OpenTelemetry\API\Instrumentation\AutoInstrumentation\Context::__construct()
- 11.1.x vendor/open-telemetry/context/Context.php \OpenTelemetry\Context\Context::__construct()
- 11.1.x vendor/sebastian/recursion-context/src/Context.php \SebastianBergmann\RecursionContext\Context::__construct()
- 11.1.x vendor/phpdocumentor/type-resolver/src/Types/Context.php \phpDocumentor\Reflection\Types\Context::__construct()
- 11.1.x core/lib/Drupal/Core/Plugin/Context/Context.php \Drupal\Core\Plugin\Context\Context::__construct()
- 11.1.x core/lib/Drupal/Component/Plugin/Context/Context.php \Drupal\Component\Plugin\Context\Context::__construct()
Parameters
array<string, mixed> $context The common context to use when serializing or deserializing:
array<string, mixed> $normalizationContext The context to use when serializing:
array<string, mixed> $denormalizationContext The context to use when deserializing:
string|string[] $groups The groups to use when serializing or deserializing:
Throws
File
-
vendor/
symfony/ serializer/ Attribute/ Context.php, line 32
Class
- Context
- @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
Namespace
Symfony\Component\Serializer\AttributeCode
public function __construct(array $context = [], array $normalizationContext = [], array $denormalizationContext = [], string|array $groups = []) {
if (!$context && !$normalizationContext && !$denormalizationContext) {
throw new InvalidArgumentException(\sprintf('At least one of the "context", "normalizationContext", or "denormalizationContext" options must be provided as a non-empty array to "%s".', static::class));
}
$this->groups = (array) $groups;
foreach ($this->groups as $group) {
if (!\is_string($group)) {
throw new InvalidArgumentException(\sprintf('Parameter "groups" given to "%s" must be a string or an array of strings, "%s" given.', static::class, get_debug_type($group)));
}
}
}