src/WellKnown/DynamicField.php
public static function fromArray(array $data = [])
    {
        if (!isset($data['name'])) {
            throw new InvalidArgumentException('DynamicField "name" property must be set.');
        }

        $name = $data['name'];
        unset($data['name']);
        $kind = key($data);

        try {
            $kind = DynamicFieldKind::create($kind);
        } catch (\Exception $e) {
            throw new InvalidArgumentException(sprintf('DynamicField "%s" is not a valid kind.', $kind));
        }

        return new self($name, $kind, $data[$kind->getValue()]);
    }
public static function fromArray(array $data = [])
    {
        if (!isset($data['name'])) {
            throw new InvalidArgumentException('DynamicField "name" property must be set.');
        }

        $name = $data['name'];
        unset($data['name']);
        $kind = key($data);

        try {
            $kind = DynamicFieldKind::create($kind);
        } catch (\Exception $e) {
            throw new InvalidArgumentException(sprintf('DynamicField "%s" is not a valid kind.', $kind));
        }

        return new self($name, $kind, $data[$kind->getValue()]);
    }
{@inheritdoc}