php-mock/php-mock-phpunit

Incompatible declaration of MockDisablerPHPUnit6::endTest

ptomulik opened this issue · 1 comments

I was hit by this when running psalm on one of my projects (it's only part of log):

Using reflection to locate file for phpmock\phpunit\MockDisablerPHPUnit6
PHP Fatal error:  Declaration of phpmock\phpunit\MockDisablerPHPUnit6::endTest(PHPUnit\Framework\Test $test, $time) must be compatible with PHPUnit\Framework\BaseTestListener::endTest(PHPUnit\Framework\Test $test, float $time): void in php-mock/php-mock-phpunit/classes/MockDisablerPHPUnit6.php on line 44
Fatal error: Declaration of phpmock\phpunit\MockDisablerPHPUnit6::endTest(PHPUnit\Framework\Test $test, $time) must be compatible with PHPUnit\Framework\BaseTestListener::endTest(PHPUnit\Framework\Test $test, float $time): void in php-mock/php-mock-phpunit/classes/MockDisablerPHPUnit6.php on line 44

I guess, that missing : void type hint (return value) is the "incompatibility".

The void was added in 7.1.0. I see in your composer.json php>=7, so the void may be add and requirement in composer.json may be bumped to 7.1. Anyway, there is already : void in MockDisablerPHPUnit6, so its a syntax error for 7.0 I guess.

Ok, just realized this file shall be loaded conditionally, perhaps psalm wrong trying to load it.