Skip to content

--static-analysis-tool-options doesn't let you overwrite PHPStan --configuration flag #2390

@WyriHaximus

Description

@WyriHaximus
Question Answer
Infection version 0.31.2
Test Framework version PHPUnit 12.3.6
PHP version 8.4.11
Platform e.g. Ubuntu/Alpine Container
Github Repo -

To make my project/package root directories less cluttered I've moved all PHPStan/PHPUnit etc files into ./etc/qa/, with my PHPStan file being ./etc/qa/phpstan.neon. With the addition of --static-analysis-tool I was hoping we'd get something like:

    "phpUnit": {
        "configDir": "./etc/qa/"
    },

And --static-analysis-tool-options looked promising, but reading the Command Generation section of #2374 and given that StaticAnalysisConfigLocator::locate supports a custom directory but isn't called with support for one

$phpStanConfigPath = $this->staticAnalysisConfigLocator->locate(StaticAnalysisToolTypes::PHPSTAN);
makes this currently impossible.

Output with issue
The path "/home/wyrihaximus/Projects/WyriHaximus/Makefiles" does not contain any of the requested files: "phpstan.neon", "phpstan.neon.dist", "phpstan.dist.neon"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions