4

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:

  1. 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.
  2. 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.

neubert
  • 15,947
  • 24
  • 120
  • 212
  • 1
    PHPUnit 4 is not supported anymore and was never supported on PHP 7. – Sebastian Bergmann Nov 30 '17 at 14:22
  • 2
    @SebastianBergmann - phpunit's website says as much. This is why I didn't create an issue about it on github. I don't expect _official_ support but that doesn't preclude _unofficial_ support. Also, although it's not officially supported on anything greater than PHP 5.6 it did none-the-less work on PHP 7.0 and 7.1. It's like an old abandoned DOS game. Maybe it was written for MSDOS 4.0 but by happy coincidence it worked all the up to Windows XP. Then you upgrade to Windows 7 and it stops working. Doesn't mean "_how can I get this game working on Windows 7_" questions are prima facie invalid. – neubert Nov 30 '17 at 15:40

0 Answers0