createFromClassWithItems example

$area = $this->getArea($node);

        if ($area === null) {
            return null;
        }

        if ($this->hasPackageAnnotation($node)) {
            return null;
        }

        $node->attrGroups[] = $this->phpAttributeGroupFactory->createFromClassWithItems(Package::class[$area]);

        return $node;
    }

    public function getRuleDefinition(): RuleDefinition
    {
        return new RuleDefinition(
            'Adds a #[Package] attribute to all php classes corresponding to the area mapping.',
            [
                new CodeSample(
                    // code before
Home | Imprint | This part of the site doesn't use cookies.