Skip to content

Commit

Permalink
chore: Psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderlee committed Feb 7, 2024
1 parent 16aed3c commit 7dac489
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Collection/ImmutableCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function add($element)
throw new \LogicException(\sprintf('Method %s is not available on immutable collections', __FUNCTION__));
}

public function offsetSet(mixed $key, mixed $value): void
public function offsetSet(mixed $offset, mixed $value): void
{
throw new \LogicException(\sprintf('Method %s is not available on immutable collections', __FUNCTION__));
}
Expand Down
5 changes: 3 additions & 2 deletions src/Value/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;
use Doctrine\ORM\Mapping\Embedded;
use MyOnlineStore\Common\Domain\Exception\InvalidArgument;

/** @psalm-immutable */
Expand All @@ -13,11 +14,11 @@ final class Locale
public const FALLBACK_FRONTEND_LOCALE = 'en_GB';

/** @var RegionCode */
#[Embedded(class: 'MyOnlineStore\Common\Domain\Value\RegionCode', columnPrefix: false)]
#[Embedded(class: RegionCode::class, columnPrefix: false)]
private $regionCode;

/** @var LanguageCode */
#[Embedded(class: 'MyOnlineStore\Common\Domain\Value\LanguageCode', columnPrefix: false)]
#[Embedded(class: LanguageCode::class, columnPrefix: false)]
private $languageCode;

public function __construct(LanguageCode $languageCode, RegionCode $regionCode)
Expand Down
3 changes: 3 additions & 0 deletions src/Value/Location/Address/Street.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;
use Doctrine\ORM\Mapping\Embedded;
use MyOnlineStore\Common\Domain\Exception\InvalidArgument;

/** @psalm-immutable */
Expand Down Expand Up @@ -57,6 +58,7 @@ public static function fromSingleLine(string $streetAddress): self

public function equals(self $operand): bool
{
/** @palm-supress RiskyTruthyFalsyComparison */
return $this->name->equals($operand->name) &&
$this->number->equals($operand->number) &&
$this->suffix === $operand->suffix;
Expand All @@ -79,6 +81,7 @@ public function getSuffix(): StreetSuffix | null

public function __toString(): string
{
/** @palm-supress RiskyTruthyFalsyComparison */
return \trim(\sprintf('%s %s %s', $this->name, $this->number, $this->suffix ?: ''));

Check failure on line 85 in src/Value/Location/Address/Street.php

View workflow job for this annotation

GitHub Actions / Test (8.1)

RiskyTruthyFalsyComparison

src/Value/Location/Address/Street.php:85:71: RiskyTruthyFalsyComparison: Operand of type null|string contains type string, which can be falsy and truthy. This can cause possibly unexpected behavior. Use strict comparison instead. (see https://psalm.dev/356)
}
}
1 change: 1 addition & 0 deletions src/Value/Money/Money.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;
use Doctrine\ORM\Mapping\Embedded;
use MyOnlineStore\Common\Domain\Value\Arithmetic\Amount;

/** @psalm-immutable */
Expand Down
1 change: 1 addition & 0 deletions src/Value/Person/Name.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;
use Doctrine\ORM\Mapping\Embedded;
use MyOnlineStore\Common\Domain\Value\Person\Name\FirstName;
use MyOnlineStore\Common\Domain\Value\Person\Name\LastName;

Expand Down

0 comments on commit 7dac489

Please sign in to comment.