mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Update find methods to return null
This commit is contained in:
@@ -66,14 +66,12 @@ class BillRepository implements BillRepositoryInterface
|
||||
*
|
||||
* @return Bill
|
||||
*/
|
||||
public function find(int $billId): Bill
|
||||
public function find(int $billId): ?Bill
|
||||
{
|
||||
$bill = $this->user->bills()->find($billId);
|
||||
if (null === $bill) {
|
||||
$bill = new Bill;
|
||||
}
|
||||
/** @var Bill $res */
|
||||
$res = $this->user->bills()->find($billId);
|
||||
|
||||
return $bill;
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,7 +81,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
*
|
||||
* @return Bill
|
||||
*/
|
||||
public function findByName(string $name): Bill
|
||||
public function findByName(string $name): ?Bill
|
||||
{
|
||||
$bills = $this->user->bills()->get(['bills.*']);
|
||||
|
||||
@@ -94,7 +92,7 @@ class BillRepository implements BillRepositoryInterface
|
||||
}
|
||||
}
|
||||
|
||||
return new Bill;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -47,18 +47,18 @@ interface BillRepositoryInterface
|
||||
*
|
||||
* @param int $billId
|
||||
*
|
||||
* @return Bill
|
||||
* @return Bill|null
|
||||
*/
|
||||
public function find(int $billId): Bill;
|
||||
public function find(int $billId): ?Bill;
|
||||
|
||||
/**
|
||||
* Find a bill by name.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return Bill
|
||||
* @return Bill|null
|
||||
*/
|
||||
public function findByName(string $name): Bill;
|
||||
public function findByName(string $name): ?Bill;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
|
Reference in New Issue
Block a user