Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disable warning 'the thrown object must be an instance of the exception'

Tags:

phpstorm

I'm using phpStorm. And I have the following piece of code written by Kohana framework:

throw HTTP_Exception::factory(404,
    'The requested URL :uri was not found on this server.',
    array(':uri' => $this->request->uri())
)->request($this->request);

The problem is that phpStorm considers this piece of code invalid and displays the following message: the thrown object must be an instance of the exception. I don't like it because it shows the entire project up to first directory invalid.

Is there any way I can work around it without changing the code?

like image 855
Max Koretskyi Avatar asked Mar 27 '14 20:03

Max Koretskyi


2 Answers

Seems like PhpStorm gets "stuck" thinking the project is a PHP7 project, even if you change the PHP version in Settings. I solved this by removing the .idea directory altogether, and reopening the directory as a fresh project.

like image 100
Andri Avatar answered Oct 08 '22 22:10

Andri


i meet the same error

your Exception class must extend from \Exception ; instead of extend from Exception ;

like image 26
dragon.DK Avatar answered Oct 08 '22 21:10

dragon.DK