PHPStan as third party issues

We’re trying to integrate report from PHPStan into Sonarqube. I added into my repo file “” and there I defined “sonar.php.phpstan.reportPaths=report.json”. In sonarqube GUI I see error: “No issue will be imported from this report. The content of the file probably does not have the expected format”

Example of report.json:

This is standart output of PHPStan.

Also is there any graphical summary of imported report as third party issues?

I am using
Developer Edition Version 9.2.4 (build 50792)

Thank you

Hey there.

What command are you using to generate the report?

My report (using json or prettyJson output formats) looks a lot different. See the documentation on output formats here.

    "totals": {
        "errors": 0,
        "file_errors": 1
    "files": {
        "src/Greeter.php": {
            "errors": 1,
            "messages": [
                    "message": "Unreachable statement - code above always terminates.",
                    "line": 11,
                    "ignorable": true
    "errors": []

It looks like you might be using the gitlab output format. SonarQube cannot read this.

Hi Colin,

Thank you for your reply.

I tried both format. There is an example of json output, but I still getting error: “Failed to resolve 220 file path(s) in PHPStan gl-code-quality-report__3_.json report. No issues imported related to file(s): /var/www/html/legacy/admin/core.php;/var/www/html/legacy/admin/index.php”

Do you have any idea, why SonarQube cannot resolve these path?

I also tried that report you sent, but still getting error: “Failed to resolve 1 file path(s) in PHPStan phpstan2.json report. No issues imported related to file(s): src/Greeter.php”

Thanks in advance.

Hey @Martin1

I can reproduce the same issue. By changing the filepath in the report to start from the directory the scanner executes I can get the issues to import successfully… but I don’t think you should have to do that. I’ve raised a point internally.

Hi @Colin

There is similar feature on GitLab calling “path correction” Test coverage visualization | GitLab

Does SonarQube support something similar? Thank you.