Skip to content

Extension does not return results after updating to phpstan 1.9.16 when xDebug is used #35

@Balkoth

Description

@Balkoth

Hi,

after updating phpstan 1.9.16 through composer the extension does no longer fetch problems in vscode and errors out with this message:

2023-02-08 14:27:26.131 [error] [Extension Host] [phpstan] failed: 
 ! [NOTE] The Xdebug PHP extension is active, but "--xdebug" is not used. This may slow down performance and the process
 !        will not halt at breakpoints.

My quick and dirty fix is to hack the extensions controller.js to push --xdebug as command line parameter to phpstan like this:

makeCommandArgs(args) {
    let result = [];
    result.push("analyse");
    result.push("--xdebug");
    result.push("--error-format=json");
    if (args.level === "config") {
        // set level in config file
    }
    else if (args.level) {
        result.push("--level=" + args.level);
    }
    else {
        result.push("--level=max");
    }
    if (args.noProgress) {
        result.push("--no-progress");
    }
    if (args.memoryLimit) {
        result.push("--memory-limit=" + args.memoryLimit);
    }
    if (args.configuration) {
        result.push("--configuration=" + args.configuration);
    }
    if (args.autoloadFile) {
        result.push("--autoload-file=" + args.autoloadFile);
    }
    if (args.path) {
        result.push(args.path);
    }
    return result;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions