From a799bb6f0a141fa35d994dc463807b19d4d3faae Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Sat, 30 Jan 2016 16:01:12 -0800 Subject: [PATCH] PHP 7 fixes --- src/Cookie/FileCookieJar.php | 2 ++ tests/Cookie/FileCookieJarTest.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Cookie/FileCookieJar.php b/src/Cookie/FileCookieJar.php index 82991895..9887c1d5 100644 --- a/src/Cookie/FileCookieJar.php +++ b/src/Cookie/FileCookieJar.php @@ -74,6 +74,8 @@ class FileCookieJar extends CookieJar $json = file_get_contents($filename); if (false === $json) { throw new \RuntimeException("Unable to load file {$filename}"); + } elseif ($json === '') { + return; } $data = \GuzzleHttp\json_decode($json, true); diff --git a/tests/Cookie/FileCookieJarTest.php b/tests/Cookie/FileCookieJarTest.php index 70888418..6ddd829b 100644 --- a/tests/Cookie/FileCookieJarTest.php +++ b/tests/Cookie/FileCookieJarTest.php @@ -25,7 +25,7 @@ class FileCookieJarTest extends \PHPUnit_Framework_TestCase new FileCookieJar($this->file); } - public function testLoadsFromFileFile() + public function testLoadsFromFile() { $jar = new FileCookieJar($this->file); $this->assertEquals([], $jar->getIterator()->getArrayCopy()); @@ -35,7 +35,7 @@ class FileCookieJarTest extends \PHPUnit_Framework_TestCase /** * @dataProvider testPersistsToFileFileParameters */ - public function testPersistsToFileFile($testSaveSessionCookie = false) + public function testPersistsToFile($testSaveSessionCookie = false) { $jar = new FileCookieJar($this->file, $testSaveSessionCookie); $jar->setCookie(new SetCookie([