Skip to content

Commit

Permalink
PHPStan Latte level 5 (#173)
Browse files Browse the repository at this point in the history
* Change action `$param` type to int where possible
* Work around efabrica-team/phpstan-latte#396

Ref #141
  • Loading branch information
spaze authored Jul 14, 2023
2 parents 45373be + c459e04 commit dad965c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions site/app/Admin/Presenters/ReviewsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public function actionDefault(): void
}


public function actionTraining(string $param): void
public function actionTraining(int $param): void
{
$training = $this->trainings->getById((int)$param);
$training = $this->trainings->getById($param);

$this->template->pageTitle = 'Ohlasy na ' . $training->name;
$this->template->reviews = $this->trainingReviews->getAllReviews((int)$param);
$this->template->reviews = $this->trainingReviews->getAllReviews($param);
}

}
8 changes: 4 additions & 4 deletions site/app/Admin/Presenters/TalksPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function renderDefault(): void
}


public function actionTalk(string $param): void
public function actionTalk(int $param): void
{
try {
$this->talk = $this->talks->getById((int)$param);
$this->talk = $this->talks->getById($param);
} catch (TalkDoesNotExistException $e) {
throw new BadRequestException($e->getMessage(), previous: $e);
}
Expand All @@ -62,10 +62,10 @@ public function actionTalk(string $param): void
}


public function actionSlides(string $param): void
public function actionSlides(int $param): void
{
try {
$this->talk = $this->talks->getById((int)$param);
$this->talk = $this->talks->getById($param);
$this->slides = $this->talkSlides->getSlides($this->talk->getId(), $this->talk->getFilenamesTalkId());
} catch (ContentTypeException | TalkDoesNotExistException $e) {
throw new BadRequestException($e->getMessage(), previous: $e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<tr n:if="$i != 0"><td></td><td><small><a href="#newdisclosure-{$i}"><span>add {$i + 1}. disclosure</span><span class="hidden">cancel adding</span></a></small></td></tr>
<tbody id="newdisclosure-{$i}" n:class="$i != 0 ? hidden">
{formContainer new}
{formContainer $i}
{formContainer "$i"}
<tr><th>{label disclosure /}</th><td>{input disclosure}</td></tr>
<tr><th>{label url /}</th><td>{input url}</td></tr>
<tr><th>{label archive /}</th><td>{input archive}</td></tr>
Expand Down
2 changes: 1 addition & 1 deletion site/app/Admin/Presenters/templates/Talks/slides.latte
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{/formContainer}
{formContainer new}
{for $i = 0; $i < $newCount; $i++}
{formContainer $i}
{formContainer "$i"}
<tbody class="new-slide changed">
<tr>
<th class="right">Číslo</th>
Expand Down
2 changes: 1 addition & 1 deletion site/phpstan-latte-templates.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
tmpDir: /tmp/phpstan/michalspacek.cz-latte-templates
paths:
- app
level: 4
level: 5
latte:
engineBootstrap: app/PhpStan/latteEngine.php
presenterFactoryBootstrap: app/PhpStan/presenterFactory.php
Expand Down

0 comments on commit dad965c

Please sign in to comment.