prewk/option

Option::expect doesn't pass psalm analysis

adrianpanicek opened this issue · 2 comments

Psalm throws an InvalidArgument error while trying to use any exception.

Code:

$order = $orderOption->expect(new AggregateRootNotFound(Order::class, $matchWithOffer->getOrderId()));

Error:

InvalidArgument - src/Shop/Order/Application/Handler/Command/MatchWithOfferHandler.php:64:39 - Argument 1 of Prewk\Option::expect expects (X as Exception)&Exception, App\Common\Infrastructure\Exception\AggregateRootNotFound provided

Psalm version: 3.6.6 (5e17a9af104de39321c47f73b253cece9df1cf2c)

AggregateRootNotFound extends an Exception class. This error is thrown even if I use plain Exception. Can you help me with it?

prewk commented

Maybe @andrew-demb can help, he contributed the Psalm part! (Wish I could help, but I barely code PHP anymore)

I will look for this tomorrow.
Should be easy to fix.