From 58317fb17b8f3c07b340e050380550bd544b8945 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Thu, 27 Dec 2018 22:13:07 +0000 Subject: [PATCH] Start adding return types --- src/Service/Addresses.php | 8 +++++--- tests/Unit/Service/AddressesTest.php | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Service/Addresses.php b/src/Service/Addresses.php index 0f043f9..6768277 100644 --- a/src/Service/Addresses.php +++ b/src/Service/Addresses.php @@ -2,6 +2,8 @@ namespace Opdavies\GmailFilterBuilder\Service; +use Tightenco\Collect\Support\Collection; + /** * A service for loading addresses from separate files. */ @@ -14,7 +16,7 @@ class Addresses * * @return array */ - public static function load($filename = 'my-addresses.php') + public static function load(string $filename = 'my-addresses.php'): array { $file = (new static())->getDirectoryPaths() ->map(function ($path) use ($filename) { @@ -34,9 +36,9 @@ class Addresses /** * Get the potential directory names containing the addresses file. * - * @return \Illuminate\Support\Collection + * @return \Tightenco\Collect\Support\Collection */ - protected function getDirectoryPaths() + protected function getDirectoryPaths(): Collection { return collect([ getenv('HOME') . DIRECTORY_SEPARATOR . '.gmail-filters' . DIRECTORY_SEPARATOR, diff --git a/tests/Unit/Service/AddressesTest.php b/tests/Unit/Service/AddressesTest.php index 73bfd0e..b2159a8 100644 --- a/tests/Unit/Service/AddressesTest.php +++ b/tests/Unit/Service/AddressesTest.php @@ -4,6 +4,7 @@ namespace Opdavies\Tests\GmailFilterBuilder\Service; use Opdavies\GmailFilterBuilder\Service\Addresses; use PHPUnit\Framework\TestCase; +use Tightenco\Collect\Support\Collection; /** * Test loading addresses from a separate file. @@ -29,7 +30,7 @@ class FakeAddresses extends Addresses /** * {@inheritdoc} */ - protected function getDirectoryPaths() + protected function getDirectoryPaths(): Collection { return collect(__DIR__ . '/../../stubs/addresses/'); }