mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
make findByName nullable.
This commit is contained in:
parent
b3fe24b713
commit
6b32213735
@ -96,9 +96,9 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Category
|
||||
* @return Category|null
|
||||
*/
|
||||
public function findByName(string $name): Category
|
||||
public function findByName(string $name): ?Category
|
||||
{
|
||||
$categories = $this->user->categories()->get(['categories.*']);
|
||||
foreach ($categories as $category) {
|
||||
@ -107,7 +107,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
return new Category;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +74,7 @@ interface CategoryRepositoryInterface
|
||||
*
|
||||
* @return Category
|
||||
*/
|
||||
public function findByName(string $name): Category;
|
||||
public function findByName(string $name): ?Category;
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
|
Loading…
Reference in New Issue
Block a user