So I have a library that is supposed to work on PHP 5.3 - PHP 7.2. I'd like to have it unit tested on each of those versions on Travis CI but am running into a problem with PHPUnit. In my composer.json I have this (in require-dev):
"phpunit/phpunit": "~4.0",
That works great all the way up to PHP 7.1 but in PHP 7.2 I get this error:
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/travis/build/neubert/project/vendor/phpunit/phpunit/src/Util/Getopt.php on line 38
This is causing the unit tests on Travis CI to fail.
The two options I can think of:
- Require
~5.0
, which would mean I'd have to stop testing PHP 5.3 - PHP 5.5 on Travis CI. https://phpunit.de/ says that the 5.0 version is compatible with PHP up to 7.1 so it's possible that not even that one would work, at which point, I'd have to require~6.0
, which would mean I wasn't doing unit tests on PHP 5.x. - Don't add PHP 7.2+ to my .travis.yml file and don't test on PHP 7.2+.
Neither of these approaches have a lot of appeal to me. If the library is to be compatible with PHP 5.3 (for example) I'd just assume run unit tests on PHP 5.3 (so long as Travis CI supports it). Same thing for PHP 7.2.
I guess I could just BC break the whole library and say PHP 5.x is no longer supported period. Certainly there are PHP purists who might applaud PHP 5.x no longer being supported by anything anywhere but, like I said, it'd be a BC break. I guess that's what the major version is in semantic versioning but I'd also just assume make BC breaking releases at a time of my choosing and not be forced into the decision by PHPUnit.