Vscode-intelephense: Add config to enable/disable diagnostics

Created on 21 Feb 2019  路  8Comments  路  Source: bmewburn/vscode-intelephense

enhancement

Most helpful comment

Why don't a comment just be added above the affected line, just like how ts-ignore works in Typescript? I don't want to disable an entire type of check just because of one line.

My use case: A lambda function. There's supposed to be a function 'lambda' which I shouldn't be declaring.

All 8 comments

I would love to have this implemented!

I get several "Expected type 'int'. Found 'string'." that I would like to disable.

Every other check is welcome.

@nunoperalta could you add a code snippet so I can reproduce this? I want to minimise false positives too.

function get_date(_int_ $unix_timestamp) { }

$result = mysqli_query('SELECT time FROM table');
$row = mysqli_fetch_assoc($result);
echo get_date(_$row['time']_);

Expected type 'int'. Found 'string'.
intelephense(10006)

Note that I do want all other errors in relation to type issues. I just want to be able to ignore the specific "expected int / found string" ones.

+1 for this feature. All of the fatal errors I currently have are of this kind, and I use type juggling on purpose so this becomes quite an annoying false positive. I wouldn't mind it being a warning though.
But I've only experienced this with int and strings. When expecting more complex objects like classes things could get complicated.

Diagnostics can be disabled completely or categories of diagnostics disabled in 1.3. Expected type 'int'. Found 'string' was due to declare(strict_types=1) always assumed to be set, in 1.3 files are inspected for this declaration and type checking adjusted accordingly.

Why don't a comment just be added above the affected line, just like how ts-ignore works in Typescript? I don't want to disable an entire type of check just because of one line.

My use case: A lambda function. There's supposed to be a function 'lambda' which I shouldn't be declaring.

Why don't a comment just be added above the affected line, just like how ts-ignore works in Typescript? I don't want to disable an entire type of check just because of one line.

Seconded. My use case is a PHPUnit test where an invalid value is intentionally given to test the correct exception is thrown.

This is tracked in #568

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mushmelty picture mushmelty  路  4Comments

steven7mwesigwa picture steven7mwesigwa  路  4Comments

ghost picture ghost  路  3Comments

ottopic picture ottopic  路  3Comments

nn-hh picture nn-hh  路  3Comments