Skip to content

Commit

Permalink
Fix psalm (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Jan 24, 2022
1 parent f4b64af commit 4e66991
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ValueHandler/ChannelPricingValueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
use Webgriffe\SyliusAkeneoPlugin\ValueHandlerInterface;
use Webmozart\Assert\Assert;

final class ChannelPricingValueHandler implements ValueHandlerInterface
{
Expand Down
4 changes: 4 additions & 0 deletions src/ValueHandler/MetricPropertyValueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function __construct(
public function supports($subject, string $attribute, array $value): bool
{
if (!array_key_exists(0, $value) ||
!is_array($value[0]) ||
!array_key_exists('data', $value[0])
) {
return false;
Expand All @@ -56,6 +57,7 @@ public function supports($subject, string $attribute, array $value): bool
$metricValueData = $value[0]['data'];
if (
$metricValueData !== null && (
!is_array($value[0]['data']) ||
!array_key_exists('amount', $value[0]['data']) ||
!array_key_exists('unit', $value[0]['data']) ||
!is_string($value[0]['data']['amount']) ||
Expand Down Expand Up @@ -87,6 +89,7 @@ public function handle($subject, string $attribute, array $value): void
$hasBeenSet = false;

if (!array_key_exists(0, $value) ||
!is_array($value[0]) ||
!array_key_exists('data', $value[0])
) {
throw new \InvalidArgumentException('Invalid data argument');
Expand All @@ -95,6 +98,7 @@ public function handle($subject, string $attribute, array $value): void
$metricValueData = $value[0]['data'];
if (
$metricValueData !== null && (
!is_array($value[0]['data']) ||
!array_key_exists('amount', $value[0]['data']) ||
!array_key_exists('unit', $value[0]['data']) ||
!is_string($value[0]['data']['amount']) ||
Expand Down

0 comments on commit 4e66991

Please sign in to comment.