Skip to content

Commit f17c3f5

Browse files
committed
fix phpstan
1 parent e5bfe33 commit f17c3f5

5 files changed

Lines changed: 20 additions & 5 deletions

File tree

phpstan-baseline.neon

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ parameters:
102102
count: 1
103103
path: src/Store/TaggableDoctrineDbalStore.php
104104

105+
-
106+
message: '#^Parameter \#1 \$command of callable Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\BootHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\PauseHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\ReactivateHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\RefreshHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\RemoveHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\RunHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\SetupHandler\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Handler\\TeardownHandler expects Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Boot\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Pause\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Reactivate\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Refresh\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Remove\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Run\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Setup\|Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Teardown, Patchlevel\\EventSourcing\\Subscription\\Engine\\Command\\Command given\.$#'
107+
identifier: argument.type
108+
count: 1
109+
path: src/Subscription/Engine/NextSubscriptionEngine.php
110+
105111
-
106112
message: '#^Parameter \#1 \$eventClass of method Patchlevel\\EventSourcing\\Metadata\\Event\\EventRegistry\:\:eventName\(\) expects class\-string, string given\.$#'
107113
identifier: argument.type

src/Subscription/Engine/Handler/RunHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Patchlevel\EventSourcing\Subscription\RunMode;
1717
use Patchlevel\EventSourcing\Subscription\Status;
1818
use Patchlevel\EventSourcing\Subscription\Store\SubscriptionCriteria;
19-
use Patchlevel\EventSourcing\Subscription\Subscriber\SubscriberAccessorRepository;
2019
use Psr\Log\LoggerInterface;
2120
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2221

@@ -34,7 +33,6 @@ final class RunHandler implements Handler
3433
public function __construct(
3534
private readonly MessageLoader $messageLoader,
3635
private readonly SubscriptionManager $subscriptionManager,
37-
private readonly SubscriberAccessorRepository $subscriberRepository,
3836
private readonly MessageProcessor $messageProcessor,
3937
private readonly EventDispatcherInterface $eventDispatcher,
4038
private readonly LoggerInterface|null $logger = null,

src/Subscription/Engine/LegacyWrapperSubscriptionEngine.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use Patchlevel\EventSourcing\Subscription\Subscription;
2020
use Psr\Log\LoggerInterface;
2121

22+
use function assert;
23+
2224
final class LegacyWrapperSubscriptionEngine implements SubscriptionEngine, CanRefreshSubscriptions
2325
{
2426
private readonly NextSubscriptionEngine $engine;
@@ -58,11 +60,15 @@ public function boot(
5860
): ProcessedResult {
5961
$criteria ??= new SubscriptionEngineCriteria();
6062

61-
return $this->engine->run(new Boot(
63+
$result = $this->engine->run(new Boot(
6264
$criteria->ids,
6365
$criteria->groups,
6466
$limit,
6567
));
68+
69+
assert($result instanceof ProcessedResult);
70+
71+
return $result;
6672
}
6773

6874
public function run(
@@ -71,11 +77,15 @@ public function run(
7177
): ProcessedResult {
7278
$criteria ??= new SubscriptionEngineCriteria();
7379

74-
return $this->engine->run(new Run(
80+
$result = $this->engine->run(new Run(
7581
$criteria->ids,
7682
$criteria->groups,
7783
$limit,
7884
));
85+
86+
assert($result instanceof ProcessedResult);
87+
88+
return $result;
7989
}
8090

8191
public function teardown(SubscriptionEngineCriteria|null $criteria = null): Result

src/Subscription/Engine/NextSubscriptionEngine.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ public function __construct(
118118
Run::class => new RunHandler(
119119
$this->messageLoader,
120120
$this->subscriptionManager,
121-
$this->subscriberRepository,
122121
$messageProcessor,
123122
$this->eventDispatcher,
124123
$this->logger,

tests/Architecture/FinalClassesTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Patchlevel\EventSourcing\Tests\Architecture;
66

77
use Patchlevel\EventSourcing\Attribute\Subscriber;
8+
use Patchlevel\EventSourcing\Subscription\Engine\Result;
89
use PHPat\Selector\Selector;
910
use PHPat\Test\Builder\Rule;
1011
use PHPat\Test\PHPat;
@@ -20,6 +21,7 @@ public function testFinalClasses(): Rule
2021
Selector::NOT(Selector::isAbstract()),
2122
Selector::NOT(Selector::isInterface()),
2223
Selector::NOT(Selector::classname(Subscriber::class)),
24+
Selector::NOT(Selector::classname(Result::class)),
2325
),
2426
)
2527
->shouldBeFinal();

0 commit comments

Comments
 (0)