function Groups::__construct
Same name in this branch
- 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\AttributeCode
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));
}
}
}