Debugging with Xdebug
To debug plugin code with Xdebug and PhpStorm:
- Configure PhpStorm for CLI debugging
- Run Psalm with Xdebug enabled:
XDEBUG_MODE=debug XDEBUG_SESSION=1 PSALM_ALLOW_XDEBUG=1 vendor/bin/psalm --threads=1 --no-cache
--threads=1 is required so Psalm runs in a single process (breakpoints don’t work in forked workers). PSALM_ALLOW_XDEBUG=1 prevents Psalm from restarting itself without Xdebug (it does this by default for performance).