Various PSR12 code cleanup

This commit is contained in:
James Cole
2022-12-29 19:41:57 +01:00
parent 0022009dd5
commit dbf3e76ecc
340 changed files with 4079 additions and 3816 deletions

View File

@@ -30,6 +30,7 @@ use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups;
use FireflyIII\Services\Internal\Support\BillServiceTrait;
use FireflyIII\User;
use Illuminate\Database\QueryException;
use JsonException;
use Log;
/**
@@ -43,17 +44,17 @@ class BillFactory
private User $user;
/**
* @param array $data
* @param array $data
*
* @return Bill|null
* @throws FireflyException
* @throws \JsonException
* @throws JsonException
*/
public function create(array $data): ?Bill
{
Log::debug(sprintf('Now in %s', __METHOD__), $data);
$factory = app(TransactionCurrencyFactory::class);
$currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) ??
$currency = $factory->find((int)($data['currency_id'] ?? null), (string)($data['currency_code'] ?? null)) ??
app('amount')->getDefaultCurrencyByUser($this->user);
try {
@@ -84,7 +85,7 @@ class BillFactory
}
if (array_key_exists('notes', $data)) {
$this->updateNote($bill, (string) $data['notes']);
$this->updateNote($bill, (string)$data['notes']);
}
$objectGroupTitle = $data['object_group_title'] ?? '';
if ('' !== $objectGroupTitle) {
@@ -95,7 +96,7 @@ class BillFactory
}
}
// try also with ID:
$objectGroupId = (int) ($data['object_group_id'] ?? 0);
$objectGroupId = (int)($data['object_group_id'] ?? 0);
if (0 !== $objectGroupId) {
$objectGroup = $this->findObjectGroupById($objectGroupId);
if (null !== $objectGroup) {
@@ -108,15 +109,15 @@ class BillFactory
}
/**
* @param int|null $billId
* @param null|string $billName
* @param int|null $billId
* @param null|string $billName
*
* @return Bill|null
*/
public function find(?int $billId, ?string $billName): ?Bill
{
$billId = (int) $billId;
$billName = (string) $billName;
$billId = (int)$billId;
$billName = (string)$billName;
$bill = null;
// first find by ID:
if ($billId > 0) {
@@ -133,7 +134,7 @@ class BillFactory
}
/**
* @param string $name
* @param string $name
*
* @return Bill|null
*/
@@ -143,7 +144,7 @@ class BillFactory
}
/**
* @param User $user
* @param User $user
*/
public function setUser(User $user): void
{