mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
Fix phpstan error courtesy of the laravel 11 upgrade (changed signatures and return types)
This commit is contained in:
@@ -19,9 +19,9 @@
|
||||
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<ruleset name="pcsg-generated-ruleset"
|
||||
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
name="pcsg-generated-ruleset"
|
||||
xmlns="http://pmd.sf.net/ruleset/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
|
||||
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
|
||||
<description>Firefly III ruleset.</description>
|
||||
|
@@ -59,12 +59,8 @@ class TestRequest extends FormRequest
|
||||
return null;
|
||||
}
|
||||
$value = (string)$value;
|
||||
$result = null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
if (false === $result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
}
|
||||
|
||||
private function getAccounts(): array
|
||||
|
@@ -53,12 +53,8 @@ class TriggerRequest extends FormRequest
|
||||
return null;
|
||||
}
|
||||
$value = (string)$value;
|
||||
$result = null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
if (false === $result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
}
|
||||
|
||||
private function getAccounts(): array
|
||||
|
@@ -53,12 +53,8 @@ class TestRequest extends FormRequest
|
||||
return null;
|
||||
}
|
||||
$value = (string)$value;
|
||||
$result = null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
if (false === $result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
}
|
||||
|
||||
private function getAccounts(): array
|
||||
|
@@ -53,12 +53,8 @@ class TriggerRequest extends FormRequest
|
||||
return null;
|
||||
}
|
||||
$value = (string)$value;
|
||||
$result = null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
if (false === $result) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $result;
|
||||
return null === $this->query($field) ? null : Carbon::createFromFormat('Y-m-d', substr($value, 0, 10));
|
||||
}
|
||||
|
||||
private function getAccounts(): array
|
||||
|
@@ -54,14 +54,6 @@ class UpdateController extends Controller
|
||||
);
|
||||
}
|
||||
|
||||
public function useUserGroup(UserGroup $userGroup): JsonResponse
|
||||
{
|
||||
// group validation is already in place, so can just update the user.
|
||||
$this->repository->useUserGroup($userGroup);
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
|
||||
public function update(UpdateRequest $request, UserGroup $userGroup): JsonResponse
|
||||
{
|
||||
$all = $request->getAll();
|
||||
@@ -87,4 +79,12 @@ class UpdateController extends Controller
|
||||
->header('Content-Type', self::CONTENT_TYPE)
|
||||
;
|
||||
}
|
||||
|
||||
public function useUserGroup(UserGroup $userGroup): JsonResponse
|
||||
{
|
||||
// group validation is already in place, so can just update the user.
|
||||
$this->repository->useUserGroup($userGroup);
|
||||
|
||||
return response()->json([], 204);
|
||||
}
|
||||
}
|
||||
|
@@ -30,20 +30,10 @@ use Symfony\Component\Console\Command\Command as CommandAlias;
|
||||
|
||||
class MigratePreferences extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'firefly-iii:migrate-preferences';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Give Firefly III preferences a user group ID so they can be made administration specific.';
|
||||
|
||||
protected $signature = 'firefly-iii:migrate-preferences';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
|
@@ -191,7 +191,7 @@ class ExportData extends Command
|
||||
$this->friendlyError(sprintf('%s date "%s" must be formatted YYYY-MM-DD. Field will be ignored.', $field, $this->option('start')));
|
||||
$error = true;
|
||||
}
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
$this->friendlyError(sprintf('%s date "%s" must be formatted YYYY-MM-DD.', $field, $this->option('start')));
|
||||
|
||||
throw new FireflyException(sprintf('%s date "%s" must be formatted YYYY-MM-DD.', $field, $this->option('start')));
|
||||
|
@@ -32,24 +32,13 @@ class LaravelPassportKeys extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'firefly-iii:laravel-passport-keys';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Calls the Laravel "passport:keys" but doesn\'t exit 1.';
|
||||
protected $signature = 'firefly-iii:laravel-passport-keys';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
public function handle(): int
|
||||
{
|
||||
Artisan::call('passport:keys --no-interaction', []);
|
||||
$result = Artisan::output();
|
||||
|
@@ -285,7 +285,7 @@ class ApplyRules extends Command
|
||||
if (null !== $endString && '' !== $endString) {
|
||||
$inputEnd = Carbon::createFromFormat('Y-m-d', $endString);
|
||||
}
|
||||
if (false === $inputEnd || false === $inputStart) {
|
||||
if (null === $inputEnd || null === $inputStart) {
|
||||
Log::error('Could not parse start or end date in verifyInputDate().');
|
||||
|
||||
return;
|
||||
|
@@ -405,7 +405,7 @@ class UserEventHandler
|
||||
}
|
||||
// clean up old entries (6 months)
|
||||
$carbon = Carbon::createFromFormat('Y-m-d H:i:s', $preference[$index]['time']);
|
||||
if (false !== $carbon && $carbon->diffInMonths(today(), true) > 6) {
|
||||
if (null !== $carbon && $carbon->diffInMonths(today(), true) > 6) {
|
||||
app('log')->debug(sprintf('Entry for %s is very old, remove it.', $row['ip']));
|
||||
unset($preference[$index]);
|
||||
}
|
||||
|
@@ -128,7 +128,7 @@ class BudgetLimitController extends Controller
|
||||
$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));
|
||||
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
|
||||
|
||||
if (false === $start || false === $end) {
|
||||
if (null === $start || null === $end) {
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
|
@@ -79,10 +79,10 @@ class HomeController extends Controller
|
||||
app('log')->error(sprintf('End could not parse date string "%s" so ignore it.', $stringEnd));
|
||||
$end = Carbon::now()->endOfMonth();
|
||||
}
|
||||
if (false === $start) {
|
||||
if (null === $start) {
|
||||
$start = Carbon::now()->startOfMonth();
|
||||
}
|
||||
if (false === $end) {
|
||||
if (null === $end) {
|
||||
$end = Carbon::now()->endOfMonth();
|
||||
}
|
||||
|
||||
|
@@ -130,7 +130,7 @@ class BoxController extends Controller
|
||||
$boxTitle = (string)trans('firefly.left_to_spend');
|
||||
$activeDaysLeft = $this->activeDaysLeft($start, $end); // see method description.
|
||||
$display = 1; // not overspent
|
||||
$leftPerDayAmount = 0 === (int) $activeDaysLeft ? $leftToSpendAmount : bcdiv($leftToSpendAmount, (string)$activeDaysLeft);
|
||||
$leftPerDayAmount = 0 === $activeDaysLeft ? $leftToSpendAmount : bcdiv($leftToSpendAmount, (string)$activeDaysLeft);
|
||||
app('log')->debug(sprintf('Left to spend per day is %s', $leftPerDayAmount));
|
||||
}
|
||||
}
|
||||
|
@@ -81,7 +81,7 @@ class RecurrenceController extends Controller
|
||||
$skip = $skip < 0 || $skip > 31 ? 0 : $skip;
|
||||
$weekend = $weekend < 1 || $weekend > 4 ? 1 : $weekend;
|
||||
|
||||
if (false === $start || false === $end || false === $firstDate || false === $endDate) {
|
||||
if (null === $start || null === $end || null === $firstDate || null === $endDate) {
|
||||
return response()->json();
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class RecurrenceController extends Controller
|
||||
$actualEnd = clone $end;
|
||||
|
||||
if ('until_date' === $endsAt) {
|
||||
$actualEnd = $endDate ?? clone $end;
|
||||
$actualEnd = $endDate;
|
||||
$occurrences = $this->recurring->getOccurrencesInRange($repetition, $actualStart, $actualEnd);
|
||||
}
|
||||
if ('times' === $endsAt) {
|
||||
@@ -155,7 +155,7 @@ class RecurrenceController extends Controller
|
||||
} catch (InvalidFormatException $e) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
return response()->json();
|
||||
}
|
||||
$date->startOfDay();
|
||||
|
@@ -223,8 +223,8 @@ class PreferencesController extends Controller
|
||||
|
||||
// same for locale:
|
||||
if (!auth()->user()->hasRole('demo')) {
|
||||
/** @var Preference $locale */
|
||||
$locale = $request->get('locale');
|
||||
$locale = (string) $request->get('locale');
|
||||
$locale = '' === $locale ? null : $locale;
|
||||
app('preferences')->set('locale', $locale);
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Auth;
|
||||
use FireflyIII\Events\UserChangedEmail;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Exceptions\ValidationException;
|
||||
@@ -467,9 +466,7 @@ class ProfileController extends Controller
|
||||
if (is_array($secret)) {
|
||||
$secret = null;
|
||||
}
|
||||
if (is_int($secret)) {
|
||||
$secret = (string)$secret;
|
||||
}
|
||||
|
||||
$repository->setMFACode($user, $secret);
|
||||
|
||||
|
@@ -119,7 +119,7 @@ class DownloadExchangeRates implements ShouldQueue
|
||||
return;
|
||||
}
|
||||
$date = Carbon::createFromFormat('Y-m-d', $json['date'], config('app.timezone'));
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
return;
|
||||
}
|
||||
$this->saveRates($currency, $date, $json['rates']);
|
||||
|
@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property null|Carbon $updated_at
|
||||
* @property int $user_id
|
||||
* @property string $name
|
||||
* @property null|array|int|string $data
|
||||
* @property null|array|bool|int|string $data
|
||||
* @property User $user
|
||||
*
|
||||
* @method static Builder|Preference newModelQuery()
|
||||
|
@@ -69,7 +69,10 @@ class AppServiceProvider extends ServiceProvider
|
||||
if ('' === $firstParam && str_contains($name, $route)) {
|
||||
return true;
|
||||
}
|
||||
$params = Route::getCurrentRoute()->parameters() ?? [];
|
||||
|
||||
/** @var null|array $params */
|
||||
$params = Route::getCurrentRoute()->parameters();
|
||||
$params ??= [];
|
||||
$objectType = $params['objectType'] ?? '';
|
||||
if ($objectType === $firstParam && str_contains($name, $route)) {
|
||||
return true;
|
||||
|
@@ -473,7 +473,7 @@ class RecurringRepository implements RecurringRepositoryInterface
|
||||
if ('yearly' === $repetition->repetition_type) {
|
||||
$today = today(config('app.timezone'))->endOfYear();
|
||||
$repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment);
|
||||
if (false === $repDate) {
|
||||
if (null === $repDate) {
|
||||
$repDate = clone $today;
|
||||
}
|
||||
$diffInYears = (int)$today->diffInYears($repDate, true);
|
||||
|
@@ -242,6 +242,30 @@ class UserRepository implements UserRepositoryInterface
|
||||
return false;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getUserGroups(User $user): Collection
|
||||
{
|
||||
$memberships = $user->groupMemberships()->get();
|
||||
$set = [];
|
||||
$collection = new Collection();
|
||||
|
||||
/** @var GroupMembership $membership */
|
||||
foreach ($memberships as $membership) {
|
||||
/** @var null|UserGroup $group */
|
||||
$group = $membership->userGroup()->first();
|
||||
if (null !== $group) {
|
||||
$groupId = $group->id;
|
||||
if (in_array($groupId, array_keys($set), true)) {
|
||||
continue;
|
||||
}
|
||||
$set[$groupId] = $group;
|
||||
}
|
||||
}
|
||||
$collection->push(...$set);
|
||||
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser
|
||||
{
|
||||
$now = today(config('app.timezone'));
|
||||
@@ -392,28 +416,4 @@ class UserRepository implements UserRepositoryInterface
|
||||
|
||||
return null !== $invitee;
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function getUserGroups(User $user): Collection
|
||||
{
|
||||
$memberships = $user->groupMemberships()->get();
|
||||
$set = [];
|
||||
$collection = new Collection();
|
||||
|
||||
/** @var GroupMembership $membership */
|
||||
foreach ($memberships as $membership) {
|
||||
/** @var null|UserGroup $group */
|
||||
$group = $membership->userGroup()->first();
|
||||
if (null !== $group) {
|
||||
$groupId = (int)$group->id;
|
||||
if (in_array($groupId, $set, true)) {
|
||||
continue;
|
||||
}
|
||||
$set[$groupId] = $group;
|
||||
}
|
||||
}
|
||||
$collection->push(...$set);
|
||||
|
||||
return $collection;
|
||||
}
|
||||
}
|
||||
|
@@ -59,8 +59,6 @@ interface UserRepositoryInterface
|
||||
|
||||
public function changeStatus(User $user, bool $isBlocked, string $code): bool;
|
||||
|
||||
public function getUserGroups(User $user): Collection;
|
||||
|
||||
/**
|
||||
* Returns a count of all users.
|
||||
*/
|
||||
@@ -96,6 +94,8 @@ interface UserRepositoryInterface
|
||||
*/
|
||||
public function getUserData(User $user): array;
|
||||
|
||||
public function getUserGroups(User $user): Collection;
|
||||
|
||||
public function hasRole(null|Authenticatable|User $user, string $role): bool;
|
||||
|
||||
public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser;
|
||||
|
@@ -106,8 +106,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface
|
||||
/** @var null|UserGroup $group */
|
||||
$group = $membership->userGroup()->first();
|
||||
if (null !== $group) {
|
||||
$groupId = (int)$group->id;
|
||||
if (in_array($groupId, $set, true)) {
|
||||
$groupId = $group->id;
|
||||
if (in_array($groupId, array_keys($set), true)) {
|
||||
continue;
|
||||
}
|
||||
$set[$groupId] = $group;
|
||||
|
@@ -38,8 +38,6 @@ interface UserGroupRepositoryInterface
|
||||
|
||||
public function get(): Collection;
|
||||
|
||||
public function useUserGroup(UserGroup $userGroup): void;
|
||||
|
||||
public function getAll(): Collection;
|
||||
|
||||
public function setUser(null|Authenticatable|User $user): void;
|
||||
@@ -49,4 +47,6 @@ interface UserGroupRepositoryInterface
|
||||
public function update(UserGroup $userGroup, array $data): UserGroup;
|
||||
|
||||
public function updateMembership(UserGroup $userGroup, array $data): UserGroup;
|
||||
|
||||
public function useUserGroup(UserGroup $userGroup): void;
|
||||
}
|
||||
|
@@ -63,6 +63,8 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function getMetaValue(Account $account, string $field): ?string;
|
||||
|
||||
public function getUserGroup(): UserGroup;
|
||||
|
||||
/**
|
||||
* Reset order types of the mentioned accounts.
|
||||
*/
|
||||
@@ -74,7 +76,5 @@ interface AccountRepositoryInterface
|
||||
|
||||
public function setUserGroup(UserGroup $userGroup): void;
|
||||
|
||||
public function getUserGroup(): UserGroup;
|
||||
|
||||
public function update(Account $account, array $data): Account;
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ class UpdateRequest implements UpdateRequestInterface
|
||||
// parse response a bit. No message yet.
|
||||
$response = $json['firefly_iii'][$channel];
|
||||
$date = Carbon::createFromFormat('Y-m-d', $response['date']);
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$return['version'] = $response['version'];
|
||||
|
@@ -146,7 +146,7 @@ class RemoteUserGuard implements Guard
|
||||
return $this->user?->id;
|
||||
}
|
||||
|
||||
public function setUser(null|Authenticatable|User $user): void
|
||||
public function setUser(null|Authenticatable|User $user): void // @phpstan-ignore-line
|
||||
{
|
||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||
if ($user instanceof User) {
|
||||
|
@@ -36,6 +36,14 @@ use Illuminate\Contracts\Auth\UserProvider;
|
||||
*/
|
||||
class RemoteUserProvider implements UserProvider
|
||||
{
|
||||
#[\Override]
|
||||
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void
|
||||
{
|
||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||
|
||||
throw new FireflyException(sprintf('Did not implement %s', __METHOD__));
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*
|
||||
@@ -120,12 +128,4 @@ class RemoteUserProvider implements UserProvider
|
||||
|
||||
throw new FireflyException(sprintf('C) Did not implement %s', __METHOD__));
|
||||
}
|
||||
|
||||
#[\Override]
|
||||
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void
|
||||
{
|
||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||
|
||||
throw new FireflyException(sprintf('Did not implement %s', __METHOD__));
|
||||
}
|
||||
}
|
||||
|
@@ -145,14 +145,14 @@ trait RequestInformation
|
||||
$attributes['location'] ??= '';
|
||||
$attributes['accounts'] = AccountList::routeBinder($attributes['accounts'] ?? '', new Route('get', '', []));
|
||||
$date = Carbon::createFromFormat('Ymd', $attributes['startDate']);
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$date->startOfMonth();
|
||||
$attributes['startDate'] = $date;
|
||||
|
||||
$date2 = Carbon::createFromFormat('Ymd', $attributes['endDate']);
|
||||
if (false === $date2) {
|
||||
if (null === $date2) {
|
||||
$date2 = today(config('app.timezone'));
|
||||
}
|
||||
$date2->endOfDay();
|
||||
|
@@ -188,7 +188,7 @@ class Navigation
|
||||
Log::debug(sprintf('Function is ->%s()', $function));
|
||||
if (array_key_exists($function, $parameterMap)) {
|
||||
Log::debug(sprintf('Parameter map, function becomes ->%s(%s)', $function, implode(', ', $parameterMap[$function])));
|
||||
$date->{$function}($parameterMap[$function][0]);
|
||||
$date->{$function}($parameterMap[$function][0]); // @phpstan-ignore-line
|
||||
Log::debug(sprintf('Result is "%s"', $date->toIso8601String()));
|
||||
|
||||
return $date;
|
||||
|
@@ -25,6 +25,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Carbon\CarbonInterface;
|
||||
use Carbon\Exceptions\InvalidFormatException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -122,12 +123,12 @@ class ParseDateString
|
||||
{
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
|
||||
return match ($keyword) {
|
||||
return match ($keyword) { // @phpstan-ignore-line
|
||||
default => $today,
|
||||
'yesterday' => $today->subDay(),
|
||||
'tomorrow' => $today->addDay(),
|
||||
'start of this week' => $today->startOfWeek(Carbon::MONDAY),
|
||||
'end of this week' => $today->endOfWeek(Carbon::SUNDAY),
|
||||
'start of this week' => $today->startOfWeek(CarbonInterface::MONDAY),
|
||||
'end of this week' => $today->endOfWeek(CarbonInterface::SUNDAY),
|
||||
'start of this month' => $today->startOfMonth(),
|
||||
'end of this month' => $today->endOfMonth(),
|
||||
'start of this quarter' => $today->startOfQuarter(),
|
||||
|
@@ -89,6 +89,17 @@ class Preferences
|
||||
return $this->setForUser($user, $name, $default);
|
||||
}
|
||||
|
||||
private function getUserGroupId(User $user, string $preferenceName): ?int
|
||||
{
|
||||
$groupId = null;
|
||||
$items = config('firefly.admin_specific_prefs') ?? [];
|
||||
if (in_array($preferenceName, $items, true)) {
|
||||
$groupId = (int)$user->user_group_id;
|
||||
}
|
||||
|
||||
return $groupId;
|
||||
}
|
||||
|
||||
public function delete(string $name): bool
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', auth()->user()->id, $name);
|
||||
@@ -215,7 +226,7 @@ class Preferences
|
||||
|
||||
public function set(string $name, null|array|bool|int|string $value): Preference
|
||||
{
|
||||
/** @var User $user */
|
||||
/** @var null|User $user */
|
||||
$user = auth()->user();
|
||||
if (null === $user) {
|
||||
// make new preference, return it:
|
||||
@@ -228,15 +239,4 @@ class Preferences
|
||||
|
||||
return $this->setForUser($user, $name, $value);
|
||||
}
|
||||
|
||||
private function getUserGroupId(User $user, string $preferenceName): ?int
|
||||
{
|
||||
$groupId = null;
|
||||
$items = config('firefly.admin_specific_prefs') ?? [];
|
||||
if (in_array($preferenceName, $items, true)) {
|
||||
$groupId = (int)$user->user_group_id;
|
||||
}
|
||||
|
||||
return $groupId;
|
||||
}
|
||||
}
|
||||
|
@@ -250,7 +250,7 @@ trait ConvertsDataTypes
|
||||
|
||||
return null;
|
||||
}
|
||||
if (false === $carbon) {
|
||||
if (null === $carbon) {
|
||||
app('log')->error(sprintf('[2] "%s" is of an invalid format.', $value));
|
||||
|
||||
return null;
|
||||
|
@@ -185,7 +185,7 @@ class AccountTransformer extends AbstractTransformer
|
||||
// try classic date:
|
||||
if (10 === strlen($monthlyPaymentDate)) {
|
||||
$object = Carbon::createFromFormat('!Y-m-d', $monthlyPaymentDate, config('app.timezone'));
|
||||
if (false === $object) {
|
||||
if (null === $object) {
|
||||
$object = today(config('app.timezone'));
|
||||
}
|
||||
$monthlyPaymentDate = $object->toAtomString();
|
||||
@@ -212,7 +212,7 @@ class AccountTransformer extends AbstractTransformer
|
||||
}
|
||||
if (null !== $openingBalanceDate) {
|
||||
$object = Carbon::createFromFormat('Y-m-d H:i:s', $openingBalanceDate, config('app.timezone'));
|
||||
if (false === $object) {
|
||||
if (null === $object) {
|
||||
$object = today(config('app.timezone'));
|
||||
}
|
||||
$openingBalanceDate = $object->toAtomString();
|
||||
|
@@ -82,7 +82,7 @@ class BillTransformer extends AbstractTransformer
|
||||
$payDatesFormatted = [];
|
||||
foreach ($paidData as $object) {
|
||||
$date = Carbon::createFromFormat('!Y-m-d', $object['date'], config('app.timezone'));
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$object['date'] = $date->toAtomString();
|
||||
@@ -91,7 +91,7 @@ class BillTransformer extends AbstractTransformer
|
||||
|
||||
foreach ($payDates as $string) {
|
||||
$date = Carbon::createFromFormat('!Y-m-d', $string, config('app.timezone'));
|
||||
if (false === $date) {
|
||||
if (null === $date) {
|
||||
$date = today(config('app.timezone'));
|
||||
}
|
||||
$payDatesFormatted[] = $date->toAtomString();
|
||||
@@ -104,7 +104,7 @@ class BillTransformer extends AbstractTransformer
|
||||
|
||||
if (null !== $firstPayDate) {
|
||||
$nemDate = Carbon::createFromFormat('!Y-m-d', $firstPayDate, config('app.timezone'));
|
||||
if (false === $nemDate) {
|
||||
if (null === $nemDate) {
|
||||
$nemDate = today(config('app.timezone'));
|
||||
}
|
||||
$nem = $nemDate->toAtomString();
|
||||
@@ -129,7 +129,7 @@ class BillTransformer extends AbstractTransformer
|
||||
$current = $payDatesFormatted[0] ?? null;
|
||||
if (null !== $current && !$nemDate->isToday()) {
|
||||
$temp2 = Carbon::createFromFormat('Y-m-d\TH:i:sP', $current);
|
||||
if (false === $temp2) {
|
||||
if (null === $temp2) {
|
||||
$temp2 = today(config('app.timezone'));
|
||||
}
|
||||
$nemDiff = trans('firefly.bill_expected_date', ['date' => $temp2->diffForHumans(today(config('app.timezone')), CarbonInterface::DIFF_RELATIVE_TO_NOW)]);
|
||||
|
@@ -462,7 +462,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
// app('log')->debug(sprintf('Now in date("%s")', $string));
|
||||
if (10 === strlen($string)) {
|
||||
$res = Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
|
||||
if (false === $res) {
|
||||
if (null === $res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
}
|
||||
if (19 === strlen($string) && str_contains($string, 'T')) {
|
||||
$res = Carbon::createFromFormat('Y-m-d\TH:i:s', substr($string, 0, 19), config('app.timezone'));
|
||||
if (false === $res) {
|
||||
if (null === $res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
|
||||
// 2022-01-01 01:01:01
|
||||
$res = Carbon::createFromFormat('Y-m-d H:i:s', substr($string, 0, 19), config('app.timezone'));
|
||||
if (false === $res) {
|
||||
if (null === $res) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -35,9 +35,9 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
class UserGroupTransformer extends AbstractTransformer
|
||||
{
|
||||
private array $inUse;
|
||||
private array $memberships;
|
||||
private array $membershipsVisible;
|
||||
private array $inUse;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -46,7 +45,7 @@ class ExpandTransactionsTable extends Migration
|
||||
$table->dropColumn('identifier');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not drop column "identifier": %s', $e->getMessage()));
|
||||
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -74,7 +73,7 @@ class ChangesForV431 extends Migration
|
||||
$table->renameColumn('start_date', 'startdate');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -89,7 +88,7 @@ class ChangesForV431 extends Migration
|
||||
$table->dropColumn('end_date');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -103,7 +102,7 @@ class ChangesForV431 extends Migration
|
||||
$table->dropColumn('decimal_places');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -141,7 +140,7 @@ class ChangesForV431 extends Migration
|
||||
$table->renameColumn('startdate', 'start_date');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -171,7 +170,7 @@ class ChangesForV431 extends Migration
|
||||
$table->dropColumn('repeats');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -184,7 +183,7 @@ class ChangesForV431 extends Migration
|
||||
$table->dropColumn('repeat_freq');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -53,7 +52,7 @@ class ChangesForV440 extends Migration
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -47,7 +46,7 @@ class ChangesForV450 extends Migration
|
||||
$table->dropColumn('foreign_amount');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -75,7 +74,7 @@ class ChangesForV450 extends Migration
|
||||
$table->dropColumn('foreign_currency_id');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -47,7 +46,7 @@ class ChangesForV470a extends Migration
|
||||
$table->dropColumn('reconciled');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -61,7 +60,7 @@ class ChangesForV472 extends Migration
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -83,7 +82,7 @@ class ChangesForV472 extends Migration
|
||||
$table->dropColumn('notes');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -52,7 +51,7 @@ class ChangesForV473 extends Migration
|
||||
$table->dropColumn('transaction_currency_id');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -66,7 +65,7 @@ class ChangesForV473 extends Migration
|
||||
$table->dropColumn('strict');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -52,7 +51,7 @@ class ChangesForV477 extends Migration
|
||||
$table->dropColumn(['transaction_currency_id']);
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -47,7 +46,7 @@ class ChangesForV479 extends Migration
|
||||
$table->dropColumn(['enabled']);
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -47,7 +46,7 @@ class FixLdapConfiguration extends Migration
|
||||
$table->dropColumn(['objectguid']);
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -21,7 +21,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -57,7 +56,7 @@ class ChangesForV480 extends Migration
|
||||
|
||||
try {
|
||||
$table->dropColumn('transaction_group_id');
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
|
||||
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -77,7 +76,7 @@ class ChangesForV480 extends Migration
|
||||
static function (Blueprint $table): void {
|
||||
try {
|
||||
$table->dropColumn('stop_processing');
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
|
||||
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -97,7 +96,7 @@ class ChangesForV480 extends Migration
|
||||
static function (Blueprint $table): void {
|
||||
try {
|
||||
$table->dropColumn('mfa_secret');
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not drop column: %s', $e->getMessage()));
|
||||
app('log')->error('If the column does not exist, this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -48,7 +47,7 @@ class ChangesForV530a extends Migration
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -48,7 +47,7 @@ class ChangesForV540 extends Migration
|
||||
$table->dropColumn('provider');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -62,7 +61,7 @@ class ChangesForV540 extends Migration
|
||||
$table->dropColumn('order');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -76,7 +75,7 @@ class ChangesForV540 extends Migration
|
||||
$table->dropColumn('end_date');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -89,7 +88,7 @@ class ChangesForV540 extends Migration
|
||||
$table->dropColumn('extension_date');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -76,7 +75,7 @@ class ChangesForV550 extends Migration
|
||||
$table->dropColumn('budget_limit_id');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -95,7 +94,7 @@ class ChangesForV550 extends Migration
|
||||
$table->dropColumn('period');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -108,7 +107,7 @@ class ChangesForV550 extends Migration
|
||||
$table->dropColumn('generated');
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -51,7 +50,7 @@ class ChangesForV550b2 extends Migration
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -43,7 +42,7 @@ class AddLdapColumnsToUsersTable extends Migration
|
||||
$table->dropColumn(['domain']);
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -72,7 +71,7 @@ class UserGroups extends Migration
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
@@ -92,7 +91,7 @@ class UserGroups extends Migration
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -69,7 +68,7 @@ return new class () extends Migration {
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
@@ -71,7 +70,7 @@ return new class () extends Migration {
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (ColumnDoesNotExist|QueryException $e) {
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error(sprintf('Could not execute query: %s', $e->getMessage()));
|
||||
app('log')->error('If the column or index already exists (see error), this is not an problem. Otherwise, please open a GitHub discussion.');
|
||||
}
|
||||
|
@@ -68,6 +68,20 @@ final class CalculatorTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
private static function convert(Periodicity $periodicity, array $intervals): array
|
||||
{
|
||||
$periodicityIntervals = [];
|
||||
|
||||
/** @var IntervalProvider $interval */
|
||||
foreach ($intervals as $index => $interval) {
|
||||
$calculator = CalculatorProvider::from($periodicity, $interval);
|
||||
|
||||
$periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator];
|
||||
}
|
||||
|
||||
return $periodicityIntervals;
|
||||
}
|
||||
|
||||
public static function provideSkippedIntervals(): iterable
|
||||
{
|
||||
return CalculatorProvider::providePeriodicityWithSkippedIntervals();
|
||||
@@ -96,18 +110,4 @@ final class CalculatorTest extends TestCase
|
||||
$period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip);
|
||||
self::assertSame($provider->expected()->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
private static function convert(Periodicity $periodicity, array $intervals): array
|
||||
{
|
||||
$periodicityIntervals = [];
|
||||
|
||||
/** @var IntervalProvider $interval */
|
||||
foreach ($intervals as $index => $interval) {
|
||||
$calculator = CalculatorProvider::from($periodicity, $interval);
|
||||
|
||||
$periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator];
|
||||
}
|
||||
|
||||
return $periodicityIntervals;
|
||||
}
|
||||
}
|
||||
|
@@ -77,15 +77,6 @@ final class NavigationEndOfPeriodTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDates
|
||||
*/
|
||||
public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void
|
||||
{
|
||||
$period = clone $this->navigation->endOfPeriod($from, $frequency);
|
||||
self::assertSame($expected->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
public static function provideUnknownFrequencies(): iterable
|
||||
{
|
||||
return [
|
||||
@@ -95,6 +86,15 @@ final class NavigationEndOfPeriodTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideDates
|
||||
*/
|
||||
public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void
|
||||
{
|
||||
$period = clone $this->navigation->endOfPeriod($from, $frequency);
|
||||
self::assertSame($expected->toDateString(), $period->toDateString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideUnknownFrequencies
|
||||
*/
|
||||
|
Reference in New Issue
Block a user