php-actions/phpstan

Can't get the result as a file

cavemanlu opened this issue · 2 comments

To integrate phpstan and sonarcloud we have to create a file containing json with the phpstan result.
PhpStan itself doesn't have an option to save the result directly to a file, and so the action doesn't. As a result, it's impossible to use the action for such integration (have to use a more talkative action).
I suggest adding an option to save the output to a defined (via the option) file.

g105b commented

Hi @cavemanlu ,

I'm happy to add this as a feature so it works in your workflow. Can you help me understand exactly what the contents of the file should be?

Hi @cavemanlu ,

I'm happy to add this as a feature so it works in your workflow. Can you help me understand exactly what the contents of the file should be?

Hi @g105b ,

The content is the result (stdout) of phpstan execution. The exact result depends on the command arguments, but we are talking about automatization, so we use the argument '--error-format=json' and then get a json string.
Example of the raw command:
'php vendor/bin/phpstan analyse --no-progress --error-format=json > phpstan-report.json'

Thanks!