Skip to content

Commit bf9d7bc

Browse files
committed
Delete the part that is always true.
1 parent 3376c11 commit bf9d7bc

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

webapp/src/Form/Type/SubmitProblemPasteType.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,24 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
7575
$form = $context->getRoot();
7676
/** @var Language $language */
7777
$language = $form->get('language')->getData();
78-
if ($language) {
79-
$langId = strtolower($language->getExtensions()[0]);
80-
if ($language->getRequireEntryPoint() && empty($value)) {
81-
$message = sprintf('%s required, but not specified',
82-
$language->getEntryPointDescription() ?: 'Entry point');
83-
$context
84-
->buildViolation($message)
85-
->atPath('entry_point')
86-
->addViolation();
87-
}
78+
$langId = strtolower($language->getExtensions()[0]);
79+
if ($language->getRequireEntryPoint() && empty($value)) {
80+
$message = sprintf('%s required, but not specified',
81+
$language->getEntryPointDescription() ?: 'Entry point');
82+
$context
83+
->buildViolation($message)
84+
->atPath('entry_point')
85+
->addViolation();
86+
}
8887

89-
if (in_array($langId, ['java', 'kt']) && empty($value)) {
90-
$message = sprintf('%s is required for %s language, but not specified',
91-
$language->getEntryPointDescription() ?: 'Entry point',
92-
ucfirst($langId));
93-
$context
94-
->buildViolation($message)
95-
->atPath('entry_point')
96-
->addViolation();
97-
}
88+
if (in_array($langId, ['java', 'kt']) && empty($value)) {
89+
$message = sprintf('%s is required for %s language, but not specified',
90+
$language->getEntryPointDescription() ?: 'Entry point',
91+
ucfirst($langId));
92+
$context
93+
->buildViolation($message)
94+
->atPath('entry_point')
95+
->addViolation();
9896
}
9997
}),
10098
]

0 commit comments

Comments
 (0)