Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/CommandBus/Handler/DefaultParameterResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public function __construct(
) {
}

/** @return iterable<int, mixed> */
public function resolve(ReflectionMethod $method, object $command): iterable
{
foreach ($method->getParameters() as $index => $parameter) {
Expand All @@ -34,7 +33,7 @@ public function resolve(ReflectionMethod $method, object $command): iterable
}

try {
yield $this->container->get(self::serviceName($method, $parameter));
yield $this->container->get($this->serviceName($method, $parameter));
} catch (ContainerExceptionInterface $exception) {
throw ServiceNotResolvable::missingService(
$method->getDeclaringClass()->getName(),
Expand Down
2 changes: 1 addition & 1 deletion src/CommandBus/Handler/ParameterResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@

interface ParameterResolver
{
/** @return iterable<mixed> */
/** @return iterable<int, mixed> */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is technically a bc-break, but we are using the spread operator already on the result of ParameterResolver::resolve, which means it can be only be working with an int as the key. Also, we typed it like that in our concrete implementation https://github.com/patchlevel/event-sourcing/pull/856/changes#diff-fb59bb4d80adcd4ac904abb097ca2b9c8013a263a00117b936eaecc5f4d3a732L22

public function resolve(ReflectionMethod $method, object $command): iterable;
}
1 change: 0 additions & 1 deletion src/QueryBus/HandlerFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@
);
}

/** @var class-string $commandClass */

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getClassName is already typed as T of class-string

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan seems to not really pick it up 🤔

$commandClass = $type->getClassName();

yield new HandlerReference(
$commandClass,

Check failure on line 73 in src/QueryBus/HandlerFinder.php

View workflow job for this annotation

GitHub Actions / Mutation tests on diff (locked, 8.5, ubuntu-latest)

Parameter #1 $qu

Check failure on line 73 in src/QueryBus/HandlerFinder.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Parameter #1 $qu

Check failure on line 73 in src/QueryBus/HandlerFinder.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.5, ubuntu-latest)

Parameter #1 $queryClass of class Patchlevel\EventSourcing\QueryBus\HandlerReference constructor expects class-string, string given.
$reflectionMethod->getName(),
$reflectionMethod->isStatic(),
);
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Subscription/ErrorContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

$firstTrace = $error['trace'][0];

self::assertIsArray($firstTrace);

Check failure on line 46 in tests/Unit/Subscription/ErrorContextTest.php

View workflow job for this annotation

GitHub Actions / Mutation tests on diff (locked, 8.5, ubuntu-latest)

Ca

Check failure on line 46 in tests/Unit/Subscription/ErrorContextTest.php

View workflow job for this annotation

GitHub Actions / Mutation tests (locked, 8.5, ubuntu-latest)

Ca

Check failure on line 46 in tests/Unit/Subscription/ErrorContextTest.php

View workflow job for this annotation

GitHub Actions / Static Analysis by PHPStan (locked, 8.5, ubuntu-latest)

Call to static method PHPUnit\Framework\Assert::assertIsArray() with array{file?: string, line?: int, function?: string, class?: string, type?: string, args?: array<mixed>} will always evaluate to true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan seems to have a better type knowledge at this place then mago

self::assertArrayHasKey('file', $firstTrace);
self::assertSame(__FILE__, $firstTrace['file'] ?? null);
self::assertArrayHasKey('line', $firstTrace);
Expand Down
Loading