Skip to content

Commit 94ae289

Browse files
committed
added type hints (BC break)
1 parent 6a19533 commit 94ae289

File tree

3 files changed

+10
-20
lines changed

3 files changed

+10
-20
lines changed

src/Application/UI/Component.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,9 @@ public function isLinkCurrent(?string $destination = null, $args = []): bool
295295
* Redirect to another presenter, action or signal.
296296
* @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
297297
* @param array|mixed $args
298-
* @return never
299298
* @throws Nette\Application\AbortException
300299
*/
301-
public function redirect(string $destination, $args = []): void
300+
public function redirect(string $destination, $args = []): never
302301
{
303302
$args = func_num_args() < 3 && is_array($args)
304303
? $args
@@ -312,10 +311,9 @@ public function redirect(string $destination, $args = []): void
312311
* Permanently redirects to presenter, action or signal.
313312
* @param string $destination in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
314313
* @param array|mixed $args
315-
* @return never
316314
* @throws Nette\Application\AbortException
317315
*/
318-
public function redirectPermanent(string $destination, $args = []): void
316+
public function redirectPermanent(string $destination, $args = []): never
319317
{
320318
$args = func_num_args() < 3 && is_array($args)
321319
? $args

src/Application/UI/Presenter.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,8 @@ public function setLayout(string|bool $layout): static
498498

499499
/**
500500
* @throws Nette\Application\AbortException
501-
* @return never
502501
*/
503-
public function sendTemplate(?Template $template = null): void
502+
public function sendTemplate(?Template $template = null): never
504503
{
505504
$template ??= $this->getTemplate();
506505
if (!$template->getFile()) {
@@ -670,9 +669,8 @@ public function isAjax(): bool
670669
/**
671670
* Sends AJAX payload to the output.
672671
* @throws Nette\Application\AbortException
673-
* @return never
674672
*/
675-
public function sendPayload(): void
673+
public function sendPayload(): never
676674
{
677675
$this->sendResponse(new Responses\JsonResponse($this->getPayload()));
678676
}
@@ -681,9 +679,8 @@ public function sendPayload(): void
681679
/**
682680
* Sends JSON data to the output.
683681
* @throws Nette\Application\AbortException
684-
* @return never
685682
*/
686-
public function sendJson(mixed $data): void
683+
public function sendJson(mixed $data): never
687684
{
688685
$this->sendResponse(new Responses\JsonResponse($data));
689686
}
@@ -695,9 +692,8 @@ public function sendJson(mixed $data): void
695692
/**
696693
* Sends response and terminates presenter.
697694
* @throws Nette\Application\AbortException
698-
* @return never
699695
*/
700-
public function sendResponse(Application\Response $response): void
696+
public function sendResponse(Application\Response $response): never
701697
{
702698
$this->response = $response;
703699
$this->terminate();
@@ -707,9 +703,8 @@ public function sendResponse(Application\Response $response): void
707703
/**
708704
* Correctly terminates presenter.
709705
* @throws Nette\Application\AbortException
710-
* @return never
711706
*/
712-
public function terminate(): void
707+
public function terminate(): never
713708
{
714709
throw new Application\AbortException;
715710
}
@@ -719,9 +714,8 @@ public function terminate(): void
719714
* Forward to another presenter or action.
720715
* @param array|mixed $args
721716
* @throws Nette\Application\AbortException
722-
* @return never
723717
*/
724-
public function forward(string|Nette\Application\Request $destination, $args = []): void
718+
public function forward(string|Nette\Application\Request $destination, $args = []): never
725719
{
726720
if ($destination instanceof Application\Request) {
727721
$this->sendResponse(new Responses\ForwardResponse($destination));
@@ -738,9 +732,8 @@ public function forward(string|Nette\Application\Request $destination, $args = [
738732
/**
739733
* Redirect to another URL and ends presenter execution.
740734
* @throws Nette\Application\AbortException
741-
* @return never
742735
*/
743-
public function redirectUrl(string $url, ?int $httpCode = null): void
736+
public function redirectUrl(string $url, ?int $httpCode = null): never
744737
{
745738
if ($this->isAjax()) {
746739
$this->getPayload()->redirect = $url;

src/Bridges/ApplicationLatte/TemplateFactory.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ public function __construct(
3737
}
3838

3939

40-
/** @return Template */
41-
public function createTemplate(?UI\Control $control = null, ?string $class = null): UI\Template
40+
public function createTemplate(?UI\Control $control = null, ?string $class = null): Template
4241
{
4342
$class ??= $this->templateClass;
4443
if (!is_a($class, Template::class, allow_string: true)) {

0 commit comments

Comments
 (0)