Sonarlint reporting "Undefined function" for defined functions in PHP in VS Code

Please provide

  • Operating system: Windows 10
  • SonarLint plugin version: 3.10.0
  • Programming language you’re coding in: PHP
  • Is connected mode used:
    • Connected to SonarCloud or SonarQube (and which version):no

And a thorough description of the problem / question:

I am using SonfarLint in VS Code and it is reporting “Undefined function” for every function which is not declared in the current file (i.e in an include or require file).

When I click on the call, VS Code takes me to the function declaration. The code runs correctly. It’s just that SonarLint doesn’t see it. I can’t believe that it doesn’t parse include/require files.

Maybe it’s just a configuration thing?

Perhaps it’s the syntax that I use to require files?

E.g require_once __DIR__ . DIRECTORY_SEPARATOR . 'constants.php';

But, surely, SonarLint can parse that?

Hello @mawg and welcome to the community!

Could you please provide sample project for this problem? We would like to reproduce it on our side.
Do you use SonarQube or SonarCloud and if so do you have this problem with server analysis?