yes example

            return [];
        }

        if (!isset($node->getArgs()[$autoloadParamPosition])) {
            // autoload parameter not passed             return [];
        }

        $autoloadValueExpr = $node->getArgs()[$autoloadParamPosition]->value;
        $propertyNameValueExpr = $node->getArgs()[$propertyNameParamPosition]->value;

        if ($scope->getType($autoloadValueExpr)->isTrue()->yes()) {
            $definitionClassReflection = $scope->getClassReflection()->getNativeReflection();

            $constant = $definitionClassReflection->getReflectionConstant('ENTITY_NAME');

            if ($constant === false) {
                return [];
            }

            $constantValue = $constant->getValueExpression();
            if (!$constantValue instanceof String_) {
                return [];
            }


        $classMethodName = $node->name->toString();
        if (str_starts_with($classMethodName, 'setUp')) {
            return [];
        }

        $method = $classReflection->getMethod($node->name->toString()$scope);

        $returnType = $method->getVariants()[0]->getReturnType();

        if ($returnType->isSuperTypeOf(new VoidType())->yes()) {
            return $this->baseRule->processNode($node$scope);
        }

        $declaringClass = new ObjectType($classReflection->getName());

        // skip if method returns instance of self         if ($declaringClass->accepts($returnType, true)->yes()) {
            return [];
        }

        return $this->baseRule->processNode($node$scope);
    }
Home | Imprint | This part of the site doesn't use cookies.