Skip to content

Commit

Permalink
refactor: fix phpmd warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine authored Oct 16, 2024
1 parent 9bf4d6a commit 5a28518
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
19 changes: 12 additions & 7 deletions tests/Mock/MockPsCountry.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ abstract class MockPsCountry extends ObjectModel
*/
public static function getByIso(string $isoCode, bool $active = false)
{
$found = self::firstWhere(['iso_code' => $isoCode]);
$wheres = ['iso_code' => $isoCode];

if ($active) {
$wheres[] = ['active' => true];
}

$found = self::firstWhere($wheres);

if (! $found) {
return false;
Expand All @@ -33,17 +39,16 @@ public static function getByIso(string $isoCode, bool $active = false)
}

/**
* @param int $id_zone
* @param int $id_lang
* @param int $zoneId
* @param int $langId
*
* @return array[]
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
* @see \CountryCore::getCountriesByZoneId()
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public static function getCountriesByZoneId(int $id_zone, int $id_lang): array
public static function getCountriesByZoneId(int $zoneId, int $langId): array
{
$ids = MockPsCountries::getCountriesByZoneId($id_zone);
$ids = MockPsCountries::getCountriesByZoneId($zoneId);

return array_map(static function (int $id) {
return (new static($id))->toArray();
Expand Down
5 changes: 2 additions & 3 deletions tests/Mock/MockPsOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
abstract class MockPsOrder extends ObjectModel
{
protected $hasCustomIdKey = true;
protected bool $hasCustomIdKey = true;

protected static function getTable(): string
{
Expand All @@ -35,8 +35,7 @@ public function getCurrentOrderState(): ?OrderState
* @param int|null $idEmployee
*
* @return bool
* @throws \PrestaShopDatabaseException
* @throws \PrestaShopException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function setCurrentState(int $state, int $idEmployee = null): bool
{
Expand Down

0 comments on commit 5a28518

Please sign in to comment.