Can I See *How* a function is known to PHPStorm?

I am calling a function in a PHP script.  I have a require_once statement at the top which references the file which contains the function.  In the editor, PHP displays the function call normally, since it knows where it's located.

If I comment out the require_once statement, PHPStorm still seems to know about where the function is, even though I think it shouldn't.  Is there a way for me to see *how* PHPStorm knows about the function, given that I've commented out the line that includes it?  I'm concerned that another file is including it that I'm not aware of.

Thanks,

-brian

0

It's actually pretty simple - PhpStorm doesn't care about include/require statements or autoloading, it analyzes all files in the project, and if in the given namespace, there is a variable/function/class/whatever with the given name - it makes a reference.

If there's more than one symbol with the same name defined in different files, you'll get the multiple definition inspection hit.

0

Okay, so if I understand you correctly, the editor will not show a function call as "unknown" if I comment out the require_once statement.  It will fail on the server but it's not something that PHPStorm will catch in the editor.  Seems like this is something they could check for.

0

You are right, but it's an approach we intentionally dismissed because people mostly go with autoloading: https://youtrack.jetbrains.com/issue/WI-1480#focus=streamItem-27-2114274.0-0

0

请先登录再写评论。