Skip to content

Commit

Permalink
Fix RiskyTruthyFalsyComparison issues
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <[email protected]>
  • Loading branch information
gsteel committed Jan 22, 2024
1 parent 111cfc0 commit ef264f2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/PhoneNumberValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function type(): int
private static function regionCodeForNumber(LibPhoneNumber $number, ?string $givenCode): ?string
{
$dialingCode = $number->getCountryCode();
if (! $dialingCode) {
if ($dialingCode === null) {
return $givenCode;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Validator/PhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function setAllowedTypes(int $types): void
/** @param array<string, mixed> $validationContext */
private function resolveCountry(?array $validationContext): ?CountryCode
{
if (! is_array($validationContext) || ! $this->countryContext) {
if (! is_array($validationContext) || $this->countryContext === null) {
return $this->country;
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/PhoneNumberFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __invoke(): self
*/
private function coalesceCountryCode(?string $countryCodeOrLocale): CountryCode
{
$code = $countryCodeOrLocale ? CountryCode::tryFromString($countryCodeOrLocale) : null;
$code = $countryCodeOrLocale !== null ? CountryCode::tryFromString($countryCodeOrLocale) : null;

return $code ?? $this->defaultCountryCode;
}
Expand Down
4 changes: 2 additions & 2 deletions test/ProjectIntegrationTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ protected static function getContainer(array $userConfig = []): ContainerInterfa
$config = $aggregator->getMergedConfig();
$dependencies = $config['dependencies'] ?? [];
self::assertIsArray($dependencies);
/** @psalm-var ServiceManagerConfigurationType $dependencies */
unset($dependencies['services']['config']);
/** @psalm-suppress MixedArrayAssignment */
$dependencies['services']['config'] = $config;
/** @psalm-var ServiceManagerConfigurationType $dependencies */

return new Laminas\ServiceManager\ServiceManager($dependencies);
}
Expand Down

0 comments on commit ef264f2

Please sign in to comment.