Skip to content

Commit 56fba2a

Browse files
committed
fix phpstan
1 parent e5bfe33 commit 56fba2a

5 files changed

Lines changed: 18 additions & 4 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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ final class RunHandler implements Handler
3434
public function __construct(
3535
private readonly MessageLoader $messageLoader,
3636
private readonly SubscriptionManager $subscriptionManager,
37-
private readonly SubscriberAccessorRepository $subscriberRepository,
3837
private readonly MessageProcessor $messageProcessor,
3938
private readonly EventDispatcherInterface $eventDispatcher,
4039
private readonly LoggerInterface|null $logger = null,

src/Subscription/Engine/LegacyWrapperSubscriptionEngine.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ public function boot(
5858
): ProcessedResult {
5959
$criteria ??= new SubscriptionEngineCriteria();
6060

61-
return $this->engine->run(new Boot(
61+
$result = $this->engine->run(new Boot(
6262
$criteria->ids,
6363
$criteria->groups,
6464
$limit,
6565
));
66+
67+
assert($result instanceof ProcessedResult);
68+
69+
return $result;
6670
}
6771

6872
public function run(
@@ -71,11 +75,15 @@ public function run(
7175
): ProcessedResult {
7276
$criteria ??= new SubscriptionEngineCriteria();
7377

74-
return $this->engine->run(new Run(
78+
$result = $this->engine->run(new Run(
7579
$criteria->ids,
7680
$criteria->groups,
7781
$limit,
7882
));
83+
84+
assert($result instanceof ProcessedResult);
85+
86+
return $result;
7987
}
8088

8189
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)