laravel-ide-helper
laravel-ide-helper copied to clipboard
Method with same name already defined in this class
Versions:
- ide-helper Version: 2.12.3
- Laravel Version: 9.35.1
- PHP Version: 8.1.3
Description:
PhpStorm marks the following line in the docBlock as error if the same method is defined in the class:
* @method static QueryBuilder|Currency newModelQuery()

I tried to use a hook to remove the method from the comments, to no avail:
$command->unsetMethod('newModelQuery');
Which won't work, because the unsetMethod method tries to unset the lowercase key:
public function unsetMethod($name)
{
unset($this->methods[strtolower($name)]);
}
While the setMethod array sets the camelCase version of the key:
if (!isset($methods[strtolower($name)])) {
$this->methods[$name] = [];
$this->methods[$name]['type'] = $type;
$this->methods[$name]['arguments'] = $arguments;
$this->methods[$name]['comment'] = $comment;
}
I could submit a PR to fix the issue by keeping the case intact, but I'm not sure if other parts of the package are affected.
Just ran into this one myself. From what PHPstorm can find, that method isn't actually used anywhere in the core code (but may be used by other people's extensions, although if it is, they're probably broken)