Skip to content

Instantly share code, notes, and snippets.

@patrickallaert
Last active Sep 16, 2020
Embed
What would you like to do?
Integrate Phan in PHPStom

HOWTO

  1. Install Phan in your project using Composer, it should create the script vendor/bin/phan, otherwise install it the way you want and hack the run-phan script.
  2. Install script run-phan (see at the bottom of this page) on your system (I decided to put it at /usr/local/bin/run-phan).
  3. In PHPStorm, go in Settings > Tools > External Tools, add a new tool and provide the parameters:
    • Program: /usr/local/bin/run-phan
    • Working directory: $ProjectFileDir$
    • Check "Open console for tool output"
    • Output filters: $FILE_PATH$:$LINE$
  4. You can now use it from Tools > External Tools > Phan (or assign it a shortcut)

#!/usr/bin/env bash
php -n -d zend_extension=opcache -d extension=ast vendor/bin/phan --color --no-progress-bar | sed -E 's|(\x1b\[[0-9;]*m)([a-zA-Z0-9\-_\./]+\x1b\[[0-9;]*m:\x1b\[[0-9;]*m[[:digit:]]+\x1b\[[0-9;]*m)|\1'"$(pwd)"'/\2|g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment