getProductArea example

/** * @param InClassNode $node * * @return array<array-key, RuleError|string> */
    public function processNode(Node $node, Scope $scope): array
    {
        if ($this->isTestClass($node)) {
            return [];
        }

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

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

        return [sprintf('This class is missing the "#[Package(...)]" attribute (recommendation: %s)', $area ?? 'unknown')];
    }

    private function getProductArea(InClassNode $node): ?string
    {
        $namespace = $node->getClassReflection()->getName();

        
Home | Imprint | This part of the site doesn't use cookies.