Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option::expect doesn't pass psalm analysis #5

Closed
adrianpanicek opened this issue Jan 9, 2020 · 2 comments · Fixed by #6
Closed

Option::expect doesn't pass psalm analysis #5

adrianpanicek opened this issue Jan 9, 2020 · 2 comments · Fixed by #6

Comments

@adrianpanicek
Copy link
Contributor

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
Copy link
Owner

prewk commented Jan 9, 2020

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

@andrew-demb
Copy link
Contributor

andrew-demb commented Jan 9, 2020

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

andrew-demb pushed a commit to andrew-demb/option that referenced this issue Jan 10, 2020
…t provide support use it in something like `@psalm-throws`)

Fixes prewk#5
andrew-demb added a commit to andrew-demb/option that referenced this issue Jan 10, 2020
…t provide support use it in something like `@psalm-throws`)

Fixes prewk#5
@prewk prewk closed this as completed in #6 Jan 10, 2020
prewk pushed a commit that referenced this issue Jan 10, 2020
…t provide support use it in something like `@psalm-throws`) (#6)

Fixes #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants