bmewburn / vscode-intelephense

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

Invalid Namespace definition #2876

Closed microwin7 closed 1 month ago

microwin7 commented 2 months ago

Describe the bug A clear and concise description of what the bug is. I changed the receiving method on my computer so that it would accept not the name from the Enum, but the Enum itself. I saw an error. Now I have launched the code in a clean workspace, which is displayed on GitHub, and when I hover over it, I again see the wrong Enum type. In fact, this Enum cannot exist at all in this namespace. My dev:

Expected type 'Microwin7\PHPUtils\Contracts\Texture\Enum\ResponseTypeEnum'. Found 'null|Microwin7\TextureProvider\Commands\ResponseTypeEnum::SKIN|Microwin7\TextureProvider\Commands\ResponseTypeEnum::CAPE'.intelephense(P1006)

Code from GitHub:

Microwin7\TextureProvider\Commands\MigrationToHash::$selectedMode

<?php
protected ?ResponseTypeEnum $selectedMode;
@var null|\Microwin7\TextureProvider\Commands\ResponseTypeEnum::SKIN|\Microwin7\TextureProvider\Commands\ResponseTypeEnum::CAPE

To Reproduce A code snippet (NOT a screenshot of a code snippet) or steps to reproduce the issue This problem ->

$this->selectedMode
Texture::validateHDSize($w, $h, $this->selectedMode->name);

in https://github.com/microwin7/GravitLauncher-TextureProvider/blob/44288d0edfb888a0722a5b456a78d8dd5933c7da/src/Commands/MigrationToHash.php#L119

Texture::validateSize($w, $h, $this->selectedMode->name);

in https://github.com/microwin7/GravitLauncher-TextureProvider/blob/44288d0edfb888a0722a5b456a78d8dd5933c7da/src/Commands/MigrationToHash.php#L122

ProviderTexture::insertOrUpdateAssetDB((string)$user_id, $this->selectedMode->name, $dataHash, $meta_texture);

in https://github.com/microwin7/GravitLauncher-TextureProvider/blob/44288d0edfb888a0722a5b456a78d8dd5933c7da/src/Commands/MigrationToHash.php#L140

Expected behavior A clear and concise description of what you expected to happen.

Microwin7\TextureProvider\Commands\MigrationToHash::$selectedMode

<?php
protected ?ResponseTypeEnum $selectedMode;
@var \Microwin7\PHPUtils\Contracts\Texture\Enum\ResponseTypeEnum::SKIN|\Microwin7\PHPUtils\Contracts\Texture\Enum\ResponseTypeEnum::CAPE

Here, after checking, I indicated that there cannot already be null, which is declared in a class field: https://github.com/microwin7/GravitLauncher-TextureProvider/blob/44288d0edfb888a0722a5b456a78d8dd5933c7da/src/Commands/MigrationToHash.php#L53

Screenshots If applicable, add screenshots to help explain your problem.

Code from GitHub (Clear):

Methods:

https://github.com/microwin7/PHP-Utils/blob/8320b9f686560dfaaddf9a6064b29c6b183c4b90/src/Utils/Texture.php#L83 https://github.com/microwin7/PHP-Utils/blob/8320b9f686560dfaaddf9a6064b29c6b183c4b90/src/Utils/Texture.php#L101

Screenshots:

image

Code from DEV (method changed string -> Enum)

Methods:

https://github.com/microwin7/PHP-Utils/blob/50029a7778edea357c9512a6e98303e66dbb44a0/src/Utils/Texture.php#L57 https://github.com/microwin7/PHP-Utils/blob/50029a7778edea357c9512a6e98303e66dbb44a0/src/Utils/Texture.php#L68

Screenshots:

image

Platform and version OS and Intelephense version. Windows 10 PHP Intelephense v1.10.4 Ben Mewburn intelephense.com

P.S. Due to the fact that the method previously accepted string, I did not notice the error, it was not displayed, and I did not point to find out what type was being defined there. And yes, I did Index Workspace to reset the index, because sometimes before there were errors if I changed the code, so it is not the case that the Index was broken

bmewburn commented 1 month ago

duplicate of #2811