Skip to content

Commit 06e36c5

Browse files
committed
Leverage non-capturing catches
1 parent a81c965 commit 06e36c5

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

Command/DebugCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7171
foreach ($this->getResourcesByPath($class) as $class) {
7272
$this->dumpValidatorsForClass($input, $output, $class);
7373
}
74-
} catch (DirectoryNotFoundException $exception) {
74+
} catch (DirectoryNotFoundException) {
7575
$io = new SymfonyStyle($input, $output);
7676
$io->error(sprintf('Neither class nor path were found with "%s" argument.', $input->getArgument('class')));
7777

Constraints/AbstractComparisonValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function validate(mixed $value, Constraint $constraint)
7171

7272
try {
7373
$comparedValue = new $dateTimeClass($comparedValue);
74-
} catch (\Exception $e) {
74+
} catch (\Exception) {
7575
throw new ConstraintDefinitionException(sprintf('The compared value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $comparedValue, $dateTimeClass, get_debug_type($constraint)));
7676
}
7777
}

Constraints/RangeValidator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function validate(mixed $value, Constraint $constraint)
7575

7676
try {
7777
$min = new $dateTimeClass($min);
78-
} catch (\Exception $e) {
78+
} catch (\Exception) {
7979
throw new ConstraintDefinitionException(sprintf('The min value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $min, $dateTimeClass, get_debug_type($constraint)));
8080
}
8181
}
@@ -85,7 +85,7 @@ public function validate(mixed $value, Constraint $constraint)
8585

8686
try {
8787
$max = new $dateTimeClass($max);
88-
} catch (\Exception $e) {
88+
} catch (\Exception) {
8989
throw new ConstraintDefinitionException(sprintf('The max value "%s" could not be converted to a "%s" instance in the "%s" constraint.', $max, $dateTimeClass, get_debug_type($constraint)));
9090
}
9191
}
@@ -192,7 +192,7 @@ private function isParsableDatetimeString(mixed $boundary): bool
192192

193193
try {
194194
new \DateTime($boundary);
195-
} catch (\Exception $e) {
195+
} catch (\Exception) {
196196
return false;
197197
}
198198

Constraints/TimezoneValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private static function getPhpTimezones(int $zone, string $countryCode = null):
8080
if (null !== $countryCode) {
8181
try {
8282
return @\DateTimeZone::listIdentifiers($zone, $countryCode) ?: [];
83-
} catch (\ValueError $e) {
83+
} catch (\ValueError) {
8484
return [];
8585
}
8686
}
@@ -97,7 +97,7 @@ private static function getIntlTimezones(int $zone, string $countryCode = null):
9797
if (null !== $countryCode) {
9898
try {
9999
return Timezones::forCountryCode($countryCode);
100-
} catch (MissingResourceException $e) {
100+
} catch (MissingResourceException) {
101101
return [];
102102
}
103103
}

Mapping/PropertyMetadata.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getPropertyValue(mixed $object): mixed
6262

6363
try {
6464
return $reflProperty->getValue($object);
65-
} catch (\Error $e) {
65+
} catch (\Error) {
6666
return null;
6767
}
6868
}

0 commit comments

Comments
 (0)