mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 09:22:33 +00:00
PHPstan fixes.
This commit is contained in:
@@ -33,7 +33,7 @@ if [[ $GITHUB_ACTIONS = "" ]]
|
|||||||
then
|
then
|
||||||
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --error-format=table > phpstan-report.txt
|
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --error-format=table > phpstan-report.txt
|
||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
echo 'The PHPstan report can be found in phpstan-report.txt'
|
echo "The PHPstan report can be found in phpstan-report.txt. Exit code is $EXIT_CODE."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $GITHUB_ACTIONS = "true" ]]
|
if [[ $GITHUB_ACTIONS = "true" ]]
|
||||||
@@ -42,7 +42,7 @@ then
|
|||||||
EXIT_CODE=$?
|
EXIT_CODE=$?
|
||||||
|
|
||||||
# temporary exit code 0
|
# temporary exit code 0
|
||||||
EXIT_CODE=0
|
# EXIT_CODE=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit $EXIT_CODE
|
exit $EXIT_CODE
|
||||||
|
@@ -1,63 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
#
|
|
||||||
# phpunit.sh
|
|
||||||
# Copyright (c) 2021 james@firefly-iii.org
|
|
||||||
#
|
|
||||||
# This file is part of Firefly III (https://github.com/firefly-iii).
|
|
||||||
#
|
|
||||||
# This program is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU Affero General Public License as
|
|
||||||
# published by the Free Software Foundation, either version 3 of the
|
|
||||||
# License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Affero General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Affero General Public License
|
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
#
|
|
||||||
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
|
||||||
# enable test .env file.
|
|
||||||
cp $SCRIPT_DIR/../.env $SCRIPT_DIR/../.env.backup
|
|
||||||
cp $SCRIPT_DIR/.env.ci $SCRIPT_DIR/../.env
|
|
||||||
|
|
||||||
COVERAGE=false
|
|
||||||
RESET=false
|
|
||||||
FILE=storage/database/database.sqlite
|
|
||||||
|
|
||||||
while getopts "cr" o; do
|
|
||||||
case "${o}" in
|
|
||||||
c) COVERAGE=true;;
|
|
||||||
r) RESET=true;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# reset if necessary.
|
|
||||||
if [ $RESET = "true" ] ; then
|
|
||||||
rm -f $FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
# download test database
|
|
||||||
if [ -f "$FILE" ]; then
|
|
||||||
echo 'DB exists, will use it'
|
|
||||||
else
|
|
||||||
echo 'Download new DB'
|
|
||||||
wget --quiet https://github.com/firefly-iii/test-fixtures/raw/main/test-database.sqlite -O $FILE
|
|
||||||
fi
|
|
||||||
|
|
||||||
# run phpunit
|
|
||||||
if [ $COVERAGE = "true" ] ; then
|
|
||||||
echo 'Run with coverage'
|
|
||||||
XDEBUG_MODE=coverage ./vendor/bin/phpunit --configuration phpunit.xml --coverage-html $SCRIPT_DIR/coverage
|
|
||||||
else
|
|
||||||
echo 'Run without coverage'
|
|
||||||
./vendor/bin/phpunit --configuration phpunit.xml
|
|
||||||
fi
|
|
||||||
|
|
||||||
# restore .env file
|
|
||||||
mv $SCRIPT_DIR/../.env.backup $SCRIPT_DIR/../.env
|
|
||||||
|
|
||||||
cd $SCRIPT_DIR/..
|
|
@@ -74,7 +74,7 @@ class Cron extends Command
|
|||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
$this->friendlyError(sprintf('"%s" is not a valid date', $this->option('date')));
|
$this->friendlyError(sprintf('"%s" is not a valid date', $this->option('date')));
|
||||||
}
|
}
|
||||||
$force = (bool) $this->option('force');
|
$force = (bool) $this->option('force'); // @phpstan-ignore-line
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fire exchange rates cron job.
|
* Fire exchange rates cron job.
|
||||||
|
@@ -213,7 +213,7 @@ class DecryptDatabase extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Preference $object */
|
/** @var Preference $object */
|
||||||
$object = Preference::find((int)$id);
|
$object = Preference::find($id);
|
||||||
if (null !== $object) {
|
if (null !== $object) {
|
||||||
$object->data = $newValue;
|
$object->data = $newValue;
|
||||||
$object->save();
|
$object->save();
|
||||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Exceptions;
|
|||||||
|
|
||||||
use ErrorException;
|
use ErrorException;
|
||||||
use FireflyIII\Jobs\MailError;
|
use FireflyIII\Jobs\MailError;
|
||||||
|
use FireflyIII\Models\ObjectGroup;
|
||||||
use Illuminate\Auth\AuthenticationException;
|
use Illuminate\Auth\AuthenticationException;
|
||||||
use Illuminate\Contracts\Foundation\Application;
|
use Illuminate\Contracts\Foundation\Application;
|
||||||
use Illuminate\Database\QueryException;
|
use Illuminate\Database\QueryException;
|
||||||
@@ -124,7 +125,7 @@ class Handler extends ExceptionHandler
|
|||||||
$errorCode = 500;
|
$errorCode = 500;
|
||||||
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
|
$errorCode = $e instanceof MethodNotAllowedHttpException ? 405 : $errorCode;
|
||||||
|
|
||||||
$isDebug = config('app.debug', false);
|
$isDebug = (bool) config('app.debug', false);
|
||||||
if ($isDebug) {
|
if ($isDebug) {
|
||||||
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
app('log')->debug(sprintf('Return JSON %s with debug.', get_class($e)));
|
||||||
return response()->json(
|
return response()->json(
|
||||||
@@ -183,7 +184,7 @@ class Handler extends ExceptionHandler
|
|||||||
*/
|
*/
|
||||||
public function report(Throwable $e)
|
public function report(Throwable $e)
|
||||||
{
|
{
|
||||||
$doMailError = config('firefly.send_error_message');
|
$doMailError = (bool) config('firefly.send_error_message');
|
||||||
if ($this->shouldntReportLocal($e) || !$doMailError) {
|
if ($this->shouldntReportLocal($e) || !$doMailError) {
|
||||||
parent::report($e);
|
parent::report($e);
|
||||||
|
|
||||||
|
@@ -82,7 +82,7 @@ class TransactionCurrencyFactory
|
|||||||
*/
|
*/
|
||||||
public function find(?int $currencyId, ?string $currencyCode): ?TransactionCurrency
|
public function find(?int $currencyId, ?string $currencyCode): ?TransactionCurrency
|
||||||
{
|
{
|
||||||
$currencyCode = (string)e($currencyCode);
|
$currencyCode = e($currencyCode);
|
||||||
$currencyId = (int)$currencyId;
|
$currencyId = (int)$currencyId;
|
||||||
|
|
||||||
if ('' === $currencyCode && 0 === $currencyId) {
|
if ('' === $currencyCode && 0 === $currencyId) {
|
||||||
|
@@ -368,10 +368,10 @@ class TransactionJournalFactory
|
|||||||
|
|
||||||
// validate source account.
|
// validate source account.
|
||||||
$array = [
|
$array = [
|
||||||
'id' => $data['source_id'] ? (int)$data['source_id'] : null,
|
'id' => null !== $data['source_id'] ? (int)$data['source_id'] : null,
|
||||||
'name' => $data['source_name'] ? (string)$data['source_name'] : null,
|
'name' => null !== $data['source_name'] ? (string)$data['source_name'] : null,
|
||||||
'iban' => $data['source_iban'] ? (string)$data['source_iban'] : null,
|
'iban' => null !== $data['source_iban'] ? (string)$data['source_iban'] : null,
|
||||||
'number' => $data['source_number'] ? (string)$data['source_number'] : null,
|
'number' => null !== $data['source_number'] ? (string)$data['source_number'] : null,
|
||||||
];
|
];
|
||||||
$validSource = $this->accountValidator->validateSource($array);
|
$validSource = $this->accountValidator->validateSource($array);
|
||||||
|
|
||||||
@@ -383,10 +383,10 @@ class TransactionJournalFactory
|
|||||||
|
|
||||||
// validate destination account
|
// validate destination account
|
||||||
$array = [
|
$array = [
|
||||||
'id' => $data['destination_id'] ? (int)$data['destination_id'] : null,
|
'id' => null !== $data['destination_id'] ? (int)$data['destination_id'] : null,
|
||||||
'name' => $data['destination_name'] ? (string)$data['destination_name'] : null,
|
'name' => null !== $data['destination_name'] ? (string)$data['destination_name'] : null,
|
||||||
'iban' => $data['destination_iban'] ? (string)$data['destination_iban'] : null,
|
'iban' => null !== $data['destination_iban'] ? (string)$data['destination_iban'] : null,
|
||||||
'number' => $data['destination_number'] ? (string)$data['destination_number'] : null,
|
'number' => null !== $data['destination_number'] ? (string)$data['destination_number'] : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$validDestination = $this->accountValidator->validateDestination($array);
|
$validDestination = $this->accountValidator->validateDestination($array);
|
||||||
|
@@ -228,7 +228,7 @@ class UserEventHandler
|
|||||||
*/
|
*/
|
||||||
public function sendAdminRegistrationNotification(RegisteredUser $event): void
|
public function sendAdminRegistrationNotification(RegisteredUser $event): void
|
||||||
{
|
{
|
||||||
$sendMail = app('fireflyconfig')->get('notification_admin_new_reg', true)->data;
|
$sendMail = (bool) app('fireflyconfig')->get('notification_admin_new_reg', true)->data;
|
||||||
if ($sendMail) {
|
if ($sendMail) {
|
||||||
/** @var UserRepositoryInterface $repository */
|
/** @var UserRepositoryInterface $repository */
|
||||||
$repository = app(UserRepositoryInterface::class);
|
$repository = app(UserRepositoryInterface::class);
|
||||||
@@ -358,7 +358,7 @@ class UserEventHandler
|
|||||||
*/
|
*/
|
||||||
public function sendRegistrationMail(RegisteredUser $event): void
|
public function sendRegistrationMail(RegisteredUser $event): void
|
||||||
{
|
{
|
||||||
$sendMail = app('fireflyconfig')->get('notification_user_new_reg', true)->data;
|
$sendMail = (bool) app('fireflyconfig')->get('notification_user_new_reg', true)->data;
|
||||||
if ($sendMail) {
|
if ($sendMail) {
|
||||||
try {
|
try {
|
||||||
Notification::send($event->user, new UserRegistrationNotification());
|
Notification::send($event->user, new UserRegistrationNotification());
|
||||||
|
@@ -170,7 +170,7 @@ class UserController extends Controller
|
|||||||
$subTitle = (string)trans('firefly.user_administration');
|
$subTitle = (string)trans('firefly.user_administration');
|
||||||
$subTitleIcon = 'fa-users';
|
$subTitleIcon = 'fa-users';
|
||||||
$users = $this->repository->all();
|
$users = $this->repository->all();
|
||||||
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
$singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
|
||||||
$allowInvites = false;
|
$allowInvites = false;
|
||||||
if (!$this->externalIdentity && $singleUserMode) {
|
if (!$this->externalIdentity && $singleUserMode) {
|
||||||
// also registration enabled.
|
// also registration enabled.
|
||||||
|
@@ -191,9 +191,7 @@ class LoginController extends Controller
|
|||||||
|
|
||||||
$request->session()->regenerateToken();
|
$request->session()->regenerateToken();
|
||||||
|
|
||||||
if ($response = $this->loggedOut($request)) {
|
$this->loggedOut($request);
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $request->wantsJson()
|
return $request->wantsJson()
|
||||||
? new Response('', 204)
|
? new Response('', 204)
|
||||||
|
@@ -112,7 +112,7 @@ class ShowController extends Controller
|
|||||||
// file the rule(s)
|
// file the rule(s)
|
||||||
$ruleEngine->fire();
|
$ruleEngine->fire();
|
||||||
|
|
||||||
$request->session()->flash('success', (string)trans_choice('firefly.rescanned_bill', $total));
|
$request->session()->flash('success', trans_choice('firefly.rescanned_bill', $total));
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
|
|
||||||
return redirect(route('bills.show', [$bill->id]));
|
return redirect(route('bills.show', [$bill->id]));
|
||||||
|
@@ -147,7 +147,7 @@ class ExpenseReportController extends Controller
|
|||||||
|
|
||||||
while ($currentStart < $end) {
|
while ($currentStart < $end) {
|
||||||
$currentEnd = clone $currentStart;
|
$currentEnd = clone $currentStart;
|
||||||
$currentEnd = $currentEnd->$function();
|
$currentEnd = $currentEnd->$function(); // @phpstan-ignore-line
|
||||||
|
|
||||||
// get expenses grouped by opposing name:
|
// get expenses grouped by opposing name:
|
||||||
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
|
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
|
||||||
|
@@ -674,7 +674,7 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$result = (string)view('reports.partials.categories', compact('report'))->render();
|
$result = view('reports.partials.categories', compact('report'))->render();
|
||||||
$cache->store($result);
|
$cache->store($result);
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
app('log')->error(sprintf('Could not render category::expenses: %s', $e->getMessage()));
|
||||||
|
@@ -89,7 +89,7 @@ class IndexController extends Controller
|
|||||||
public function moveRule(Request $request, Rule $rule, RuleGroup $ruleGroup): JsonResponse
|
public function moveRule(Request $request, Rule $rule, RuleGroup $ruleGroup): JsonResponse
|
||||||
{
|
{
|
||||||
$order = (int)$request->get('order');
|
$order = (int)$request->get('order');
|
||||||
$this->ruleRepos->moveRule($rule, $ruleGroup, (int)$order);
|
$this->ruleRepos->moveRule($rule, $ruleGroup, $order);
|
||||||
|
|
||||||
return response()->json([]);
|
return response()->json([]);
|
||||||
}
|
}
|
||||||
|
@@ -97,7 +97,7 @@ class SelectController extends Controller
|
|||||||
$newRuleEngine->fire();
|
$newRuleEngine->fire();
|
||||||
$resultCount = $newRuleEngine->getResults();
|
$resultCount = $newRuleEngine->getResults();
|
||||||
|
|
||||||
session()->flash('success', (string)trans_choice('firefly.applied_rule_selection', $resultCount, ['title' => $rule->title]));
|
session()->flash('success', trans_choice('firefly.applied_rule_selection', $resultCount, ['title' => $rule->title]));
|
||||||
|
|
||||||
return redirect()->route('rules.index');
|
return redirect()->route('rules.index');
|
||||||
}
|
}
|
||||||
|
@@ -56,6 +56,7 @@ class InstallController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
// empty on purpose.
|
// empty on purpose.
|
||||||
$this->upgradeCommands = [
|
$this->upgradeCommands = [
|
||||||
// there are 5 initial commands
|
// there are 5 initial commands
|
||||||
|
@@ -201,7 +201,7 @@ class TagController extends Controller
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
session()->flash('success', (string)trans_choice('firefly.deleted_x_tags', $count));
|
session()->flash('success', trans_choice('firefly.deleted_x_tags', $count));
|
||||||
|
|
||||||
return redirect(route('tags.index'));
|
return redirect(route('tags.index'));
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ class BulkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
$request->session()->flash('success', (string)trans_choice('firefly.mass_edited_transactions_success', $count));
|
$request->session()->flash('success', trans_choice('firefly.mass_edited_transactions_success', $count));
|
||||||
|
|
||||||
// redirect to previous URL:
|
// redirect to previous URL:
|
||||||
return redirect($this->getPreviousUrl('transactions.bulk-edit.url'));
|
return redirect($this->getPreviousUrl('transactions.bulk-edit.url'));
|
||||||
|
@@ -117,10 +117,10 @@ class DeleteController extends Controller
|
|||||||
|
|
||||||
// grab asset account(s) from group:
|
// grab asset account(s) from group:
|
||||||
$accounts = [];
|
$accounts = [];
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $currentJournal */
|
||||||
foreach ($group->transactionJournals as $journal) {
|
foreach ($group->transactionJournals as $currentJournal) {
|
||||||
/** @var Transaction $transaction */
|
/** @var Transaction $transaction */
|
||||||
foreach ($journal->transactions as $transaction) {
|
foreach ($currentJournal->transactions as $transaction) {
|
||||||
$type = $transaction->account->accountType->type;
|
$type = $transaction->account->accountType->type;
|
||||||
// if is valid liability, trigger event!
|
// if is valid liability, trigger event!
|
||||||
if (in_array($type, config('firefly.valid_liabilities'), true)) {
|
if (in_array($type, config('firefly.valid_liabilities'), true)) {
|
||||||
|
@@ -118,7 +118,7 @@ class MassController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
session()->flash('success', (string)trans_choice('firefly.mass_deleted_transactions_success', $count));
|
session()->flash('success', trans_choice('firefly.mass_deleted_transactions_success', $count));
|
||||||
|
|
||||||
// redirect to previous URL:
|
// redirect to previous URL:
|
||||||
return redirect($this->getPreviousUrl('transactions.mass-delete.url'));
|
return redirect($this->getPreviousUrl('transactions.mass-delete.url'));
|
||||||
@@ -190,7 +190,7 @@ class MassController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
app('preferences')->mark();
|
app('preferences')->mark();
|
||||||
session()->flash('success', (string)trans_choice('firefly.mass_edited_transactions_success', $count));
|
session()->flash('success', trans_choice('firefly.mass_edited_transactions_success', $count));
|
||||||
|
|
||||||
// redirect to previous URL:
|
// redirect to previous URL:
|
||||||
return redirect($this->getPreviousUrl('transactions.mass-edit.url'));
|
return redirect($this->getPreviousUrl('transactions.mass-edit.url'));
|
||||||
|
@@ -67,7 +67,7 @@ class ReportNewJournalsMail extends Mailable
|
|||||||
|
|
||||||
return $this
|
return $this
|
||||||
->markdown('emails.report-new-journals')
|
->markdown('emails.report-new-journals')
|
||||||
->subject((string)trans_choice('email.new_journals_subject', $this->groups->count()));
|
->subject(trans_choice('email.new_journals_subject', $this->groups->count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -49,7 +49,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property int|string $user_id
|
* @property int|string $user_id
|
||||||
* @property int|string $account_type_id
|
* @property int|string $account_type_id
|
||||||
* @property string $name
|
* @property string $name
|
||||||
* @property string|null $virtual_balance
|
* @property string|float|null $virtual_balance
|
||||||
* @property string|null $iban
|
* @property string|null $iban
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $encrypted
|
* @property bool $encrypted
|
||||||
|
@@ -36,9 +36,9 @@ use Carbon\Carbon;
|
|||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property int|string $rule_id
|
* @property int|string $rule_id
|
||||||
* @property string $action_type
|
* @property string|null $action_type
|
||||||
* @property string $action_value
|
* @property string|null $action_value
|
||||||
* @property int $order
|
* @property int|string $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $stop_processing
|
* @property bool $stop_processing
|
||||||
* @property-read Rule $rule
|
* @property-read Rule $rule
|
||||||
|
@@ -44,7 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @property int|string $user_id
|
* @property int|string $user_id
|
||||||
* @property string|null $title
|
* @property string|null $title
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int $order
|
* @property int|string $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $stop_processing
|
* @property bool $stop_processing
|
||||||
* @property Collection|Rule[] $rules
|
* @property Collection|Rule[] $rules
|
||||||
|
@@ -38,7 +38,7 @@ use Carbon\Carbon;
|
|||||||
* @property int|string $rule_id
|
* @property int|string $rule_id
|
||||||
* @property string|null $trigger_type
|
* @property string|null $trigger_type
|
||||||
* @property string|null $trigger_value
|
* @property string|null $trigger_value
|
||||||
* @property int $order
|
* @property int|string $order
|
||||||
* @property bool $active
|
* @property bool $active
|
||||||
* @property bool $stop_processing
|
* @property bool $stop_processing
|
||||||
* @property-read Rule $rule
|
* @property-read Rule $rule
|
||||||
|
@@ -46,8 +46,8 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property int|string $transaction_journal_id
|
* @property int|string $transaction_journal_id
|
||||||
* @property string|null $description
|
* @property string|null $description
|
||||||
* @property int|null $transaction_currency_id
|
* @property int|null $transaction_currency_id
|
||||||
* @property string $modified
|
* @property string|null $modified
|
||||||
* @property string $modified_foreign
|
* @property string|null $modified_foreign
|
||||||
* @property string $date
|
* @property string $date
|
||||||
* @property string $max_date
|
* @property string $max_date
|
||||||
* @property string|float $amount
|
* @property string|float $amount
|
||||||
|
@@ -41,16 +41,16 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
/**
|
/**
|
||||||
* FireflyIII\Models\TransactionJournal
|
* FireflyIII\Models\TransactionJournal
|
||||||
*
|
*
|
||||||
* @property int|string $id
|
* @property int|string $id
|
||||||
* @property Carbon|null $created_at
|
* @property Carbon|null $created_at
|
||||||
* @property Carbon|null $updated_at
|
* @property Carbon|null $updated_at
|
||||||
* @property Carbon|null $deleted_at
|
* @property Carbon|null $deleted_at
|
||||||
* @property int|string $user_id
|
* @property int|string $user_id
|
||||||
* @property int |string $transaction_type_id
|
* @property int |string $transaction_type_id
|
||||||
* @property int|null $transaction_group_id
|
* @property int|string|null $transaction_group_id
|
||||||
* @property int|null $bill_id
|
* @property int|string|null $bill_id
|
||||||
* @property int|null $transaction_currency_id
|
* @property int|string|null $transaction_currency_id
|
||||||
* @property string $description
|
* @property string|null $description
|
||||||
* @property Carbon $date
|
* @property Carbon $date
|
||||||
* @property Carbon|null $interest_date
|
* @property Carbon|null $interest_date
|
||||||
* @property Carbon|null $book_date
|
* @property Carbon|null $book_date
|
||||||
@@ -114,7 +114,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|||||||
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()
|
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()
|
||||||
* @property-read Collection|Location[] $locations
|
* @property-read Collection|Location[] $locations
|
||||||
* @property-read int|null $locations_count
|
* @property-read int|null $locations_count
|
||||||
* @property int $the_count
|
* @property int|string $the_count
|
||||||
* @property int|null $user_group_id
|
* @property int|null $user_group_id
|
||||||
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
|
* @method static EloquentBuilder|TransactionJournal whereUserGroupId($value)
|
||||||
* @property-read Collection<int, AuditLogEntry> $auditLogEntries
|
* @property-read Collection<int, AuditLogEntry> $auditLogEntries
|
||||||
|
@@ -72,7 +72,7 @@ class TransactionCreation extends Notification
|
|||||||
{
|
{
|
||||||
return (new MailMessage())
|
return (new MailMessage())
|
||||||
->markdown('emails.report-new-journals', ['transformed' => $this->collection])
|
->markdown('emails.report-new-journals', ['transformed' => $this->collection])
|
||||||
->subject((string)trans_choice('email.new_journals_subject', count($this->collection)));
|
->subject(trans_choice('email.new_journals_subject', count($this->collection)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -111,7 +111,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
$array[$currencyId]['transaction_journals'][$journalId] = [
|
$array[$currencyId]['transaction_journals'][$journalId] = [
|
||||||
'amount' => app('steam')->$direction((string)$journal['amount']),
|
'amount' => app('steam')->$direction((string)$journal['amount']), // @phpstan-ignore-line
|
||||||
'date' => $journal['date'],
|
'date' => $journal['date'],
|
||||||
'transaction_journal_id' => $journalId,
|
'transaction_journal_id' => $journalId,
|
||||||
'budget_name' => $journal['budget_name'],
|
'budget_name' => $journal['budget_name'],
|
||||||
@@ -268,7 +268,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount']));
|
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$direction($journal['amount']));// @phpstan-ignore-line
|
||||||
|
|
||||||
// also do foreign amount:
|
// also do foreign amount:
|
||||||
$foreignId = (int)$journal['foreign_currency_id'];
|
$foreignId = (int)$journal['foreign_currency_id'];
|
||||||
@@ -281,7 +281,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], app('steam')->$direction($journal['foreign_amount']));
|
$array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], app('steam')->$direction($journal['foreign_amount']));// @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['currency_code'],
|
'currency_code' => $journal['currency_code'],
|
||||||
'currency_decimal_places' => $journal['currency_decimal_places'],
|
'currency_decimal_places' => $journal['currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['amount']));
|
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['amount']));// @phpstan-ignore-line
|
||||||
|
|
||||||
// also do foreign amount:
|
// also do foreign amount:
|
||||||
if (0 !== (int)$journal['foreign_currency_id']) {
|
if (0 !== (int)$journal['foreign_currency_id']) {
|
||||||
@@ -343,7 +343,7 @@ class OperationsRepository implements OperationsRepositoryInterface
|
|||||||
'currency_code' => $journal['foreign_currency_code'],
|
'currency_code' => $journal['foreign_currency_code'],
|
||||||
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
'currency_decimal_places' => $journal['foreign_currency_decimal_places'],
|
||||||
];
|
];
|
||||||
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['foreign_amount']));
|
$array[$key]['sum'] = bcadd($array[$key]['sum'], app('steam')->$method((string)$journal['foreign_amount']));// @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -137,7 +137,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
public function findBill(?int $billId, ?string $billName): ?Bill
|
public function findBill(?int $billId, ?string $billName): ?Bill
|
||||||
{
|
{
|
||||||
if (null !== $billId) {
|
if (null !== $billId) {
|
||||||
$searchResult = $this->find((int)$billId);
|
$searchResult = $this->find($billId);
|
||||||
if (null !== $searchResult) {
|
if (null !== $searchResult) {
|
||||||
app('log')->debug(sprintf('Found bill based on #%d, will return it.', $billId));
|
app('log')->debug(sprintf('Found bill based on #%d, will return it.', $billId));
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (null !== $billName) {
|
if (null !== $billName) {
|
||||||
$searchResult = $this->findByName((string)$billName);
|
$searchResult = $this->findByName($billName);
|
||||||
if (null !== $searchResult) {
|
if (null !== $searchResult) {
|
||||||
app('log')->debug(sprintf('Found bill based on "%s", will return it.', $billName));
|
app('log')->debug(sprintf('Found bill based on "%s", will return it.', $billName));
|
||||||
|
|
||||||
|
@@ -530,7 +530,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
|||||||
$result = $this->find((int)$budgetId);
|
$result = $this->find((int)$budgetId);
|
||||||
if (null === $result && null !== $budgetName && '' !== $budgetName) {
|
if (null === $result && null !== $budgetName && '' !== $budgetName) {
|
||||||
app('log')->debug(sprintf('Searching for budget with name %s...', $budgetName));
|
app('log')->debug(sprintf('Searching for budget with name %s...', $budgetName));
|
||||||
$result = $this->findByName((string)$budgetName);
|
$result = $this->findByName($budgetName);
|
||||||
}
|
}
|
||||||
if (null !== $result) {
|
if (null !== $result) {
|
||||||
app('log')->debug(sprintf('Found budget #%d: %s', $result->id, $result->name));
|
app('log')->debug(sprintf('Found budget #%d: %s', $result->id, $result->name));
|
||||||
|
@@ -382,8 +382,8 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink
|
public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink
|
||||||
{
|
{
|
||||||
$journalLink->source_id = $data['inward_id'] ?: $journalLink->source_id;
|
$journalLink->source_id = null === $data['inward_id'] ? $journalLink->source_id : $data['inward_id'];
|
||||||
$journalLink->destination_id = $data['outward_id'] ?: $journalLink->destination_id;
|
$journalLink->destination_id = null === $data['outward_id'] ? $journalLink->destination_id : $data['outward_id'];
|
||||||
$journalLink->save();
|
$journalLink->save();
|
||||||
if (array_key_exists('link_type_name', $data)) {
|
if (array_key_exists('link_type_name', $data)) {
|
||||||
$linkType = LinkType::whereName($data['link_type_name'])->first();
|
$linkType = LinkType::whereName($data['link_type_name'])->first();
|
||||||
@@ -394,7 +394,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface
|
|||||||
$journalLink->refresh();
|
$journalLink->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
$journalLink->link_type_id = $data['link_type_id'] ?: $journalLink->link_type_id;
|
$journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id'];
|
||||||
$journalLink->save();
|
$journalLink->save();
|
||||||
if (array_key_exists('notes', $data) && null !== $data['notes']) {
|
if (array_key_exists('notes', $data) && null !== $data['notes']) {
|
||||||
$this->setNoteText($journalLink, $data['notes']);
|
$this->setNoteText($journalLink, $data['notes']);
|
||||||
|
@@ -68,7 +68,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
app('log')->debug('Searching for piggy information.');
|
app('log')->debug('Searching for piggy information.');
|
||||||
|
|
||||||
if (null !== $piggyBankId) {
|
if (null !== $piggyBankId) {
|
||||||
$searchResult = $this->find((int)$piggyBankId);
|
$searchResult = $this->find($piggyBankId);
|
||||||
if (null !== $searchResult) {
|
if (null !== $searchResult) {
|
||||||
app('log')->debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
|
app('log')->debug(sprintf('Found piggy based on #%d, will return it.', $piggyBankId));
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (null !== $piggyBankName) {
|
if (null !== $piggyBankName) {
|
||||||
$searchResult = $this->findByName((string)$piggyBankName);
|
$searchResult = $this->findByName($piggyBankName);
|
||||||
if (null !== $searchResult) {
|
if (null !== $searchResult) {
|
||||||
app('log')->debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
|
app('log')->debug(sprintf('Found piggy based on "%s", will return it.', $piggyBankName));
|
||||||
|
|
||||||
@@ -227,11 +227,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
|||||||
$amount = null;
|
$amount = null;
|
||||||
if ((int)$source->transaction_currency_id === (int)$currency->id) {
|
if ((int)$source->transaction_currency_id === (int)$currency->id) {
|
||||||
app('log')->debug('Use normal amount');
|
app('log')->debug('Use normal amount');
|
||||||
$amount = app('steam')->$operator($source->amount);
|
$amount = app('steam')->$operator($source->amount); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
if ((int)$source->foreign_currency_id === (int)$currency->id) {
|
if ((int)$source->foreign_currency_id === (int)$currency->id) {
|
||||||
app('log')->debug('Use foreign amount');
|
app('log')->debug('Use foreign amount');
|
||||||
$amount = app('steam')->$operator($source->foreign_amount);
|
$amount = app('steam')->$operator($source->foreign_amount); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
if (null === $amount) {
|
if (null === $amount) {
|
||||||
app('log')->debug('No match on currency, so amount remains null, return "0".');
|
app('log')->debug('No match on currency, so amount remains null, return "0".');
|
||||||
|
@@ -85,7 +85,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
|||||||
'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks',
|
'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks',
|
||||||
];
|
];
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
foreach ($userGroup->$object()->get() as $item) {
|
foreach ($userGroup->$object()->get() as $item) { // @phpstan-ignore-line
|
||||||
$item->delete();
|
$item->delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +135,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
|||||||
}
|
}
|
||||||
if (null !== $existingGroup) {
|
if (null !== $existingGroup) {
|
||||||
// group already exists
|
// group already exists
|
||||||
$groupName = sprintf('%s-%s', $user->email, substr(sha1((string)(rand(1000, 9999) . microtime())), 0, 4));
|
$groupName = sprintf('%s-%s', $user->email, substr(sha1((rand(1000, 9999) . microtime())), 0, 4));
|
||||||
}
|
}
|
||||||
$loop++;
|
$loop++;
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,6 @@ class BelongsUser implements ValidationRule
|
|||||||
$fail('validation.belongs_user')->translate();
|
$fail('validation.belongs_user')->translate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$attribute = (string)$attribute;
|
|
||||||
app('log')->debug(sprintf('Going to validate %s', $attribute));
|
app('log')->debug(sprintf('Going to validate %s', $attribute));
|
||||||
|
|
||||||
$result = match ($attribute) {
|
$result = match ($attribute) {
|
||||||
@@ -135,7 +134,7 @@ class BelongsUser implements ValidationRule
|
|||||||
}
|
}
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
$objectValue = trim((string)$object->$field);
|
$objectValue = trim((string)$object->$field); // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
||||||
if ($objectValue === $value) {
|
if ($objectValue === $value) {
|
||||||
$count++;
|
$count++;
|
||||||
|
@@ -64,7 +64,6 @@ class BelongsUserGroup implements ValidationRule
|
|||||||
$fail('validation.belongs_user_or_user_group')->translate();
|
$fail('validation.belongs_user_or_user_group')->translate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$attribute = (string)$attribute;
|
|
||||||
app('log')->debug(sprintf('Group: Going to validate "%s"', $attribute));
|
app('log')->debug(sprintf('Group: Going to validate "%s"', $attribute));
|
||||||
|
|
||||||
$result = match ($attribute) {
|
$result = match ($attribute) {
|
||||||
@@ -150,7 +149,7 @@ class BelongsUserGroup implements ValidationRule
|
|||||||
}
|
}
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
$objectValue = trim((string)$object->$field);
|
$objectValue = trim((string)$object->$field); // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
app('log')->debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
||||||
if ($objectValue === $value) {
|
if ($objectValue === $value) {
|
||||||
$count++;
|
$count++;
|
||||||
|
@@ -107,7 +107,7 @@ class IsValidAttachmentModel implements ValidationRule
|
|||||||
}
|
}
|
||||||
$method = $methods[$this->model];
|
$method = $methods[$this->model];
|
||||||
|
|
||||||
$result = $this->$method((int)$value);
|
$result = $this->$method((int)$value); // @phpstan-ignore-line
|
||||||
if(false === $result) {
|
if(false === $result) {
|
||||||
$fail('validation.model_id_invalid')->translate();
|
$fail('validation.model_id_invalid')->translate();
|
||||||
}
|
}
|
||||||
@@ -221,6 +221,6 @@ class IsValidAttachmentModel implements ValidationRule
|
|||||||
$repository = app(JournalAPIRepositoryInterface::class);
|
$repository = app(JournalAPIRepositoryInterface::class);
|
||||||
$repository->setUser(auth()->user());
|
$repository->setUser(auth()->user());
|
||||||
|
|
||||||
return null !== $repository->findTransaction((int)$value);
|
return null !== $repository->findTransaction($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -196,7 +196,7 @@ trait RecurringTransactionTrait
|
|||||||
$repository->setUser($this->user);
|
$repository->setUser($this->user);
|
||||||
|
|
||||||
// if user has submitted an account ID, search for it.
|
// if user has submitted an account ID, search for it.
|
||||||
$result = $repository->find((int)$accountId);
|
$result = $repository->find($accountId);
|
||||||
if (null !== $result) {
|
if (null !== $result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@ class CurrencyUpdateService
|
|||||||
$currency->enabled = false;
|
$currency->enabled = false;
|
||||||
|
|
||||||
if (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) {
|
if (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) {
|
||||||
$currency->decimal_places = (int)$data['decimal_places'];
|
$currency->decimal_places = $data['decimal_places'];
|
||||||
}
|
}
|
||||||
$currency->userEnabled = null;
|
$currency->userEnabled = null;
|
||||||
$currency->userDefault = null;
|
$currency->userDefault = null;
|
||||||
|
@@ -536,12 +536,12 @@ class JournalUpdateService
|
|||||||
$this->transactionJournal->user,
|
$this->transactionJournal->user,
|
||||||
$this->transactionJournal,
|
$this->transactionJournal,
|
||||||
sprintf('update_%s', $fieldName),
|
sprintf('update_%s', $fieldName),
|
||||||
$this->transactionJournal->$fieldName,
|
$this->transactionJournal->$fieldName, // @phpstan-ignore-line
|
||||||
$value
|
$value
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->transactionJournal->$fieldName = $value;
|
$this->transactionJournal->$fieldName = $value;// @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('Updated %s', $fieldName));
|
app('log')->debug(sprintf('Updated %s', $fieldName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -47,7 +47,7 @@ class CLIToken implements BinderInterface
|
|||||||
$users = $repository->all();
|
$users = $repository->all();
|
||||||
|
|
||||||
// check for static token
|
// check for static token
|
||||||
if ($value === config('firefly.static_cron_token') && 32 === strlen((string)config('firefly.static_cron_token'))) {
|
if ($value === config('firefly.static_cron_token') && 32 === strlen(config('firefly.static_cron_token'))) {
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -249,7 +249,7 @@ trait ModelInformation
|
|||||||
$values[$index] = $notes->text;
|
$values[$index] = $notes->text;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($journalTriggers as $index => $trigger) {
|
foreach ($journalTriggers as $ii => $trigger) {
|
||||||
try {
|
try {
|
||||||
$string = view(
|
$string = view(
|
||||||
'rules.partials.trigger',
|
'rules.partials.trigger',
|
||||||
@@ -257,14 +257,13 @@ trait ModelInformation
|
|||||||
'oldTrigger' => $trigger,
|
'oldTrigger' => $trigger,
|
||||||
'oldValue' => $values[$index],
|
'oldValue' => $values[$index],
|
||||||
'oldChecked' => false,
|
'oldChecked' => false,
|
||||||
'count' => $index + 1,
|
'count' => $ii + 1,
|
||||||
'triggers' => $triggers,
|
'triggers' => $triggers,
|
||||||
]
|
]
|
||||||
)->render();
|
)->render();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
|
app('log')->debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage()));
|
||||||
app('log')->debug($e->getTraceAsString());
|
app('log')->debug($e->getTraceAsString());
|
||||||
$string = '';
|
|
||||||
throw new FireflyException('Could not render trigger', 0, $e);
|
throw new FireflyException('Could not render trigger', 0, $e);
|
||||||
}
|
}
|
||||||
if ('' !== $string) {
|
if ('' !== $string) {
|
||||||
|
@@ -46,7 +46,7 @@ class Navigation
|
|||||||
*/
|
*/
|
||||||
public function __construct(Calculator $calculator = null)
|
public function __construct(Calculator $calculator = null)
|
||||||
{
|
{
|
||||||
$this->calculator = ($calculator instanceof Calculator) ?: new Calculator();
|
$this->calculator = $calculator instanceof Calculator ? $calculator : new Calculator();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -213,7 +213,7 @@ class Navigation
|
|||||||
];
|
];
|
||||||
if (array_key_exists($repeatFreq, $functionMap)) {
|
if (array_key_exists($repeatFreq, $functionMap)) {
|
||||||
$function = $functionMap[$repeatFreq];
|
$function = $functionMap[$repeatFreq];
|
||||||
$date->$function();
|
$date->$function(); // @phpstan-ignore-line
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
@@ -325,7 +325,7 @@ class Navigation
|
|||||||
$function = $functionMap[$repeatFreq];
|
$function = $functionMap[$repeatFreq];
|
||||||
|
|
||||||
if (array_key_exists($repeatFreq, $modifierMap)) {
|
if (array_key_exists($repeatFreq, $modifierMap)) {
|
||||||
$currentEnd->$function($modifierMap[$repeatFreq]);
|
$currentEnd->$function($modifierMap[$repeatFreq]); // @phpstan-ignore-line
|
||||||
if (in_array($repeatFreq, $subDay, true)) {
|
if (in_array($repeatFreq, $subDay, true)) {
|
||||||
$currentEnd->subDay();
|
$currentEnd->subDay();
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ class Navigation
|
|||||||
|
|
||||||
return $currentEnd;
|
return $currentEnd;
|
||||||
}
|
}
|
||||||
$currentEnd->$function();
|
$currentEnd->$function(); // @phpstan-ignore-line
|
||||||
$currentEnd->endOfDay();
|
$currentEnd->endOfDay();
|
||||||
if (in_array($repeatFreq, $subDay, true)) {
|
if (in_array($repeatFreq, $subDay, true)) {
|
||||||
$currentEnd->subDay();
|
$currentEnd->subDay();
|
||||||
@@ -372,7 +372,7 @@ class Navigation
|
|||||||
}
|
}
|
||||||
$func = $map[$period];
|
$func = $map[$period];
|
||||||
// first do the diff
|
// first do the diff
|
||||||
$floatDiff = $beginning->$func($end);
|
$floatDiff = $beginning->$func($end); // @phpstan-ignore-line
|
||||||
|
|
||||||
|
|
||||||
// then correct for quarterly or half-year
|
// then correct for quarterly or half-year
|
||||||
@@ -434,7 +434,7 @@ class Navigation
|
|||||||
|
|
||||||
if (array_key_exists($repeatFreq, $functionMap)) {
|
if (array_key_exists($repeatFreq, $functionMap)) {
|
||||||
$function = $functionMap[$repeatFreq];
|
$function = $functionMap[$repeatFreq];
|
||||||
$currentEnd->$function();
|
$currentEnd->$function(); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $maxDate && $currentEnd > $maxDate) {
|
if (null !== $maxDate && $currentEnd > $maxDate) {
|
||||||
@@ -508,7 +508,7 @@ class Navigation
|
|||||||
$formatted = $begin->format($format);
|
$formatted = $begin->format($format);
|
||||||
$displayed = $begin->isoFormat($displayFormat);
|
$displayed = $begin->isoFormat($displayFormat);
|
||||||
$entries[$formatted] = $displayed;
|
$entries[$formatted] = $displayed;
|
||||||
$begin->$increment();
|
$begin->$increment(); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entries;
|
return $entries;
|
||||||
@@ -563,7 +563,7 @@ class Navigation
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (array_key_exists($repeatFrequency, $formatMap)) {
|
if (array_key_exists($repeatFrequency, $formatMap)) {
|
||||||
return $date->isoFormat((string)$formatMap[$repeatFrequency]);
|
return $date->isoFormat($formatMap[$repeatFrequency]);
|
||||||
}
|
}
|
||||||
if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) {
|
if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) {
|
||||||
$quarter = ceil($theDate->month / 3);
|
$quarter = ceil($theDate->month / 3);
|
||||||
@@ -726,7 +726,7 @@ class Navigation
|
|||||||
];
|
];
|
||||||
if (array_key_exists($repeatFreq, $functionMap)) {
|
if (array_key_exists($repeatFreq, $functionMap)) {
|
||||||
$function = $functionMap[$repeatFreq];
|
$function = $functionMap[$repeatFreq];
|
||||||
$date->$function($subtract);
|
$date->$function($subtract); // @phpstan-ignore-line
|
||||||
|
|
||||||
return $date;
|
return $date;
|
||||||
}
|
}
|
||||||
@@ -801,7 +801,7 @@ class Navigation
|
|||||||
|
|
||||||
if (array_key_exists($range, $functionMap)) {
|
if (array_key_exists($range, $functionMap)) {
|
||||||
$function = $functionMap[$range];
|
$function = $functionMap[$range];
|
||||||
$end->$function();
|
$end->$function(); // @phpstan-ignore-line
|
||||||
|
|
||||||
return $end;
|
return $end;
|
||||||
}
|
}
|
||||||
@@ -862,7 +862,7 @@ class Navigation
|
|||||||
];
|
];
|
||||||
if (array_key_exists($range, $functionMap)) {
|
if (array_key_exists($range, $functionMap)) {
|
||||||
$function = $functionMap[$range];
|
$function = $functionMap[$range];
|
||||||
$start->$function();
|
$start->$function(); // @phpstan-ignore-line
|
||||||
|
|
||||||
return $start;
|
return $start;
|
||||||
}
|
}
|
||||||
|
@@ -201,7 +201,7 @@ class ParseDateString
|
|||||||
}
|
}
|
||||||
$func = $functions[$direction][$period];
|
$func = $functions[$direction][$period];
|
||||||
app('log')->debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
|
app('log')->debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d')));
|
||||||
$today->$func($number);
|
$today->$func($number); // @phpstan-ignore-line
|
||||||
app('log')->debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
|
app('log')->debug(sprintf('Resulting date is %s', $today->format('Y-m-d')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -117,9 +117,9 @@ trait AppendsLocationData
|
|||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
private function isValidPOST(?string $prefix): bool
|
private function isValidPost(?string $prefix): bool
|
||||||
{
|
{
|
||||||
app('log')->debug('Now in isValidPOST()');
|
app('log')->debug('Now in isValidPost()');
|
||||||
$longitudeKey = $this->getLocationKey($prefix, 'longitude');
|
$longitudeKey = $this->getLocationKey($prefix, 'longitude');
|
||||||
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
|
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
|
||||||
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
|
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
|
||||||
|
@@ -353,7 +353,7 @@ trait ConvertsDataTypes
|
|||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
foreach ($fields as $field => $info) {
|
foreach ($fields as $field => $info) {
|
||||||
if ($this->has($info[0])) {
|
if (true === $this->has($info[0])) {
|
||||||
$method = $info[1];
|
$method = $info[1];
|
||||||
$return[$field] = $this->$method($info[0]); // @phpstan-ignore-line
|
$return[$field] = $this->$method($info[0]); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ trait ConvertsDataTypes
|
|||||||
*/
|
*/
|
||||||
protected function nullableInteger(string $field): ?int
|
protected function nullableInteger(string $field): ?int
|
||||||
{
|
{
|
||||||
if (!$this->has($field)) {
|
if (false === $this->has($field)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -60,7 +60,8 @@ use TypeError;
|
|||||||
/**
|
/**
|
||||||
* Class OperatorQuerySearch
|
* Class OperatorQuerySearch
|
||||||
*/
|
*/
|
||||||
class OperatorQuerySearch implements SearchInterface
|
class
|
||||||
|
OperatorQuerySearch implements SearchInterface
|
||||||
{
|
{
|
||||||
protected Carbon $date;
|
protected Carbon $date;
|
||||||
private AccountRepositoryInterface $accountRepository;
|
private AccountRepositoryInterface $accountRepository;
|
||||||
@@ -1422,7 +1423,7 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
|
app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
|
||||||
$this->collector->$collectorMethod($filtered);
|
$this->collector->$collectorMethod($filtered); // @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1512,7 +1513,7 @@ class OperatorQuerySearch implements SearchInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
|
app('log')->debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod));
|
||||||
$this->collector->$collectorMethod($filtered);
|
$this->collector->$collectorMethod($filtered);// @phpstan-ignore-line
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -164,8 +164,8 @@ class Steam
|
|||||||
/** @var Transaction $entry */
|
/** @var Transaction $entry */
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
// normal amount and foreign amount
|
// normal amount and foreign amount
|
||||||
$modified = null === $entry->modified ? '0' : (string)$entry->modified;
|
$modified = null === $entry->modified ? '0' : $entry->modified;
|
||||||
$foreignModified = null === $entry->modified_foreign ? '0' : (string)$entry->modified_foreign;
|
$foreignModified = null === $entry->modified_foreign ? '0' :$entry->modified_foreign;
|
||||||
$amount = '0';
|
$amount = '0';
|
||||||
if ($currencyId === (int)$entry->transaction_currency_id || 0 === $currencyId) {
|
if ($currencyId === (int)$entry->transaction_currency_id || 0 === $currencyId) {
|
||||||
// use normal amount:
|
// use normal amount:
|
||||||
|
Reference in New Issue
Block a user