H
H
HellWalk2018-07-11 14:57:54
phpstorm
HellWalk, 2018-07-11 14:57:54

What's not to like about phpStorm?

On a self-written microframework, I make a classic exception, it works fine, but phpStorm highlights an error:
5b45f0468ee5e151663524.png
What does it not like? Throwing an exception via try/catch is something no one in their right mind does. Add @throws \Exception to the description - did it, still swears.
In Laravel, exceptions are made in a similar way - and phpStorm is fine with that.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Stalker_RED, 2018-07-11
@Stalker_RED

So you threw an exception, and who will catch who?
Storm looks for where you have this exception handler, but can't find it.
php.net/manual/en/function.set-exception-handler.php somewhere globally, at least right in index.php
Ideally, not far from error_reporting.

A
Alexey Ukolov, 2018-07-11
@alexey-m-ukolov

Add @throws \Exception to the class description - did it, still swears.
This is the right decision. Somehow they did it wrong or Storm blunted (in such cases, Ctrl + A => Ctrl + X => Ctrl + V helps).
You can generally disable this inspection if it bothers you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question