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

Breadcrumb

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

class Groups

Same name in this branch
  1. 11.1.x vendor/phpunit/phpunit/src/TextUI/Configuration/Xml/Groups.php \PHPUnit\TextUI\XmlConfiguration\Groups
  2. 11.1.x vendor/phpunit/phpunit/src/Metadata/Api/Groups.php \PHPUnit\Metadata\Api\Groups

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

Hierarchy

  • class \Symfony\Component\Serializer\Attribute\Groups

Expanded class hierarchy of Groups

1 file declares its use of Groups
AttributeLoader.php in vendor/symfony/serializer/Mapping/Loader/AttributeLoader.php
15 string references to 'Groups'
AttributeMetadata::__sleep in vendor/symfony/serializer/Mapping/AttributeMetadata.php
Returns the names of the properties that should be serialized.
Cascade::__construct in vendor/symfony/validator/Constraints/Cascade.php
Constraint::addImplicitGroupName in vendor/symfony/validator/Constraint.php
Adds the given group if this constraint is in the Default group.
Constraint::__get in vendor/symfony/validator/Constraint.php
Returns the value of a lazily initialized option.
Constraint::__isset in vendor/symfony/validator/Constraint.php

... See full list

File

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

Namespace

Symfony\Component\Serializer\Attribute
View source
class Groups {
    
    /**
     * @var string[]
     */
    private readonly array $groups;
    
    /**
     * @param string|string[] $groups The groups to define on the attribute target
     */
    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));
            }
        }
    }
    
    /**
     * @return string[]
     */
    public function getGroups() : array {
        return $this->groups;
    }

}

Members

Title Sort descending Modifiers Object type Summary
Groups::$groups private property
Groups::getGroups public function
Groups::__construct public function
RSS feed
Powered by Drupal