MethodCall example

<<<'EXCEPTION' Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s. EXCEPTION
                    ,
                    $originalName,
                    $this->context,
                    self::$annotationMetadata[$name]['targets_literal']
                )
            );
        }

        $arguments = $this->MethodCall();
        $values    = $this->resolvePositionalValues($arguments$name);

        if (isset(self::$annotationMetadata[$name]['enum'])) {
            // checks all declared attributes             foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) {
                // checks if the attribute is a valid enumerator                 if (isset($values[$property]) && ! in_array($values[$property]$enum['value'])) {
                    throw AnnotationException::enumeratorError(
                        $property,
                        $name,
                        $this->context,
                        
// Next will be nested         $this->isNestedAnnotation = true;

        //if annotation does not support current target         if (=== (self::$annotationMetadata[$name]['targets'] & $target) && $target) {
            throw AnnotationException::semanticalError(
                sprintf('Annotation @%s is not allowed to be declared on %s. You may only use this annotation on these code elements: %s.',
                     $originalName$this->context, self::$annotationMetadata[$name]['targets_literal'])
            );
        }

        $values = $this->MethodCall();

        if (isset(self::$annotationMetadata[$name]['enum'])) {
            // checks all declared attributes             foreach (self::$annotationMetadata[$name]['enum'] as $property => $enum) {
                // checks if the attribute is a valid enumerator                 if (isset($values[$property]) && ! in_array($values[$property]$enum['value'])) {
                    throw AnnotationException::enumeratorError($property$name$this->context, $enum['literal']$values[$property]);
                }
            }
        }

        
public function isMethodSupported(MethodReflection $methodReflection, MethodCall $node, TypeSpecifierContext $context): bool
    {
        return (
            $methodReflection->getDeclaringClass()->getName() === Collection::class
            || $methodReflection->getDeclaringClass()->isSubclassOf(Collection::class)
        )
            && $methodReflection->getName() === 'has' && !$context->null();
    }

    public function specifyTypes(MethodReflection $methodReflection, MethodCall $node, Scope $scope, TypeSpecifierContext $context): SpecifiedTypes
    {
        $getExpr = new MethodCall($node->var, 'get', $node->args);

        $getterTypes = $this->typeSpecifier->create(
            $getExpr,
            TypeCombinator::removeNull($scope->getType($getExpr)),
            $context
        );

        return $getterTypes->unionWith(
            $this->typeSpecifier->create(
                $getExpr,
                new NullType(),
                
Home | Imprint | This part of the site doesn't use cookies.