diff --git a/classes/Stream/PlaylistArchiveStream.php b/classes/Stream/PlaylistArchiveStream.php index 065a57b..5c9ed4a 100644 --- a/classes/Stream/PlaylistArchiveStream.php +++ b/classes/Stream/PlaylistArchiveStream.php @@ -301,7 +301,14 @@ class PlaylistArchiveStream extends ZipArchive implements StreamInterface } } else { // Start streaming the first video. - $this->startVideoStream(current($this->videos)); + $video = current($this->videos); + if ($video) { + $this->startVideoStream($video); + } else { + $this->push_error('Playlist was empty'); + $this->finish(); + $this->isComplete = true; + } } } diff --git a/composer.json b/composer.json index 55f1fa6..33b47b8 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "maximebf/debugbar": "^1.16", "php-mock/php-mock-mockery": "^1.3", "phpro/grumphp": "^1.1", - "phpstan/phpstan": "^0.12.25", + "phpstan/phpstan": "^0.12.72", "phpunit/phpunit": "^8.4", "smarty-gettext/smarty-gettext": "^1.6", "squizlabs/php_codesniffer": "^3.5", diff --git a/composer.lock b/composer.lock index 4b2fe6a..c5245d5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d67f3db130b0bdbf050c34630c130cab", + "content-hash": "92c9a9ffac023cb7e7d0d1603a3e0d65", "packages": [ { "name": "aura/session", @@ -5247,20 +5247,20 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.25", + "version": "0.12.72", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64" + "reference": "ae32fb1c5e97979f424c3ccec4ee435a35754769" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9619551d68b2d4c0d681a8df73f3c847c798ee64", - "reference": "9619551d68b2d4c0d681a8df73f3c847c798ee64", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ae32fb1c5e97979f424c3ccec4ee435a35754769", + "reference": "ae32fb1c5e97979f424c3ccec4ee435a35754769", "shasum": "" }, "require": { - "php": "^7.1" + "php": "^7.1|^8.0" }, "conflict": { "phpstan/phpstan-shim": "*" @@ -5285,7 +5285,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-05-10T20:36:16+00:00" + "time": "2021-02-06T18:34:03+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/tests/UglyRouterTest.php b/tests/UglyRouterTest.php index a70fc98..f0f9f79 100644 --- a/tests/UglyRouterTest.php +++ b/tests/UglyRouterTest.php @@ -37,7 +37,16 @@ class UglyRouterTest extends ContainerTest parent::setUp(); $this->router = new UglyRouter(); - $this->router->map(['GET'], '/foo', 'print')->setName('foo'); + $this->router->map(['GET'], '/foo', [$this, 'fakeHandler'])->setName('foo'); + } + + /** + * Empty function that only exists so that our route can have a handler. + * + * @return void + */ + private function fakeHandler() + { } /** @@ -54,7 +63,7 @@ class UglyRouterTest extends ContainerTest Environment::mock( [ 'REQUEST_METHOD' => 'GET', - 'QUERY_STRING' => 'page=foo', + 'QUERY_STRING' => 'page=foo', ] ) )