pcov is faster, uses less memory, is more accurate than phdbg.

Phpdbg

Time: 4.09 minutes, Memory: 3.32 GB

Pcov

Time: 3.48 minutes, Memory: 1.36 GB

Caveat, only works with PHPUnit 8+… Or does it?

How to switch to pcov if you are stuck with PHPUnit 7

If you are doing this:

vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml

Or this:

phpdbg -qrr -d memory_limit=-1 vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml

Simply change to:

pecl install pcov; composer require pcov/clobber; vendor/bin/pcov clobber; vendor/bin/phpunit --configuration phpunit.xml --coverage-clover coverage.xml

And you’re done.