Thanks to visit codestin.com
Credit goes to github.com

Skip to content

PHPStan hack to get links to the errors #1594

@enumag

Description

@enumag

When trying to fix many PHPStan errors at once I noticed that most of my time is actually consumed by looking up the correct files and lines - even when using Ctrl+N and Ctrl+G.

So I hacked PHPStan to print editor:// links to the errors. Surprisingly I actually got it to work.

Here is what I've done:

  1. Followed the notes here to make editor:// open PHPStorm.
  2. Used one of the terminals that support escape sequences for links. In my case I used gnome-terminal since it was already on my Ubuntu.
  3. Hacked PHPStan's TableErrorFormatter to print the links.

I'm not going to send a PR for this since you'd most likely want to hide it behind a --links option and also because I was only able to get it to work using normal echo - Symfony's table formatting breaks it. Still you might want to consider this as a nice feature for the next PHPStan version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions