Hi guys,

I just installed the extension on a fresh instance of vscode.

"Find All References" finds methods outside of the project and even private members of the class.

See screenshots.

Is it a feature? :)

    Tried different ext versions from v1.22.11089 down to v1.15.10535, PHP 8.1.12 and 8.0.14.

      Hi,

      You're right - PHP Tools are a bit more optimistic. It always finds everything that looks possible. We'll tweak it a little ... :)

      2 months later

      Hello.

      Extension version v1.28.12200

      In Laravel projects 'Find all references' also has an odd behavior. Besides actual references it also shows string with same name in route files.


      Things get even worse when you'll try to rename function (F2). Because it will rename string in route file(wep.php).

      12 days later

      We are still having issues with "Find all references" in 1.29.12304.

      When using "Find on references" on a class-method the "References" list show method-calls on other objects with the same method-name. This is even when the classes are in different namespaces.

      When hovering over the method on the editor VSCode recognizes the correct classname.

      Kristoffer thank you for reminding me;

      It should not happen when the type $module can be inferred - I'll check what's going on )

        Kristoffer we can't replicate the issue. The "find all references" command takes the type into account, so there might be something else unexpected happening?

          There might be something wrong with our settings.
          If i put an error in some file, by calling a random not-existing function the error shows up in the problems panel.
          However, when i close the file the error disappears.

          Any idea what settings might be worth looking into?

          This is our settings.json:

          {
          "files.exclude": {
          "/node_modules": true,
          },
          "files.watcherExclude": {
          "
          /.git/objects/": true,
          "
          /.git/subtree-cache/": true,
          "
          /node_modules//": true,
          },
          "php.version": "8.2.1",
          "php.problems.exclude" : {
          "
          /shared/vendor/**" : true,
          "/": [410]
          },
          "php.stubs": [
          "
          ",
          "imagick",
          "gmp"
          ],
          "editor.codeLens": false
          }

            I figured it out: The setting "php.problems.scope" was set to "opened" (by default).
            Changed it to "user" and both the probems-panel and "find all references" started working as expected.

            8 days later

            I still have this problem:

            Find All References

            It shows method-calls on other objects with the same method-name. This is even when the classes are in different namespaces.

            I tried to set up a small example in a new codebase but it worked. So basically I can only demonstrate this in our huge work codebase.

              kburton-dev thank you for reminding us.

              I'll try to replicate the issue.

                2 years later

                Hi, Still have the 'Find all references' issue that searche a function on other classes. Any solution ? thank you.

                  recherchedev Thank you for pointing this out,

                  Do you have a more specific example? This feature depends on how well the editor resolves the type of class.

                    10 days later
                    • Edited

                    Hello! Why is behavior different when click on reference on top of methods and when "Go to references"?
                    In first case it show only places where the method is called and in second case it shows all related places.

                    Here it is "Locations(1)" in title;

                    And here it's "References (3)" in title.

                      Maxim Thank you for the question.

                      I think it's for historical reasons. The first one does not show definitions and should be called "Usages" instead.

                        Write a Reply...