getVariants example

if ($classReflection === null) {
            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 [];
        }

        
$extension = $this->extensionLoader->loadFromArray(
            Context::createDefaultContext(),
            $listingResponse
        );

        static::assertNull($extension->getLocalId());
        static::assertNull($extension->getLicense());
        static::assertNull($extension->getVersion());
        static::assertEquals($listingResponse['name']$extension->getName());
        static::assertEquals($listingResponse['label']$extension->getLabel());

        static::assertInstanceOf(VariantCollection::class$extension->getVariants());
        static::assertInstanceOf(ImageCollection::class$extension->getImages());
        static::assertInstanceOf(BinaryCollection::class$extension->getBinaries());
    }

    public function testLoadsExtensionsFromListingArray(): void
    {
        $listingResponse = $this->getListingResponseFixture();

        $extensions = $this->extensionLoader->loadFromListingArray(
            Context::createDefaultContext(),
            $listingResponse
        );
Home | Imprint | This part of the site doesn't use cookies.