mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix phpstan issues.
This commit is contained in:
@@ -146,7 +146,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $budgets && $budgets->count() > 0) {
|
||||
$collector->setBudgets($budgets);
|
||||
}
|
||||
if (null === $budgets || (null !== $budgets && 0 === $budgets->count())) {
|
||||
if (null === $budgets || 0 === $budgets->count()) {
|
||||
$collector->setBudgets($this->getBudgets());
|
||||
}
|
||||
$collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation();
|
||||
|
@@ -63,7 +63,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $categories && $categories->count() > 0) {
|
||||
$collector->setCategories($categories);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$collector->setCategories($this->getCategories());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
|
||||
@@ -159,7 +159,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $categories && $categories->count() > 0) {
|
||||
$collector->setCategories($categories);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$collector->setCategories($this->getCategories());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation();
|
||||
@@ -223,7 +223,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $categories && $categories->count() > 0) {
|
||||
$collector->setCategories($categories);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$collector->setCategories($this->getCategories());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
|
||||
@@ -288,7 +288,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $categories && $categories->count() > 0) {
|
||||
$collector->setCategories($categories);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$collector->setCategories($this->getCategories());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation();
|
||||
@@ -361,7 +361,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $accounts && $accounts->count() > 0) {
|
||||
$collector->setAccounts($accounts);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$categories = $this->getCategories();
|
||||
}
|
||||
$collector->setCategories($categories);
|
||||
@@ -405,7 +405,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $accounts && $accounts->count() > 0) {
|
||||
$collector->setAccounts($accounts);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$categories = $this->getCategories();
|
||||
}
|
||||
$collector->setCategories($categories);
|
||||
@@ -448,7 +448,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $accounts && $accounts->count() > 0) {
|
||||
$collector->setAccounts($accounts);
|
||||
}
|
||||
if (null === $categories || (null !== $categories && 0 === $categories->count())) {
|
||||
if (null === $categories || 0 === $categories->count()) {
|
||||
$categories = $this->getCategories();
|
||||
}
|
||||
$collector->setCategories($categories);
|
||||
|
@@ -89,7 +89,7 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
*/
|
||||
public function firstNull(): ?TransactionJournal
|
||||
{
|
||||
/** @var TransactionJournal $entry */
|
||||
/** @var TransactionJournal|null $entry */
|
||||
$entry = $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
|
||||
$result = null;
|
||||
if (null !== $entry) {
|
||||
|
@@ -347,7 +347,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
||||
*/
|
||||
public function switchLinkById(int $linkId): bool
|
||||
{
|
||||
/** @var TransactionJournalLink $link */
|
||||
/** @var TransactionJournalLink|null $link */
|
||||
$link = TransactionJournalLink::find($linkId);
|
||||
if (null !== $link && $link->source->user->id === $this->user->id) {
|
||||
$this->switchLink($link);
|
||||
|
@@ -404,11 +404,8 @@ trait ModifiesPiggyBanks
|
||||
|
||||
return $piggyBank;
|
||||
}
|
||||
// remove if name is empty. Should be overruled by ID.
|
||||
if ('' === $objectGroupTitle) {
|
||||
$piggyBank->objectGroups()->sync([]);
|
||||
$piggyBank->save();
|
||||
}
|
||||
$piggyBank->objectGroups()->sync([]);
|
||||
$piggyBank->save();
|
||||
}
|
||||
|
||||
// try also with ID:
|
||||
|
@@ -67,7 +67,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $tags && $tags->count() > 0) {
|
||||
$collector->setTags($tags);
|
||||
}
|
||||
if (null === $tags || (null !== $tags && 0 === $tags->count())) {
|
||||
if (null === $tags || 0 === $tags->count()) {
|
||||
$collector->setTags($this->getTags());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation()->withTagInformation();
|
||||
@@ -166,7 +166,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
||||
if (null !== $tags && $tags->count() > 0) {
|
||||
$collector->setTags($tags);
|
||||
}
|
||||
if (null === $tags || (null !== $tags && 0 === $tags->count())) {
|
||||
if (null === $tags || 0 === $tags->count()) {
|
||||
$collector->setTags($this->getTags());
|
||||
}
|
||||
$collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation()->withTagInformation();
|
||||
|
@@ -104,7 +104,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
||||
$memberships = $this->user->groupMemberships()->get();
|
||||
/** @var GroupMembership $membership */
|
||||
foreach ($memberships as $membership) {
|
||||
/** @var UserGroup $group */
|
||||
/** @var UserGroup|null $group */
|
||||
$group = $membership->userGroup()->first();
|
||||
if (null !== $group) {
|
||||
$collection->push($group);
|
||||
@@ -131,6 +131,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
||||
$existingGroup = $this->findByName($groupName);
|
||||
if (null === $existingGroup) {
|
||||
$exists = false;
|
||||
/** @var UserGroup|null $existingGroup */
|
||||
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
|
||||
}
|
||||
if (null !== $existingGroup) {
|
||||
|
Reference in New Issue
Block a user