Skip to content

Commit 24d0cf6

Browse files
committed
Fix CS
1 parent 5135767 commit 24d0cf6

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

Form/EnumTypeGuesser.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ public function guessType($class, $property): ?TypeGuess
7373
$registeredEnumTypeFQCN = $this->registeredEnumTypes[$fieldType];
7474

7575
if (!\class_exists($registeredEnumTypeFQCN)) {
76-
throw new EnumTypeIsRegisteredButClassDoesNotExistException(\sprintf(
76+
$exceptionMessage = \sprintf(
7777
'ENUM type "%s" is registered as "%s", but that class does not exist',
7878
$fieldType,
7979
$registeredEnumTypeFQCN
80-
));
80+
);
81+
82+
throw new EnumTypeIsRegisteredButClassDoesNotExistException($exceptionMessage);
8183
}
8284

8385
if (!\is_subclass_of($registeredEnumTypeFQCN, AbstractEnumType::class)) {

Twig/Extension/EnumConstantTwigExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ public function getEnumConstant(string $enumConstant, ?string $enumType = null):
6363
}
6464

6565
if ($this->moreThanOneOccurrenceFound()) {
66-
throw new ConstantIsFoundInFewRegisteredEnumTypesException(
67-
\sprintf(
68-
'Constant "%s" is found in few registered ENUM types. You should manually set the appropriate one.',
69-
$enumConstant
70-
)
66+
$exceptionMessage = \sprintf(
67+
'Constant "%s" is found in few registered ENUM types. You should manually set the appropriate one.',
68+
$enumConstant
7169
);
70+
71+
throw new ConstantIsFoundInFewRegisteredEnumTypesException($exceptionMessage);
7272
}
7373

74-
throw new ConstantIsNotFoundInAnyRegisteredEnumTypeException(
75-
\sprintf(
76-
'Constant "%s" was not found in any registered ENUM type.',
77-
$enumConstant
78-
)
74+
$exceptionMessage = \sprintf(
75+
'Constant "%s" was not found in any registered ENUM type.',
76+
$enumConstant
7977
);
78+
79+
throw new ConstantIsNotFoundInAnyRegisteredEnumTypeException($exceptionMessage);
8080
}
8181

8282
throw $this->createNoRegisteredEnumTypesException();

Twig/Extension/ReadableEnumValueTwigExtension.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,20 @@ public function getReadableEnumValue(?string $enumValue, ?string $enumType = nul
6767
}
6868

6969
if ($this->moreThanOneOccurrenceFound()) {
70-
throw new ValueIsFoundInFewRegisteredEnumTypesException(
71-
\sprintf(
72-
'Value "%s" is found in few registered ENUM types. You should manually set the appropriate one',
73-
$enumValue
74-
)
70+
$exceptionMessage = \sprintf(
71+
'Value "%s" is found in few registered ENUM types. You should manually set the appropriate one',
72+
$enumValue
7573
);
74+
75+
throw new ValueIsFoundInFewRegisteredEnumTypesException($exceptionMessage);
7676
}
7777

78-
throw new ValueIsNotFoundInAnyRegisteredEnumTypeException(
79-
\sprintf(
80-
'Value "%s" was not found in any registered ENUM type.',
81-
$enumValue
82-
)
78+
$exceptionMessage = \sprintf(
79+
'Value "%s" was not found in any registered ENUM type.',
80+
$enumValue
8381
);
82+
83+
throw new ValueIsNotFoundInAnyRegisteredEnumTypeException($exceptionMessage);
8484
}
8585

8686
throw $this->createNoRegisteredEnumTypesException();

0 commit comments

Comments
 (0)