Skip to content

Commit

Permalink
More realistic types for action params, they can also be arrays of wh…
Browse files Browse the repository at this point in the history
…atever
  • Loading branch information
spaze committed Jan 18, 2025
1 parent f3ff675 commit 41ab924
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/src/Application/LinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function __construct(
/**
* Same as `Nette\Application\LinkGenerator::link()` but will always return just string, not string|null.
*
* @param array<int|string, string|null> $args
* @param array<array-key, mixed> $args
* @throws InvalidLinkException
*/
public function link(string $destination, array $args = [], ?NetteLinkGenerator $linkGenerator = null): string
Expand Down
10 changes: 5 additions & 5 deletions app/src/Application/Locale/LocaleLinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(
* Generates localized URLs.
*
* @param string $destination destination in format "[[[module:]presenter:]action] [#fragment]"
* @param array<string, list<string>|array<string, string|null>> $params of locale => [position|name => value]
* @param array<string, list<string>|array<array-key, mixed>> $params of locale => [position|name => value]
* @return array<string, LocaleLink> of locale => URL
* @throws InvalidLinkException
*/
Expand Down Expand Up @@ -70,8 +70,8 @@ public function links(string $destination, array $params = []): array
/**
* Return default params for all locales.
*
* @param array<string, string|null> $params
* @return array<string, array<string, string|null>>
* @param array<array-key, mixed> $params
* @return array<string, array<array-key, mixed>>
*/
public function defaultParams(array $params): array
{
Expand Down Expand Up @@ -114,9 +114,9 @@ public function allLinks(string $destination, array $params = []): array


/**
* @param array<string, list<string>|array<string, string|null>> $params
* @param array<string, list<string>|array<array-key, mixed>> $params
* @param string $locale
* @return list<string>|array<string, string|null>
* @return list<string>|array<array-key, mixed>
*/
private function getParams(array $params, string $locale): array
{
Expand Down
4 changes: 2 additions & 2 deletions app/src/Training/TrainingLocales.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function getLocaleActions(string $action): array
/**
* Translated locale parameters for trainings.
*
* @param array<string, string|null> $defaultParams
* @return array<string, array<string, string|null>>
* @param array<array-key, mixed> $defaultParams
* @return array<string, array<array-key, mixed>>
*/
public function getLocaleLinkParams(?string $trainingAction, array $defaultParams): array
{
Expand Down
4 changes: 2 additions & 2 deletions app/src/Www/Presenters/BasePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ protected function getLocaleLinksGeneratorDestination(): string


/**
* @return array<string, array<string, string|null>>
* @return array<string, array<array-key, mixed>>
*/
protected function getLocaleLinksGeneratorParams(): array
{
Expand Down Expand Up @@ -153,7 +153,7 @@ protected function getLocaleLinkAction(): string
/**
* Default parameters for locale links.
*
* @return array<string, array<string, string|null>>
* @return array<string, array<array-key, mixed>>
*/
protected function getLocaleLinkParams(): array
{
Expand Down
2 changes: 1 addition & 1 deletion app/src/Www/Presenters/CompanyTrainingsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function actionTraining(string $name): void
/**
* Translated locale parameters for trainings.
*
* @return array<string, array<string, string|null>>
* @return array<string, array<array-key, mixed>>
*/
#[Override]
protected function getLocaleLinkParams(): array
Expand Down
2 changes: 1 addition & 1 deletion app/src/Www/Presenters/ErrorPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ protected function getLocaleLinkAction(): string
/**
* Get original parameters for locale links.
*
* @return array<string, array<string, string|null>>
* @return array<string, array<array-key, mixed>>
* @throws NoOriginalRequestException
*/
#[Override]
Expand Down
2 changes: 1 addition & 1 deletion app/src/Www/Presenters/TrainingsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ protected function createComponentOtherUpcomingDatesList(): UpcomingTrainingDate
/**
* Translated locale parameters for trainings.
*
* @return array<string, array<string, string|null>>
* @return array<string, array<array-key, mixed>>
*/
#[Override]
protected function getLocaleLinkParams(): array
Expand Down

0 comments on commit 41ab924

Please sign in to comment.