diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 8b78623e9d..a1f65f8a10 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -39,9 +39,7 @@ use Log; */ class LinkController extends Controller { - - /** @var LinkTypeRepositoryInterface */ - private $repository; + private LinkTypeRepositoryInterface $repository; /** * LinkController constructor. diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php index 65911fe54d..51020ffef3 100644 --- a/app/Http/Controllers/Admin/UpdateController.php +++ b/app/Http/Controllers/Admin/UpdateController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Update\UpdateTrait; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; @@ -62,8 +63,7 @@ class UpdateController extends Controller * Show page with update options. * * @return Factory|View - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface + * @throws FireflyException */ public function index() { diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php index 6acec42889..1e6c59aca7 100644 --- a/app/Http/Controllers/Bill/IndexController.php +++ b/app/Http/Controllers/Bill/IndexController.php @@ -159,7 +159,6 @@ class IndexController extends Controller continue; } - /** @var TransactionCurrency $currency */ $currencyId = $bill['currency_id']; $sums[$groupOrder][$currencyId] = $sums[$groupOrder][$currencyId] ?? [ 'currency_id' => $currencyId, diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index b16e8142d5..f7f8583f28 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -144,7 +144,7 @@ class ShowController extends Controller */ public function show(Request $request, Budget $budget) { - /** @var Carbon $start */ + /** @var Carbon $allStart */ $allStart = session('first', Carbon::now()->startOfYear()); $allEnd = today(); $page = (int)$request->get('page'); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index a0afd439dc..77ac926f9a 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -108,7 +108,7 @@ class BudgetController extends Controller $currencies = []; $defaultEntries = []; while ($end >= $loopStart) { - /** @var Carbon $currentEnd */ + /** @var Carbon $loopEnd */ $loopEnd = app('navigation')->endOfPeriod($loopStart, $step); $spent = $this->opsRepository->sumExpenses($loopStart, $loopEnd, null, $collection); $label = trim(app('navigation')->periodShow($loopStart, $step)); diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index de6a3a5ab5..4653e88809 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -76,7 +76,7 @@ class CategoryController extends Controller $cache->addProperty('chart.category.all'); $cache->addProperty($category->id); if ($cache->has()) { - return response()->json($cache->get()); + return response()->json($cache->get()); } /** @var CategoryRepositoryInterface $repository */ $repository = app(CategoryRepositoryInterface::class); @@ -125,7 +125,7 @@ class CategoryController extends Controller $cache->addProperty($end); $cache->addProperty('chart.category.frontpage'); if ($cache->has()) { - return response()->json($cache->get()); + return response()->json($cache->get()); } $frontPageGenerator = new FrontpageChartGenerator($start, $end); @@ -270,7 +270,7 @@ class CategoryController extends Controller $cache->addProperty('chart.category.period.no-cat'); $cache->addProperty($accounts->pluck('id')->toArray()); if ($cache->has()) { - return response()->json($cache->get()); + return response()->json($cache->get()); } $data = $this->reportPeriodChart($accounts, $start, $end, null); @@ -283,8 +283,8 @@ class CategoryController extends Controller * Chart for a specific period. * TODO test method, for category refactor. * - * @param Category $category - * @param $date + * @param Category $category + * @param Carbon $date * * @return JsonResponse */ @@ -294,7 +294,7 @@ class CategoryController extends Controller $start = app('navigation')->startOfPeriod($date, $range); $end = session()->get('end'); if ($end < $start) { - [$end, $start] = [$start, $end]; + [$end, $start] = [$start, $end]; } $cache = new CacheProperties; @@ -303,7 +303,7 @@ class CategoryController extends Controller $cache->addProperty($category->id); $cache->addProperty('chart.category.period-chart'); if ($cache->has()) { - return response()->json($cache->get()); + return response()->json($cache->get()); } /** @var WholePeriodChartGenerator $chartGenerator */ diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index 92c61e323c..d6812134a0 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -140,10 +140,8 @@ class CategoryReportController extends Controller * @param Collection $categories * @param Carbon $start * @param Carbon $end - * @param string $others * * @return JsonResponse - * */ public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): JsonResponse { diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index c0c451ed0a..c79cbe27e0 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -80,7 +80,7 @@ class PiggyBankController extends Controller $locale = app('steam')->getLocale(); // get first event or start date of piggy bank or today - $startDate = $piggyBank->start_date ?? today(config('app.timezone')); + $startDate = $piggyBank->startdate ?? today(config('app.timezone')); /** @var PiggyBankEvent $first */ $firstEvent = $set->first(); diff --git a/app/Http/Controllers/Chart/TransactionController.php b/app/Http/Controllers/Chart/TransactionController.php index 76b8cc1fb8..c57fcc2be7 100644 --- a/app/Http/Controllers/Chart/TransactionController.php +++ b/app/Http/Controllers/Chart/TransactionController.php @@ -52,12 +52,10 @@ class TransactionController extends Controller } /** - * @param string $objectType * @param Carbon $start * @param Carbon $end * * @return JsonResponse - * @throws FireflyException */ public function budgets(Carbon $start, Carbon $end) { diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.php index 1d3b6bdedb..f14958df16 100644 --- a/app/Http/Controllers/HelpController.php +++ b/app/Http/Controllers/HelpController.php @@ -32,7 +32,7 @@ class HelpController extends Controller /** * Show help for a route. * - * @param $route + * @param string $route * * @return JsonResponse */ diff --git a/app/Http/Controllers/Json/AutoCompleteController.php b/app/Http/Controllers/Json/AutoCompleteController.php index af2b1b5f52..98d6fa09a4 100644 --- a/app/Http/Controllers/Json/AutoCompleteController.php +++ b/app/Http/Controllers/Json/AutoCompleteController.php @@ -30,54 +30,9 @@ use Illuminate\Http\Request; /** * Class AutoCompleteController. - * - * TODO autocomplete for transaction types. - * */ class AutoCompleteController extends Controller { - /** - * Searches in the titles of all transaction journals. - * The result is limited to the top 15 unique results. - * - * If the query is numeric, it will append the journal with that particular ID. - * - * @param Request $request - * - * @return JsonResponse - */ - public function allJournalsWithID(Request $request): JsonResponse - { - $search = (string)$request->get('search'); - /** @var JournalRepositoryInterface $repository */ - $repository = app(JournalRepositoryInterface::class); - /** @var TransactionGroupRepositoryInterface $groupRepos */ - $groupRepos = app(TransactionGroupRepositoryInterface::class); - - $result = $repository->searchJournalDescriptions($search); - $array = []; - if (is_numeric($search)) { - // search for group, not journal. - $firstResult = $groupRepos->find((int)$search); - if (null !== $firstResult) { - // group may contain multiple journals, each a result: - foreach ($firstResult->transactionJournals as $journal) { - $array[] = $journal->toArray(); - } - } - } - // if not numeric, search ahead! - - // limit and unique - $limited = $result->slice(0, 15); - $array = array_merge($array, $limited->toArray()); - foreach ($array as $index => $item) { - // give another key for consistency - $array[$index]['name'] = sprintf('#%d: %s', $item['transaction_group_id'], $item['description']); - } - - return response()->json($array); - } } diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index e61be26c82..1e0b984b67 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -191,7 +191,7 @@ class PreferencesController extends Controller // same for locale: if (!auth()->user()->hasRole('demo')) { - /** @var Preference $currentLocale */ + /** @var Preference $locale */ $locale = $request->get('locale'); app('preferences')->set('locale', $locale); } diff --git a/app/Http/Controllers/Recurring/CreateController.php b/app/Http/Controllers/Recurring/CreateController.php index fcc81e3a7b..cbc21db8fe 100644 --- a/app/Http/Controllers/Recurring/CreateController.php +++ b/app/Http/Controllers/Recurring/CreateController.php @@ -148,13 +148,13 @@ class CreateController extends Controller RecurrenceRepetition::WEEKEND_TO_MONDAY => (string)trans('firefly.jump_to_monday'), ]; - /** @var Transaction $source */ - /** @var Transaction $dest */ // fill prefilled with journal info $type = strtolower($journal->transactionType->type); + /** @var Transaction $source */ $source = $journal->transactions()->where('amount', '<', 0)->first(); + /** @var Transaction $dest */ $dest = $journal->transactions()->where('amount', '>', 0)->first(); $category = $journal->categories()->first() ? $journal->categories()->first()->name : ''; $budget = $journal->budgets()->first() ? $journal->budgets()->first()->id : 0; diff --git a/app/Http/Controllers/Report/TagController.php b/app/Http/Controllers/Report/TagController.php index d5c980ad91..94bc705e7c 100644 --- a/app/Http/Controllers/Report/TagController.php +++ b/app/Http/Controllers/Report/TagController.php @@ -122,7 +122,7 @@ class TagController extends Controller foreach ($earned as $currency) { $currencyId = $currency['currency_id']; - /** @var array $category */ + /** @var array $tag */ foreach ($currency['tags'] as $tag) { foreach ($tag['transaction_journals'] as $journal) { $destinationId = $journal['destination_account_id']; diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 67336284f9..27c60f65b1 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -34,7 +34,7 @@ use Illuminate\Http\Request; class TrustProxies extends Middleware { /** @var int The headers to check. */ - protected $headers = Request::HEADER_X_FORWARDED_ALL; + //protected $headers = Request::HEADER_X_FORWARDED_ALL; /** * TrustProxies constructor. diff --git a/app/Models/Account.php b/app/Models/Account.php index cb8494a026..def09a07af 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Carbon\Carbon; use Eloquent; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; @@ -87,6 +88,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @method static Builder|Account withTrashed() * @method static Builder|Account withoutTrashed() * @mixin Eloquent + * @property Carbon $lastActivityDate + * */ class Account extends Model { diff --git a/app/Models/Category.php b/app/Models/Category.php index 36d5dcb30d..68ab640827 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -44,6 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @property \Illuminate\Support\Carbon|null $deleted_at * @property int $user_id * @property string $name + * @property Carbon $lastActivity * @property bool $encrypted * @property-read Collection|\FireflyIII\Models\Attachment[] $attachments * @property-read int|null $attachments_count diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php index be9510f90c..d4ca05aa2a 100644 --- a/app/Models/LinkType.php +++ b/app/Models/LinkType.php @@ -40,6 +40,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; * @property string $name * @property string $outward * @property string $inward + * @property int $journalCount * @property bool $editable * @property-read Collection|\FireflyIII\Models\TransactionJournalLink[] $transactionJournalLinks * @property-read int|null $transaction_journal_links_count diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index 46af4a383c..bdbdf9ab44 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -174,10 +174,10 @@ trait JournalServiceTrait if (null === $account && null !== $data['number']) { Log::debug(sprintf('Searching for account number "%s".', $data['number'])); // find by preferred type. - $source = $this->accountRepository->findByAccountNumber($data['number'], [$types[0]]); + $source = $this->accountRepository->findByAccountNumber((string) $data['number'], [$types[0]]); // or any expected type. - $source = $source ?? $this->accountRepository->findByAccountNumber($data['iban'], $types); + $source = $source ?? $this->accountRepository->findByAccountNumber((string) $data['number'], $types); if (null !== $source) { Log::debug(sprintf('Found account: #%d, %s', $source->id, $source->name));