Skip to content

Commit

Permalink
Remove always true/false occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Oct 23, 2024
1 parent 04cf304 commit 73c00ef
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function reverseTransform(mixed $value): ?\DateInterval
'P%sY%sM%sWT%sH%sM%sS',
empty($value['years']) ? '0' : $value['years'],
empty($value['months']) ? '0' : $value['months'],
empty($value['weeks']) ? '0' : $value['weeks'],
$value['weeks'],
empty($value['hours']) ? '0' : $value['hours'],
empty($value['minutes']) ? '0' : $value['minutes'],
empty($value['seconds']) ? '0' : $value['seconds']
Expand Down
4 changes: 1 addition & 3 deletions Extension/Core/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,8 @@ public function configureOptions(OptionsResolver $resolver): void

$choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) {
if (\is_array($choiceTranslationDomain)) {
$default = false;

return array_replace(
['year' => $default, 'month' => $default, 'day' => $default],
['year' => false, 'month' => false, 'day' => false],
$choiceTranslationDomain
);
}
Expand Down
4 changes: 1 addition & 3 deletions Extension/Core/Type/TimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ public function configureOptions(OptionsResolver $resolver): void

$choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) {
if (\is_array($choiceTranslationDomain)) {
$default = false;

return array_replace(
['hour' => $default, 'minute' => $default, 'second' => $default],
['hour' => false, 'minute' => false, 'second' => false],
$choiceTranslationDomain
);
}
Expand Down
4 changes: 1 addition & 3 deletions Extension/Core/Type/WeekType.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ public function configureOptions(OptionsResolver $resolver): void

$choiceTranslationDomainNormalizer = static function (Options $options, $choiceTranslationDomain) {
if (\is_array($choiceTranslationDomain)) {
$default = false;

return array_replace(
['year' => $default, 'week' => $default],
['year' => false, 'week' => false],
$choiceTranslationDomain
);
}
Expand Down
2 changes: 1 addition & 1 deletion Extension/Validator/Constraints/FormValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function validate(mixed $form, Constraint $formConstraint): void
// Validate the data against its own constraints
$validateDataGraph = $form->isRoot()
&& (\is_object($data) || \is_array($data))
&& (($groups && \is_array($groups)) || ($groups instanceof GroupSequence && $groups->groups))
&& (\is_array($groups) || ($groups instanceof GroupSequence && $groups->groups))
;

// Validate the data against the constraints defined in the form
Expand Down

0 comments on commit 73c00ef

Please sign in to comment.