Skip to content

Editing a file often fails to update stuff in other files #1016

@php4fan

Description

@php4fan

I'm tired of reporting bugs that boil down to: I edit something in a file, and something in another file doesn't get updated.

Here I had a situation like this:

  • Class A (file A) has a method A::foo()
  • Class C (file C) has a method C::getA() that returns an instance of A, but that is not type-hinted nor is the return type declared, so the IDE doesn't know it returns an A.
  • Somewhere in file B, I do $myA = C::getA() and then call $myA->foo().

As expected, above the definition of A::foo() it said "0 references".

So I went and fixed that. I added a /** ...*/ block above the definition of C::getA() declaring that it returns an A.
Now when I'm editing file B, it recognizes the method foo in $myA->foo(), so that I can ctrl+click on it and it takes me to the definition of A::foo() in file A. And yet, it still says "0 references" above it.

Even adding and removing a space in File A and saving it didn't fix it initially. So I went and did the same on both the other two involved files and it still didn't fix it. Then I saved file A again and it finally updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions