(string) ($productId ?? 0)])) ?>

Puste pole = używana wartość globalna.

<?= $e((string) ($image['alt'] ?? '')) ?>
NO IMAGE