Helper/VariantHelper.php
public function getVariants(ProductInterface $product) : array
    {
        $variants = [];
        
        $product->getVariants()->map(function (VariantInterface $variant) use (&$variants) {
            if ($variant->isEnabled()) {
                $this->extractVariantData($variant, $variants);
            }
        });
        
        return $variants;
    }
public function getVariants(ProductInterface $product) : array
    {
        $variants = [];
        
        $product->getVariants()->map(function (VariantInterface $variant) use (&$variants) {
            if ($variant->isEnabled()) {
                $this->extractVariantData($variant, $variants);
            }
        });
        
        return $variants;
    }
{@inheritdoc}