Start adding return types

This commit is contained in:
Oliver Davies 2018-12-27 22:13:07 +00:00
parent 5c9abeb3b9
commit 58317fb17b
2 changed files with 7 additions and 4 deletions

View file

@ -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,

View file

@ -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/');
}