Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit b1557d6

Browse files
committed
refactor: Simplify getParameter determination
1 parent 1dd27eb commit b1557d6

File tree

4 files changed

+2
-14
lines changed

4 files changed

+2
-14
lines changed

src/Controller/CommentsController.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ public function likes(
9999

100100
private function isCommentFeatureEnabled(): bool
101101
{
102-
$comment = $this->getParameter('app.features.comment');
103-
if (!\is_bool($comment)) {
104-
throw new \RuntimeException('The "app.features.comment" parameter must be a boolean.');
105-
}
106-
107-
return $comment;
102+
return $this->getParameter('app.features.comment');
108103
}
109104
}

src/Controller/ProfileController.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ class ProfileController extends AbstractController
2121
{
2222
public function isProfileEditable(): bool
2323
{
24-
$isProfileEditable = $this->getParameter('app.features.editable-profile');
25-
\assert(\is_bool($isProfileEditable));
26-
27-
return $isProfileEditable;
24+
return $this->getParameter('app.features.editable-profile');
2825
}
2926

3027
#[Route('/profile', name: 'app_profile')]

src/Twig/Components/Challenge/Comments/CommentForm.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ protected function instantiateForm(): FormInterface
5757
public function save(EntityManagerInterface $entityManager, ParameterBagInterface $parameterBag): void
5858
{
5959
$appFeatureComment = $parameterBag->get('app.features.comment');
60-
\assert(\is_bool($appFeatureComment));
61-
6260
if (!$appFeatureComment) {
6361
throw new BadRequestHttpException('Comment feature is disabled.');
6462
}

src/Twig/Components/Challenge/Instruction/Modal.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ public function instruct(
6767
ParameterBagInterface $parameterBag,
6868
): void {
6969
$appFeatureHint = $parameterBag->get('app.features.hint');
70-
\assert(\is_bool($appFeatureHint));
71-
7270
if (!$appFeatureHint) {
7371
throw new BadRequestHttpException('Hint feature is disabled.');
7472
}

0 commit comments

Comments
 (0)