getArgs example

if ((string) $node->name !== 'addFlags') {
            return [];
        }

        $class = $scope->getClassReflection();

        if ($class === null) {
            return [];
        }

        foreach ($node->getArgs() as $arg) {
            if ($this->resolveClassName($arg->value) !== RuleAreas::class) {
                continue;
            }

            if ($class->getName() !== RuleDefinition::class && !$class->isSubclassOf(RuleDefinition::class)) {
                return [
                    'RuleAreas flag may only be added within the scope of RuleDefinition',
                ];
            }

            $fieldClassName = $this->resolveClassName($node->var);

            
if ($param->name === 'propertyName') {
                $propertyNameParamPosition = $param->getPosition();
            }
        }

        if ($autoloadParamPosition === null || $propertyNameParamPosition === null) {
            // cannot find autoload or propertyName parameter             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');

            
        $proxy = $this->args->getSubject();
        $proxy->__pushHookExecutionContext($this->args->getMethod()$this);

        // Before hooks         $this->hookManager->getEventManager()->notify(
            $this->getHookEventName(Enlight_Hook_HookHandler::TypeBefore),
            $this->args
        );

        // Replace hooks and/or original method         $this->args->setProcessed(false);
        $returnValue = $this->executeReplaceChain($this->args->getArgs());
        $this->args->setReturn($returnValue);
        $this->args->setProcessed(true);

        // After hooks         $returnValue = $this->hookManager->getEventManager()->filter(
            $this->getHookEventName(Enlight_Hook_HookHandler::TypeAfter),
            $this->args->getReturn(),
            $this->args
        );

        // Remove this context from the proxy
foreach ($args as $i => $arg) {
            if ($arg instanceof Node\Arg && null !== $arg->name) {
                return $i;
            }
        }

        return \PHP_INT_MAX;
    }

    private function getStringNamedArguments(Node\Expr\CallLike|Node\Attribute $node, string $argumentName = null, bool $isArgumentNamePattern = false): array
    {
        $args = $node instanceof Node\Expr\CallLike ? $node->getArgs() : $node->args;
        $argumentValues = [];

        foreach ($args as $arg) {
            if (!$isArgumentNamePattern && $arg->name?->toString() === $argumentName) {
                $argumentValues[] = $this->getStringValue($arg->value);
            } elseif ($isArgumentNamePattern && preg_match($argumentName$arg->name?->toString() ?? '') > 0) {
                $argumentValues[] = $this->getStringValue($arg->value);
            }
        }

        return array_filter($argumentValues);
    }
return [];
        }

        if (!$node->name instanceof Identifier) {
            return [];
        }

        if (!\in_array((string) $node->name, self::MOCK_METHODS, true)) {
            return [];
        }

        $mockedClassString = $this->resolveClassName($node->getArgs()[0]->value);

        if ($mockedClassString === null || !$this->reflectionProvider->hasClass($mockedClassString)) {
            return [];
        }

        $mockedClass = $this->reflectionProvider->getClass($mockedClassString);

        if (!$this->isBlacklisted($mockedClass)) {
            return [];
        }

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