Skip to content

Commit

Permalink
Update packages (#303)
Browse files Browse the repository at this point in the history
 - nette/application updated from v3.2.1 to v3.2.3 patch
   See changes: nette/application@v3.2.1...v3.2.3
   Release notes: https://github.com/nette/application/releases/tag/v3.2.3

 - nette/bootstrap updated from v3.2.2 to v3.2.3 patch
   See changes: nette/bootstrap@v3.2.2...v3.2.3
   Release notes: https://github.com/nette/bootstrap/releases/tag/v3.2.3

 - paragonie/halite updated from v5.1.0 to v5.1.1 patch
   See changes: paragonie/halite@v5.1.0...v5.1.1
   Release notes: https://github.com/paragonie/halite/releases/tag/v5.1.1

 - phpstan/phpstan updated from 1.10.66 to 1.10.67 patch
   See changes: phpstan/phpstan@1.10.66...1.10.67
   Release notes: https://github.com/phpstan/phpstan/releases/tag/1.10.67

 - roave/security-advisories updated from dev-latest@31f3738 to dev-latest@a6fb2a7
   See changes: Roave/SecurityAdvisories@31f3738...a6fb2a7

 - shipmonk/composer-dependency-analyser updated from 1.4.0 to 1.5.2 minor
   See changes: shipmonk-rnd/composer-dependency-analyser@1.4.0...1.5.2
   Release notes: https://github.com/shipmonk-rnd/composer-dependency-analyser/releases/tag/1.5.2

 - spaze/phpstan-disallowed-calls updated from v3.1.2 to v3.2.0 minor
   See changes: spaze/phpstan-disallowed-calls@v3.1.2...v3.2.0
   Release notes: https://github.com/spaze/phpstan-disallowed-calls/releases/tag/v3.2.0
  • Loading branch information
spaze authored Apr 21, 2024
2 parents b006b06 + 5a874f7 commit e411b43
Show file tree
Hide file tree
Showing 80 changed files with 2,565 additions and 1,416 deletions.
7 changes: 0 additions & 7 deletions site/app/Application/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

namespace MichalSpacekCz\Application;

use MichalSpacekCz\ShouldNotHappenException;
use Nette\Application\BadRequestException;
use Nette\Application\Helpers;
use Nette\Application\Request;
Expand All @@ -28,12 +27,6 @@ public function response(Request $request): Response

if ($e instanceof BadRequestException) {
[$module, , $sep] = Helpers::splitName($request->getPresenterName());
if (!is_string($module)) {
throw new ShouldNotHappenException(sprintf('Module should be a string, %s provided', get_debug_type($module)));
}
if (!is_string($sep)) {
throw new ShouldNotHappenException(sprintf('Separator should be a string, %s provided', get_debug_type($sep)));
}
return new ForwardResponse($request->setPresenterName($module . $sep . 'Error'));
}

Expand Down
34 changes: 34 additions & 0 deletions site/app/Application/LinkGenerator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
declare(strict_types = 1);

namespace MichalSpacekCz\Application;

use MichalSpacekCz\ShouldNotHappenException;
use Nette\Application\LinkGenerator as NetteLinkGenerator;
use Nette\Application\UI\InvalidLinkException;

readonly class LinkGenerator
{

public function __construct(
private NetteLinkGenerator $linkGenerator,
) {
}


/**
* Same as `Nette\Application\LinkGenerator::link()` but will always return just string, not string|null.
*
* @param array<int|string, string|null> $args
* @throws InvalidLinkException
*/
public function link(string $destination, array $args = [], ?NetteLinkGenerator $linkGenerator = null): string
{
$link = ($linkGenerator ?? $this->linkGenerator)->link($destination, $args);
if ($link === null) {
throw new ShouldNotHappenException('Link should be a string, null returned');
}
return $link;
}

}
7 changes: 4 additions & 3 deletions site/app/Application/Locale/LocaleLinkGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
namespace MichalSpacekCz\Application\Locale;

use Contributte\Translation\Translator;
use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\Application\Routing\RouterFactory;
use MichalSpacekCz\ShouldNotHappenException;
use Nette\Application\IPresenterFactory;
use Nette\Application\LinkGenerator;
use Nette\Application\LinkGenerator as NetteLinkGenerator;
use Nette\Application\Routers\RouteList;
use Nette\Application\UI\InvalidLinkException;
use Nette\Http\IRequest;
Expand Down Expand Up @@ -52,12 +53,12 @@ public function links(string $destination, array $params = []): array
throw new ShouldNotHappenException(sprintf("The presenter should be a '%s' but it's a %s", RouteList::class, get_debug_type($router)));
}
if (count($router->getRouters())) {
$linkGenerator = new LinkGenerator($router, $this->httpRequest->getUrl(), $this->presenterFactory);
$linkGenerator = new NetteLinkGenerator($router, $this->httpRequest->getUrl(), $this->presenterFactory);
$links[$locale] = new LocaleLink(
$locale,
$this->languages[$locale]['code'],
$this->languages[$locale]['name'],
$linkGenerator->link($destination, $this->getParams($params, $locale)),
$this->linkGenerator->link($destination, $this->getParams($params, $locale), $linkGenerator),
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion site/app/Articles/Blog/BlogPostFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Contributte\Translation\Translator;
use DateTime;
use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\Application\Locale\LocaleLinkGenerator;
use MichalSpacekCz\DateTime\Exceptions\InvalidTimezoneException;
use MichalSpacekCz\Formatter\TexyFormatter;
Expand All @@ -14,7 +15,6 @@
use MichalSpacekCz\Utils\Exceptions\JsonItemNotStringException;
use MichalSpacekCz\Utils\Exceptions\JsonItemsNotArrayException;
use MichalSpacekCz\Utils\JsonUtils;
use Nette\Application\LinkGenerator;
use Nette\Application\UI\InvalidLinkException;
use Nette\Database\Row;
use Nette\Utils\JsonException;
Expand Down
2 changes: 1 addition & 1 deletion site/app/Form/RegenerateTokensFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

namespace MichalSpacekCz\Form;

use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\User\Manager;
use Nette\Application\LinkGenerator;
use Nette\Http\Session;
use Nette\Security\User;
use Nette\Utils\Html;
Expand Down
2 changes: 1 addition & 1 deletion site/app/Form/TalkFormFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

namespace MichalSpacekCz\Form;

use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\Application\Locale\Locales;
use MichalSpacekCz\Form\Controls\TrainingControlsFactory;
use MichalSpacekCz\Media\VideoThumbnails;
use MichalSpacekCz\Talks\Talk;
use MichalSpacekCz\Talks\Talks;
use Nette\Application\LinkGenerator;
use Nette\Forms\Controls\SubmitButton;
use Nette\Utils\Html;
use Nette\Utils\Strings;
Expand Down
2 changes: 1 addition & 1 deletion site/app/Tls/CertificatesApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

namespace MichalSpacekCz\Tls;

use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\Application\ServerEnv;
use MichalSpacekCz\DateTime\Exceptions\CannotParseDateTimeException;
use MichalSpacekCz\Http\Client\HttpClient;
use MichalSpacekCz\Http\Client\HttpClientRequest;
use MichalSpacekCz\Http\Exceptions\HttpClientRequestException;
use MichalSpacekCz\Tls\Exceptions\CertificatesApiException;
use Nette\Application\LinkGenerator;
use Nette\Application\UI\InvalidLinkException;
use Nette\Schema\Expect;
use Nette\Schema\Processor;
Expand Down
2 changes: 1 addition & 1 deletion site/app/User/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use DateTimeInterface;
use Exception;
use MichalSpacekCz\Application\LinkGenerator;
use MichalSpacekCz\Database\TypedDatabase;
use MichalSpacekCz\Http\Cookies\CookieName;
use MichalSpacekCz\Http\Cookies\Cookies;
Expand All @@ -13,7 +14,6 @@
use MichalSpacekCz\User\Exceptions\IdentityNotSimpleIdentityException;
use MichalSpacekCz\User\Exceptions\IdentityUsernameNotStringException;
use MichalSpacekCz\User\Exceptions\IdentityWithoutUsernameException;
use Nette\Application\LinkGenerator;
use Nette\Database\Explorer;
use Nette\Database\UniqueConstraintViolationException;
use Nette\Http\IRequest;
Expand Down
Loading

0 comments on commit e411b43

Please sign in to comment.