Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Groups.php

function Groups::__construct

Same name in this branch
  1. 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/Groups.php \PHPUnit\TextUI\XmlConfiguration\Groups::__construct()

Parameters

string|string[] $groups The groups to define on the attribute target:

File

vendor/symfony/serializer/Attribute/Groups.php, line 30

Class

Groups
@author Kévin Dunglas <dunglas@gmail.com>

Namespace

Symfony\Component\Serializer\Attribute

Code

public function __construct(string|array $groups) {
    $this->groups = (array) $groups;
    if (!$this->groups) {
        throw new InvalidArgumentException(\sprintf('Parameter given to "%s" cannot be empty.', static::class));
    }
    foreach ($this->groups as $group) {
        if (!\is_string($group) || '' === $group) {
            throw new InvalidArgumentException(\sprintf('Parameter given to "%s" must be a string or an array of non-empty strings.', static::class));
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal