Skip to content

Commit 8f08473

Browse files
committed
Fix PHPStan errors
1 parent 4b0e812 commit 8f08473

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

src/Controller/RenderRobotsTxtAction.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function __construct(
2222

2323
public function __invoke(): Response
2424
{
25-
/** @var ChannelInterface $channel */
2625
$channel = $this->channelContext->getChannel();
2726
Assert::isInstanceOf($channel, ChannelInterface::class);
2827

src/DataMapper/Product/OffersProductDataMapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,12 @@ public function map(ProductVariantInterface $productVariant, Product $product):
3333
return;
3434
}
3535

36-
/** @psalm-suppress InvalidArgument */
3736
$product->offers(
3837
Schema::offer()
3938
->url($this->productVariantUrlGenerator->generate($productVariant))
4039
->priceCurrency((string) $channel->getBaseCurrency()?->getCode())
4140
->price(formatAmount($channelPricing->getPrice()))
42-
->availability($this->availabilityChecker->isStockAvailable($productVariant) ? ItemAvailability::InStock : ItemAvailability::OutOfStock),
41+
->availability($this->availabilityChecker->isStockAvailable($productVariant) ? ItemAvailability::InStock : ItemAvailability::OutOfStock), // @phpstan-ignore argument.type
4342
);
4443
}
4544
}

src/EventSubscriber/StructuredData/AddItemListSubscriber.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,13 @@ public function populate(ResourceControllerEvent $event): void
4040
return;
4141
}
4242

43+
$data = $grid->getData();
44+
if (!is_iterable($data)) {
45+
return;
46+
}
47+
4348
$products = [];
44-
foreach ($grid->getData() as $productEntity) {
49+
foreach ($data as $productEntity) {
4550
if (!$productEntity instanceof ProductInterface) {
4651
continue;
4752
}

src/Form/Extension/ChannelTypeExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2222
]);
2323
}
2424

25-
public static function getExtendedTypes(): \Generator
25+
public static function getExtendedTypes(): iterable
2626
{
27-
yield ChannelType::class;
27+
return [ChannelType::class];
2828
}
2929
}

src/Resolver/CachedProductImagesResolver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
final class CachedProductImagesResolver implements ProductImagesResolverInterface
1010
{
11+
/** @var list<string>|null */
1112
private ?array $images = null;
1213

1314
public function __construct(private readonly ProductImagesResolverInterface $decorated)

src/Resources/functions.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77
use function Symfony\Component\String\u;
88

9-
/** @psalm-suppress UndefinedClass,MixedArgument */
10-
if (!\function_exists(formatAmount::class)) {
9+
if (!\function_exists('Setono\SyliusSEOPlugin\formatAmount')) {
1110
function formatAmount(?int $amount): float
1211
{
1312
if (null === $amount) {
@@ -18,8 +17,7 @@ function formatAmount(?int $amount): float
1817
}
1918
}
2019

21-
/** @psalm-suppress UndefinedClass,MixedArgument */
22-
if (!\function_exists(sanitizeString::class)) {
20+
if (!\function_exists('Setono\SyliusSEOPlugin\sanitizeString')) {
2321
function sanitizeString(?string $string, bool $stripTags = true, int $maxLength = null): ?string
2422
{
2523
if (null === $string) {

0 commit comments

Comments
 (0)