Fix API error

This commit is contained in:
James Cole
2023-11-05 14:31:05 +01:00
parent c0cc896102
commit 998fed7782
5 changed files with 7 additions and 7 deletions

View File

@@ -137,7 +137,9 @@ abstract class Controller extends BaseController
if (null !== $value) {
$bag->set($integer, (int)$value);
}
if (null === $value && 'limit' === $integer && auth()->check()) {
if (null === $value &&
'limit' === $integer && // @phpstan-ignore-line
auth()->check()) {
// set default for user:
$pageSize = (int)app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$bag->set($integer, $pageSize);

View File

@@ -73,9 +73,7 @@ class UpdateRequest extends FormRequest
if (null !== $reps) {
$return['repetitions'] = $reps;
}
if (null !== $transactions) {
$return['transactions'] = $transactions;
}
return $return;
}

View File

@@ -166,7 +166,7 @@ class UpdateRequest extends FormRequest
return $return;
}
/** @var array $transaction */
/** @var array|null $transaction */
foreach ($transactions as $transaction) {
if (!is_array($transaction)) {
throw new FireflyException('Invalid data submitted: transaction is not array.');

View File

@@ -113,7 +113,7 @@ class CorrectOpeningBalanceCurrencies extends Command
$transactions = $journal->transactions()->get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
/** @var Account $account */
/** @var Account|null $account */
$account = $transaction->account()->first();
if (null !== $account && AccountType::INITIAL_BALANCE !== $account->accountType()->first()->type) {
return $account;

View File

@@ -42,7 +42,7 @@ class AppServiceProvider extends ServiceProvider
public function boot(): void
{
Schema::defaultStringLength(191);
Response::macro('api', static function (array $value) {
Response::macro('api', function (array $value) {
$headers = [
'Cache-Control' => 'no-store',
];