"Suppress for file" doesn't work

Answered

I have a problem with that function.

A piece of code:

<?php

class ContactController
{
public function postSend()
{
$this->test();
}

public function test()
{
throw new \Exception('tst');
}
}

There is `Unhandled Exception`. When I put comment with statement suppress:

/** @noinspection PhpUnhandledExceptionInspection */

all works fine. But when I hit Ctr+Enter and select for File / All it doesn't work.

 

I'm using :

PhpStorm 2017.3
Build #PS-173.3727.138, built on November 28, 2017
JRE: 1.8.0_152-release-1024-b6 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-101-generic

Any Ideas? Is this a Bug or Feature ? :D

2
4 comments

Hi there,

Suppression at file level has never worked in PhpStorm.

The option is present (as it's a platform-wide functionality) but was never implemented for PHP.

https://youtrack.jetbrains.com/issue/WI-5784

 

As for you actual code sample: either document via @throws, disable that inspection at all ... or disable inspection for specific scope (which will affect whole file as Scope works with files/folders).

3

Yeah, adding PHPDoc in this particular case works perfectly. But this was just the only example. I hope guys from JB will implement this... soon :D

1

Still waiting for file level suppression for PHP :) That option doesn't work atm and I think it should be removed if they are not going to fix this, because currently it's very misleading. Also a very bad UX to google to find out it  never worked in the first place....

0

Please sign in to leave a comment.