Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
odolbeau committed Nov 4, 2024
1 parent bd34462 commit e9388e3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/Form/Type/PhoneNumberType.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ public function getBlockPrefix(): string

private function formatDisplayChoice(string $displayType, string $regionName, string $regionCode, string $countryCode, bool $displayEmojiFlag): string
{
$formattedDisplay = \sprintf('%s (+%s)', $regionName, $countryCode);
$formattedDisplay = sprintf('%s (+%s)', $regionName, $countryCode);
if (self::DISPLAY_COUNTRY_SHORT === $displayType) {
$formattedDisplay = \sprintf('%s +%s', $regionCode, $countryCode);
$formattedDisplay = sprintf('%s +%s', $regionCode, $countryCode);
}

if ($displayEmojiFlag) {
Expand Down
8 changes: 4 additions & 4 deletions src/Serializer/Normalizer/PhoneNumberNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ public function __construct(PhoneNumberUtil $phoneNumberUtil, string $region = P
*
* @throws InvalidArgumentException
*/
public function normalize(mixed $object, ?string $format = null, array $context = []): string
public function normalize(mixed $object, string $format = null, array $context = []): string
{
return $this->phoneNumberUtil->format($object, $this->format);
}

/**
* @param array<mixed> $context
*/
public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool
public function supportsNormalization(mixed $data, string $format = null, array $context = []): bool
{
return $data instanceof PhoneNumber;
}
Expand All @@ -66,7 +66,7 @@ public function supportsNormalization(mixed $data, ?string $format = null, array
*
* @throws UnexpectedValueException
*/
public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): ?PhoneNumber
public function denormalize(mixed $data, string $type, string $format = null, array $context = []): ?PhoneNumber
{
if (null === $data) {
return null;
Expand All @@ -82,7 +82,7 @@ public function denormalize(mixed $data, string $type, ?string $format = null, a
/**
* @param array<mixed> $context
*/
public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool
public function supportsDenormalization(mixed $data, string $type, string $format = null, array $context = []): bool
{
return PhoneNumber::class === $type && \is_string($data);
}
Expand Down
12 changes: 6 additions & 6 deletions src/Validator/Constraints/PhoneNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ class PhoneNumber extends Constraint
*/
#[HasNamedArguments]
public function __construct(
?int $format = null,
string|array|null $type = null,
?string $defaultRegion = null,
?string $regionPath = null,
?string $message = null,
?array $groups = null,
int $format = null,
string|array $type = null,
string $defaultRegion = null,
string $regionPath = null,
string $message = null,
array $groups = null,
$payload = null,
array $options = []
) {
Expand Down
4 changes: 2 additions & 2 deletions src/Validator/Constraints/PhoneNumberValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class PhoneNumberValidator extends ConstraintValidator
private int $format;

public function __construct(
?PhoneNumberUtil $phoneUtil = null,
PhoneNumberUtil $phoneUtil = null,
string $defaultRegion = PhoneNumberUtil::UNKNOWN_REGION,
int $format = PhoneNumberFormat::INTERNATIONAL
) {
Expand Down Expand Up @@ -144,7 +144,7 @@ private function getRegion(PhoneNumberConstraint $constraint): string
try {
$defaultRegion = $this->getPropertyAccessor()->getValue($object, $path);
} catch (NoSuchPropertyException $e) {
throw new ConstraintDefinitionException(\sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
throw new ConstraintDefinitionException(sprintf('Invalid property path "%s" provided to "%s" constraint: ', $path, get_debug_type($constraint)).$e->getMessage(), 0, $e);
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/Validator/Constraints/PhoneNumberValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ protected function setUp(): void
public function testValidate(
string|LibPhoneNumber|null $value,
bool $violates,
array|string|null $type = null,
?string $defaultRegion = null,
?string $regionPath = null,
?int $format = null
array|string $type = null,
string $defaultRegion = null,
string $regionPath = null,
int $format = null
): void {
$constraint = new PhoneNumber($format, $type, $defaultRegion, $regionPath);

Expand Down

0 comments on commit e9388e3

Please sign in to comment.