Verified on latest main
PHPantom version / commit
0.9.0-224-gf4ea6e6
Installation method
Built from source
Operating system
Linux x86_64
Editor
Zed
Bug description
Code-completing a method that returns $this as specified in the PHPDoc, mistakenly is added as a return type, which is invalid.
Result:
Steps to reproduce
- On Laravel, create any model.
- Let code-completion suggest a method that returns
$this, like makeFillable
- Watch it incorporate the method with
$this as return type.
Error output or panic trace
.phpantom.toml
Additional context
The completion should return the signature as-is.
#[\Override]
public function makeHidden($attributes)
{
// ...
}
There may be added a configuration in the future to pick PHPDoc inclusion:
- No PHPDoc (default)
- Same PHPDoc (copies over the PHPDoc of the original)
- Use
@inheritdoc (let the developer expand if necessary).
Inclusion of PHPDoc should aid the LSP for method documentation when overriding/expanding just a part of the method, like the return or parameter (especially array shapes), while keeping the rest of the original PHPDoc.
Verified on latest main
mainbranch.PHPantom version / commit
0.9.0-224-gf4ea6e6
Installation method
Built from source
Operating system
Linux x86_64
Editor
Zed
Bug description
Code-completing a method that returns
$thisas specified in the PHPDoc, mistakenly is added as a return type, which is invalid.Result:
Steps to reproduce
$this, likemakeFillable$thisas return type.Error output or panic trace
.phpantom.toml
defaultAdditional context
The completion should return the signature as-is.
There may be added a configuration in the future to pick PHPDoc inclusion:
@inheritdoc(let the developer expand if necessary).Inclusion of PHPDoc should aid the LSP for method documentation when overriding/expanding just a part of the method, like the return or parameter (especially array shapes), while keeping the rest of the original PHPDoc.