From a1a3281dbf7cd16f8ebf90a8e27c6a3db6b87495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mom=C4=8Dilovi=C4=87?= Date: Fri, 18 Dec 2020 15:27:38 +0100 Subject: [PATCH] PHP 8 Support (#782) Thanks @kornrunner for these changes: * Test against PHP 8 * U-Tests: FFProbe: OptionsTester: handle phpunit deprecation of at * FiltersCollection: tweak for call_user_func_array and PHP 8 named arguments --- .travis.yml | 4 +++- src/FFMpeg/Filters/FiltersCollection.php | 4 ++-- tests/Unit/FFProbe/OptionsTesterTest.php | 10 ++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9670db2..75f2db4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,12 +30,14 @@ matrix: - php: 7.2 - php: 7.3 - php: 7.4 + - php: 8.0 + dist: bionic - php: nightly env: - COMPOSER_DEV_STABILITY=true before_install: - - sudo add-apt-repository ppa:mc3man/trusty-media -y + - sudo add-apt-repository ppa:mc3man/${TRAVIS_DIST}-media -y - sudo apt-get update -q - composer self-update - echo "$PHPUNIT_VERSION" diff --git a/src/FFMpeg/Filters/FiltersCollection.php b/src/FFMpeg/Filters/FiltersCollection.php index c91241a..1a1c20a 100644 --- a/src/FFMpeg/Filters/FiltersCollection.php +++ b/src/FFMpeg/Filters/FiltersCollection.php @@ -38,7 +38,7 @@ class FiltersCollection implements \Countable, \IteratorAggregate return 0; } - return count(call_user_func_array('array_merge', $this->filters)); + return count(call_user_func_array('array_merge', array_values($this->filters))); } /** @@ -51,7 +51,7 @@ class FiltersCollection implements \Countable, \IteratorAggregate $this->sorted = $this->filters; } else { krsort($this->filters); - $this->sorted = call_user_func_array('array_merge', $this->filters); + $this->sorted = call_user_func_array('array_merge', array_values($this->filters)); } } diff --git a/tests/Unit/FFProbe/OptionsTesterTest.php b/tests/Unit/FFProbe/OptionsTesterTest.php index 4436928..b55386d 100644 --- a/tests/Unit/FFProbe/OptionsTesterTest.php +++ b/tests/Unit/FFProbe/OptionsTesterTest.php @@ -77,13 +77,11 @@ class OptionsTesterTest extends TestCase ->method('fetch') ->will($this->returnValue($data)); - $cache->expects($this->at(0)) + $cache->expects($this->exactly(2)) ->method('contains') - ->will($this->returnValue(false)); - - $cache->expects($this->at(1)) - ->method('contains') - ->will($this->returnValue(true)); + ->willReturnOnConsecutiveCalls( + $this->returnValue(false), + $this->returnValue(true)); $cache->expects($this->once()) ->method('save');