bmewburn / vscode-intelephense

PHP intellisense for Visual Studio Code
https://intelephense.com
Other
1.56k stars 92 forks source link

Unable to disregard P1006 #2894

Closed chinleung closed 4 days ago

chinleung commented 4 weeks ago

Describe the bug

I'm not able to suppress the P1006 error even though I've followed the instructions from https://github.com/bmewburn/vscode-intelephense/issues/568#issuecomment-1763662245.

<?php

class Test
{
    public function test(): static
    {
        return tap($this)->save();
    }

    public function save(): bool
    {
        return true;
    }
}

This is giving me the error:

Expected type 'static'. Found 'bool'. (intelephense P1006)

I've tried adding the /** @disregard P1006 */ and it is not working.

/** @disregard P1006 */
public function test(): static

To Reproduce

Simply create a new file Test.php in a Laravel application with the following content:

<?php

class Test
{
    /** @disregard P1006 */
    public function test(): static
    {
        return tap($this)->save();
    }

    public function save(): bool
    {
        return true;
    }
}

Expected behavior

Intelephense should not be flagging the return type error.

Screenshots

image

Platform and version

I'm on Apple M2 Pro with PHP v8.2.16 and Intelephense v1.10.4.