Skip to content

Commit

Permalink
Fix newly discovered psalm issues
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteel committed May 4, 2023
1 parent d335b29 commit 30bc107
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
5 changes: 1 addition & 4 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
<files psalm-version="4.30.0@d0bc6e25d89f649e4f36a534f330f8bb4643dd69">
<file src="src/Event/WebhookEvent.php">
<MixedAssignment occurrences="2">
<code>$this-&gt;payload</code>
Expand All @@ -15,9 +15,6 @@
<MixedArrayAccess occurrences="1">
<code>$options['defaults'][$this-&gt;routeParams-&gt;reuseResultParams()]</code>
</MixedArrayAccess>
<MixedAssignment occurrences="1">
<code>$reuseResultParams</code>
</MixedAssignment>
</file>
<file src="src/Middleware/Container/ExpiredPreviewHandlerFactory.php">
<MixedArgument occurrences="1">
Expand Down
4 changes: 4 additions & 0 deletions src/LinkResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Prismic\UrlLink;
use Prismic\Value\Bookmark;

use function assert;
use function is_bool;

/** @psalm-suppress DeprecatedClass, DeprecatedMethod, DeprecatedProperty */
final class LinkResolver implements PrismicLinkResolver
{
Expand Down Expand Up @@ -95,6 +98,7 @@ private function url(DocumentLink $link, Route $route): string
{
$options = $route->getOptions();
$reuseResultParams = $options['defaults'][$this->routeParams->reuseResultParams()] ?? true;
assert(is_bool($reuseResultParams));

return $this->urlHelper->generate(
$route->getName(),
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/Middleware/DocumentResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testAnExceptionIsThrownWhenThereIsNoRouteResultAvailable(): void
{
$subject = new DocumentResolver($this->resolver);
$this->expectException(RequestError::class);
$this->expectDeprecationMessage('The request for /foo failed because the route result was not available.');
$this->expectExceptionMessage('The request for /foo failed because the route result was not available.');
$subject->process($this->request, $this->handler);
}

Expand Down
3 changes: 3 additions & 0 deletions test/Unit/Router/RouteMatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;

use function assert;

/** @psalm-suppress DeprecatedMethod */
class RouteMatcherTest extends TestCase
{
Expand Down Expand Up @@ -192,6 +194,7 @@ private function routeMatchingProvider(): array
private function loadRoutes(): void
{
foreach ($this->routeMatchingProvider() as $name => $defaults) {
assert($name !== '');
$route = $this->collector->get('/' . $name, $this->middleware, $name);
$route->setOptions(['defaults' => $defaults]);
}
Expand Down

0 comments on commit 30bc107

Please sign in to comment.