Skip to content

Static methods not being suggested for instances #162

@z01cbrag

Description

@z01cbrag

PHPantom version

phpantom_lsp 0.8.0.0-dirty

Installation method

Other (describe in Additional Context)

Operating system

Linux x86_64

Editor

Neovim

Bug description

Static class methods does not show up in instance autocompletion.

For example, accessing the static methods withself works as expected:

Image

But with instance $this it doesn't:

Image

Steps to reproduce

  1. Create a file with the following content:
<?php

class Bug {
    public function __construct(private string $error) {
    }

    public function print() {
        echo 'this shows: ' . $this->error;
    }

    public static function show() {
        echo 'this does not show';
    }

    public function test() {
        // It should suggest both print and show methods
        $this->
    }
}
  1. Place cursor after $this-> and trigger completion
  2. Expected print() and show() methods appear
  3. Actual: only print() method appears

Error output or panic trace


.phpantom.toml

Additional context

Using phpantom_lsp provided by Nvim's Mason Registry (obtained from phpantom_lsp releases AFAIK)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions