bmewburn / vscode-intelephense

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

Support `<Class>::*` type syntax for class constants #2811

Open lkrms opened 4 months ago

lkrms commented 4 months ago

Describe the bug

In the code below, Intelephense:

The problem report is:

Expected type 'string'. Found 'OAuth2GrantType::*'.intelephense(P1006)

"Go to Definition" from OAuth2GrantType::* in PHPDoc type locations would also be nice to have, but the incorrect problem report is the main issue.

To Reproduce

<?php

class OAuth2GrantType
{
    public const AUTHORIZATION_CODE = 'authorization_code';
    public const REFRESH_TOKEN = 'refresh_token';
    public const CLIENT_CREDENTIALS = 'client_credentials';
}

abstract class OAuth2Client
{
    /**
     * @param OAuth2GrantType::* $grantType
     */
    abstract function receiveToken(string $token, string $grantType): void;

    /**
     * @param OAuth2GrantType::* $grantType
     */
    public function processToken(string $token, string $grantType): void
    {
        // "Expected type 'string'. Found 'OAuth2GrantType::*'.intelephense(P1006)"
        $this->receiveToken($token, $grantType);
    }
}

Platform and version

v1.10.2 on macOS and Linux

rejmann commented 2 weeks ago

@bmewburn any news?