Suppress not working correctly

I am using Codeigniter and all the variables passed through the $data parameter in the $this->load->view() are coming up as undefined. I do not want to suppress inspection for all undefined as there may be other variables that are also undefined. 

When I click on the "suppress" dropdown in the right hand pane I get the option of "Suppress for statement". That works fine as it inserts the @noinspection line. When I go to the next line with an undefined variable the "Suppress for statement" selection is no longer available. What is going wrong?

0

Hi there,

In general: why not just define variable instead (using PHPDoc @var) ? This way you tell the IDE: "Yes, I know this variable" . .so it can run type checks and other stuff on them if needed etc.

As for the actual "suppress" issue you have described: can you provide some basic code sample (generic one -- will be tested without any CodeIgniter around)

0
Avatar
Permanently deleted user

Thanks for the tip about the PHPDoc. That is much better as I can then document the variables passed.

It is still interesting that the option disappears when I use it. I run "Inspect code" use the option once and it goes away. I run "Inspect Code" again and the option is back.

0

Are you still able to reproduce this: 

> When I go to the next line with an undefined variable the "Suppress for statement" selection is no longer available.

?

If you do - could you please attach a file we could use to reproduce?

0

请先登录再写评论。