PhpStorm does not show Missing parameter's type declaration warning

225 Views Asked by At

PhpStorm (version 2022.3.1) simply does not show "Missing parameter's type declaration warning".

In this piece of code I intentionally leave $name parameter in getId() method without type declaration and expect PhpStorm to highlight it:

<?php

declare(strict_types=1);

class TestClass
{
    private int $id = 1;

    public function getId($name): int
    {
        return $name === 'Citibank' ? 0 : $this->id;
    }
}

But nothing happens.

I've checked Settings -> Editor -> Inspections -> PHP -> Type compatibility - the checkbox is checked, Scope - 'In All Scopes', Severity - 'Warning'.

I've also went through all the steps in File -> Repair IDE.

But still I get only one Weak Warning: 'Unused element: TestClass'.

Any ideas why is this happening? I know it looks more like a bug report, but I there's still a chance that it is a configuration problem or someone has encountered it before.

P.S. If anyone's willing to check my settings, here's exported file: google drive link.

1

There are 1 best solutions below

0
On BEST ANSWER

In the referenced version (2022.3.1) this is still tied to the existence of a DocBlock annotation. Only if the DocBlock exists will this be checked. There is an issue reporting this.