mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-16 09:51:16 +00:00
Fix various phpstan issues.
This commit is contained in:
@@ -11,8 +11,6 @@ parameters:
|
|||||||
reportUnmatchedIgnoredErrors: true
|
reportUnmatchedIgnoredErrors: true
|
||||||
ignoreErrors:
|
ignoreErrors:
|
||||||
# TODO: slowly remove these exceptions and fix the issues found.
|
# TODO: slowly remove these exceptions and fix the issues found.
|
||||||
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
|
|
||||||
- identifier: varTag.nativeType
|
|
||||||
- identifier: varTag.type
|
- identifier: varTag.type
|
||||||
-
|
-
|
||||||
identifier: larastan.noEnvCallsOutsideOfConfig
|
identifier: larastan.noEnvCallsOutsideOfConfig
|
||||||
@@ -24,11 +22,11 @@ parameters:
|
|||||||
- '#expects view-string\|null, string given#'
|
- '#expects view-string\|null, string given#'
|
||||||
|
|
||||||
# phpstan can't handle this so we ignore them.
|
# phpstan can't handle this so we ignore them.
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#' # is custom scope
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#' # is custom scope
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#' # is to allow soft delete
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::accountTypeIn#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::accountTypeIn#' # is a custom scope
|
||||||
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::withTrashed#'
|
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::withTrashed#' # is to allow soft delete
|
||||||
|
|
||||||
# The level 8 is the highest level. original was 5
|
# The level 8 is the highest level. original was 5
|
||||||
# 7 is more than enough, higher just leaves NULL things.
|
# 7 is more than enough, higher just leaves NULL things.
|
||||||
|
@@ -157,7 +157,6 @@ abstract class Controller extends BaseController
|
|||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
|
|
||||||
/** @var Preference $pageSize */
|
|
||||||
$pageSize = (int)app('preferences')->getForUser($user, 'listPageSize', 50)->data;
|
$pageSize = (int)app('preferences')->getForUser($user, 'listPageSize', 50)->data;
|
||||||
$bag->set($integer, $pageSize);
|
$bag->set($integer, $pageSize);
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,7 @@ class RemovesDatabaseDecryption extends Command
|
|||||||
* @var string $table
|
* @var string $table
|
||||||
* @var array $fields
|
* @var array $fields
|
||||||
*/
|
*/
|
||||||
foreach ($tables as $table => $fields) {
|
foreach ($tables as $table => $fields) { // @phpstan-ignore-line
|
||||||
$this->decryptTable($table, $fields);
|
$this->decryptTable($table, $fields);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -170,7 +170,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var null|Account $account */
|
/** @var null|Account $account */
|
||||||
$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);
|
$account = $user->accounts()->withTrashed()->with(['accountType'])->find($accountId);
|
||||||
if (null === $account) {
|
if (null === $account) {
|
||||||
app('log')->error(sprintf('Could not find account %d, so give big fat error.', $accountId));
|
app('log')->error(sprintf('Could not find account %d, so give big fat error.', $accountId));
|
||||||
|
|
||||||
|
@@ -129,7 +129,7 @@ class UserEventHandler
|
|||||||
$groupTitle = $user->email;
|
$groupTitle = $user->email;
|
||||||
$index = 1;
|
$index = 1;
|
||||||
|
|
||||||
/** @var UserGroup $group */
|
/** @var UserGroup|null $group */
|
||||||
$group = null;
|
$group = null;
|
||||||
|
|
||||||
// create a new group.
|
// create a new group.
|
||||||
|
@@ -412,7 +412,7 @@ class ProfileController extends Controller
|
|||||||
// found user.which email address to return to?
|
// found user.which email address to return to?
|
||||||
$set = app('preferences')->beginsWith($user, 'previous_email_');
|
$set = app('preferences')->beginsWith($user, 'previous_email_');
|
||||||
|
|
||||||
/** @var string $match */
|
/** @var string|null $match */
|
||||||
$match = null;
|
$match = null;
|
||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $entry->data));
|
$hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $entry->data));
|
||||||
|
@@ -117,7 +117,7 @@ class BulkController extends Controller
|
|||||||
|
|
||||||
// run rules on changed journals:
|
// run rules on changed journals:
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
foreach ($collection as $journal) {
|
foreach ($collection as $journal) { // @phpstan-ignore-line
|
||||||
event(new UpdatedTransactionGroup($journal->transactionGroup, true, true, false));
|
event(new UpdatedTransactionGroup($journal->transactionGroup, true, true, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -138,7 +138,7 @@ class RecurrenceFormRequest extends FormRequest
|
|||||||
* @var int $index
|
* @var int $index
|
||||||
* @var array $transaction
|
* @var array $transaction
|
||||||
*/
|
*/
|
||||||
foreach ($return['transactions'] as $index => $transaction) {
|
foreach ($return['transactions'] as $index => $transaction) { // @phpstan-ignore-line
|
||||||
$categoryName = $transaction['category_name'] ?? null;
|
$categoryName = $transaction['category_name'] ?? null;
|
||||||
if (null !== $categoryName) {
|
if (null !== $categoryName) {
|
||||||
$category = $factory->findOrCreate(null, $categoryName);
|
$category = $factory->findOrCreate(null, $categoryName);
|
||||||
|
@@ -53,7 +53,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
/** @var GroupMembership $membership */
|
/** @var GroupMembership $membership */
|
||||||
foreach ($memberships as $membership) {
|
foreach ($memberships as $membership) {
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = $membership->user()->first();
|
$user = $membership->user()->first();
|
||||||
if (null === $user) {
|
if (null === $user) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -82,8 +82,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
// all users are now moved away from user group.
|
// all users are now moved away from user group.
|
||||||
// time to DESTROY all objects.
|
// time to DESTROY all objects.
|
||||||
// we have to do this one by one to trigger the necessary observers :(
|
// we have to do this one by one to trigger the necessary observers :(
|
||||||
$objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups',
|
$objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups',
|
||||||
'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) { // @phpstan-ignore-line
|
foreach ($userGroup->{$object}()->get() as $item) { // @phpstan-ignore-line
|
||||||
@@ -110,7 +110,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
/** @var null|UserGroup $group */
|
/** @var null|UserGroup $group */
|
||||||
$group = $membership->userGroup()->first();
|
$group = $membership->userGroup()->first();
|
||||||
if (null !== $group) {
|
if (null !== $group) {
|
||||||
$groupId = $group->id;
|
$groupId = $group->id;
|
||||||
if (in_array($groupId, array_keys($set), true)) {
|
if (in_array($groupId, array_keys($set), true)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -135,15 +135,12 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
while ($exists && $loop < 10) {
|
while ($exists && $loop < 10) {
|
||||||
$existingGroup = $this->findByName($groupName);
|
$existingGroup = $this->findByName($groupName);
|
||||||
if (!$existingGroup instanceof UserGroup) {
|
if (!$existingGroup instanceof UserGroup) {
|
||||||
$exists = false;
|
$exists = false;
|
||||||
|
|
||||||
/** @var null|UserGroup $existingGroup */
|
/** @var UserGroup $existingGroup */
|
||||||
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
|
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
|
||||||
}
|
}
|
||||||
if (null !== $existingGroup) {
|
$groupName = sprintf('%s-%s', $user->email, substr(sha1(random_int(1000, 9999) . microtime()), 0, 4));
|
||||||
// group already exists
|
|
||||||
$groupName = sprintf('%s-%s', $user->email, substr(sha1(random_int(1000, 9999).microtime()), 0, 4));
|
|
||||||
}
|
|
||||||
++$loop;
|
++$loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +160,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
$data['user'] = $this->user;
|
$data['user'] = $this->user;
|
||||||
|
|
||||||
/** @var UserGroupFactory $factory */
|
/** @var UserGroupFactory $factory */
|
||||||
$factory = app(UserGroupFactory::class);
|
$factory = app(UserGroupFactory::class);
|
||||||
|
|
||||||
return $factory->create($data);
|
return $factory->create($data);
|
||||||
}
|
}
|
||||||
@@ -194,10 +191,10 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
{
|
{
|
||||||
$userGroup->title = $data['title'];
|
$userGroup->title = $data['title'];
|
||||||
$userGroup->save();
|
$userGroup->save();
|
||||||
$currency = null;
|
$currency = null;
|
||||||
|
|
||||||
/** @var CurrencyRepositoryInterface $repository */
|
/** @var CurrencyRepositoryInterface $repository */
|
||||||
$repository = app(CurrencyRepositoryInterface::class);
|
$repository = app(CurrencyRepositoryInterface::class);
|
||||||
|
|
||||||
if (array_key_exists('primary_currency_code', $data)) {
|
if (array_key_exists('primary_currency_code', $data)) {
|
||||||
$repository->setUser($this->user);
|
$repository->setUser($this->user);
|
||||||
@@ -206,7 +203,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
|
|
||||||
if (array_key_exists('primary_currency_id', $data) && null === $currency) {
|
if (array_key_exists('primary_currency_id', $data) && null === $currency) {
|
||||||
$repository->setUser($this->user);
|
$repository->setUser($this->user);
|
||||||
$currency = $repository->find((int) $data['primary_currency_id']);
|
$currency = $repository->find((int)$data['primary_currency_id']);
|
||||||
}
|
}
|
||||||
if (null !== $currency) {
|
if (null !== $currency) {
|
||||||
$repository->makePrimary($currency);
|
$repository->makePrimary($currency);
|
||||||
@@ -223,17 +220,17 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
*/
|
*/
|
||||||
public function updateMembership(UserGroup $userGroup, array $data): UserGroup
|
public function updateMembership(UserGroup $userGroup, array $data): UserGroup
|
||||||
{
|
{
|
||||||
$owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first();
|
$owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first();
|
||||||
app('log')->debug('in update membership');
|
app('log')->debug('in update membership');
|
||||||
|
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = null;
|
$user = null;
|
||||||
if (array_key_exists('id', $data)) {
|
if (array_key_exists('id', $data)) {
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = User::find($data['id']);
|
$user = User::find($data['id']);
|
||||||
app('log')->debug('Found user by ID');
|
app('log')->debug('Found user by ID');
|
||||||
}
|
}
|
||||||
if (array_key_exists('email', $data) && '' !== (string) $data['email']) {
|
if (array_key_exists('email', $data) && '' !== (string)$data['email']) {
|
||||||
/** @var null|User $user */
|
/** @var null|User $user */
|
||||||
$user = User::whereEmail($data['email'])->first();
|
$user = User::whereEmail($data['email'])->first();
|
||||||
app('log')->debug('Found user by email');
|
app('log')->debug('Found user by email');
|
||||||
@@ -251,13 +248,13 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
if (1 === $membershipCount) {
|
if (1 === $membershipCount) {
|
||||||
$lastUserId = $userGroup->groupMemberships()->distinct()->first(['group_memberships.user_id'])->user_id;
|
$lastUserId = $userGroup->groupMemberships()->distinct()->first(['group_memberships.user_id'])->user_id;
|
||||||
// if this is also the user we're editing right now, and we remove all of their roles:
|
// if this is also the user we're editing right now, and we remove all of their roles:
|
||||||
if ($lastUserId === (int) $user->id && 0 === count($data['roles'])) {
|
if ($lastUserId === (int)$user->id && 0 === count($data['roles'])) {
|
||||||
app('log')->debug('User is last in this group, refuse to act');
|
app('log')->debug('User is last in this group, refuse to act');
|
||||||
|
|
||||||
throw new FireflyException('You cannot remove the last member from this user group. Delete the user group instead.');
|
throw new FireflyException('You cannot remove the last member from this user group. Delete the user group instead.');
|
||||||
}
|
}
|
||||||
// if this is also the user we're editing right now, and do not grant them the owner role:
|
// if this is also the user we're editing right now, and do not grant them the owner role:
|
||||||
if ($lastUserId === (int) $user->id && count($data['roles']) > 0 && !in_array(UserRoleEnum::OWNER->value, $data['roles'], true)) {
|
if ($lastUserId === (int)$user->id && count($data['roles']) > 0 && !in_array(UserRoleEnum::OWNER->value, $data['roles'], true)) {
|
||||||
app('log')->debug('User needs to have owner role in this group, refuse to act');
|
app('log')->debug('User needs to have owner role in this group, refuse to act');
|
||||||
|
|
||||||
throw new FireflyException('The last member in this user group must get or keep the "owner" role.');
|
throw new FireflyException('The last member in this user group must get or keep the "owner" role.');
|
||||||
@@ -266,9 +263,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
|||||||
if ($membershipCount > 1) {
|
if ($membershipCount > 1) {
|
||||||
// group has multiple members. How many are owner, except the user we're editing now?
|
// group has multiple members. How many are owner, except the user we're editing now?
|
||||||
$ownerCount = $userGroup->groupMemberships()
|
$ownerCount = $userGroup->groupMemberships()
|
||||||
->where('user_role_id', $owner->id)
|
->where('user_role_id', $owner->id)
|
||||||
->where('user_id', '!=', $user->id)->count()
|
->where('user_id', '!=', $user->id)->count();
|
||||||
;
|
|
||||||
// if there are no other owners and the current users does not get or keep the owner role, refuse.
|
// if there are no other owners and the current users does not get or keep the owner role, refuse.
|
||||||
if (
|
if (
|
||||||
0 === $ownerCount
|
0 === $ownerCount
|
||||||
|
@@ -25,7 +25,6 @@ declare(strict_types=1);
|
|||||||
namespace FireflyIII\Support\Form;
|
namespace FireflyIII\Support\Form;
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Carbon\Exceptions\InvalidDateException;
|
|
||||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||||
use Illuminate\Support\MessageBag;
|
use Illuminate\Support\MessageBag;
|
||||||
use Throwable;
|
use Throwable;
|
||||||
@@ -37,7 +36,7 @@ trait FormSupport
|
|||||||
{
|
{
|
||||||
public function multiSelect(string $name, ?array $list = null, mixed $selected = null, ?array $options = null): string
|
public function multiSelect(string $name, ?array $list = null, mixed $selected = null, ?array $options = null): string
|
||||||
{
|
{
|
||||||
$list ??= [];
|
$list ??= [];
|
||||||
$label = $this->label($name, $options);
|
$label = $this->label($name, $options);
|
||||||
$options = $this->expandOptionArray($name, $label, $options);
|
$options = $this->expandOptionArray($name, $label, $options);
|
||||||
$classes = $this->getHolderClasses($name);
|
$classes = $this->getHolderClasses($name);
|
||||||
@@ -63,7 +62,7 @@ trait FormSupport
|
|||||||
}
|
}
|
||||||
$name = str_replace('[]', '', $name);
|
$name = str_replace('[]', '', $name);
|
||||||
|
|
||||||
return (string) trans('form.'.$name);
|
return (string)trans('form.' . $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,12 +70,12 @@ trait FormSupport
|
|||||||
*/
|
*/
|
||||||
protected function expandOptionArray(string $name, $label, ?array $options = null): array
|
protected function expandOptionArray(string $name, $label, ?array $options = null): array
|
||||||
{
|
{
|
||||||
$options ??= [];
|
$options ??= [];
|
||||||
$name = str_replace('[]', '', $name);
|
$name = str_replace('[]', '', $name);
|
||||||
$options['class'] = 'form-control';
|
$options['class'] = 'form-control';
|
||||||
$options['id'] = 'ffInput_'.$name;
|
$options['id'] = 'ffInput_' . $name;
|
||||||
$options['autocomplete'] = 'off';
|
$options['autocomplete'] = 'off';
|
||||||
$options['placeholder'] = ucfirst((string) $label);
|
$options['placeholder'] = ucfirst((string)$label);
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
@@ -122,7 +121,7 @@ trait FormSupport
|
|||||||
*/
|
*/
|
||||||
public function select(string $name, ?array $list = null, $selected = null, ?array $options = null): string
|
public function select(string $name, ?array $list = null, $selected = null, ?array $options = null): string
|
||||||
{
|
{
|
||||||
$list ??= [];
|
$list ??= [];
|
||||||
$label = $this->label($name, $options);
|
$label = $this->label($name, $options);
|
||||||
$options = $this->expandOptionArray($name, $label, $options);
|
$options = $this->expandOptionArray($name, $label, $options);
|
||||||
$classes = $this->getHolderClasses($name);
|
$classes = $this->getHolderClasses($name);
|
||||||
@@ -146,15 +145,6 @@ trait FormSupport
|
|||||||
|
|
||||||
protected function getDate(): Carbon
|
protected function getDate(): Carbon
|
||||||
{
|
{
|
||||||
/** @var Carbon $date */
|
return today(config('app.timezone'));
|
||||||
$date = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
$date = today(config('app.timezone'));
|
|
||||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
|
||||||
app('log')->error($e->getMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
return $date;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ trait CleansChartData
|
|||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var mixed $index
|
* @var int $index
|
||||||
* @var array $array
|
* @var array $array
|
||||||
*/
|
*/
|
||||||
foreach ($data as $index => $array) {
|
foreach ($data as $index => $array) {
|
||||||
|
@@ -102,6 +102,9 @@ trait ConvertsDataTypes
|
|||||||
{
|
{
|
||||||
// assume this all works, because the validator would have caught any errors.
|
// assume this all works, because the validator would have caught any errors.
|
||||||
$parameter = (string)request()->query->get($field);
|
$parameter = (string)request()->query->get($field);
|
||||||
|
if('' === $parameter) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
$parts = explode(',', $parameter);
|
$parts = explode(',', $parameter);
|
||||||
$sortParameters = [];
|
$sortParameters = [];
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
|
@@ -317,7 +317,7 @@ class SearchRuleEngine implements RuleEngineInterface
|
|||||||
Log::debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count()));
|
Log::debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count()));
|
||||||
|
|
||||||
/** @var Rule $rule */
|
/** @var Rule $rule */
|
||||||
foreach ($this->rules as $rule) {
|
foreach ($this->rules as $rule) { // @phpstan-ignore-line
|
||||||
$result = $this->fireRule($rule);
|
$result = $this->fireRule($rule);
|
||||||
if (true === $result && true === $rule->stop_processing) {
|
if (true === $result && true === $rule->stop_processing) {
|
||||||
Log::debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id));
|
Log::debug(sprintf('Rule #%d has triggered and executed, but calls to stop processing. Since not in the context of a group, do not stop.', $rule->id));
|
||||||
@@ -335,7 +335,7 @@ class SearchRuleEngine implements RuleEngineInterface
|
|||||||
|
|
||||||
// fire each group:
|
// fire each group:
|
||||||
/** @var RuleGroup $group */
|
/** @var RuleGroup $group */
|
||||||
foreach ($this->groups as $group) {
|
foreach ($this->groups as $group) { // @phpstan-ignore-line
|
||||||
$this->fireGroup($group);
|
$this->fireGroup($group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -36,7 +36,7 @@ class TransactionTypeSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
/** @var TransactionTypeEnum $type */
|
/** @var TransactionTypeEnum $type */
|
||||||
foreach (TransactionTypeEnum::cases() as $type) {
|
foreach (TransactionTypeEnum::cases() as $type) { // @phpstan-ignore-line
|
||||||
if (null === TransactionType::where('type', $type->value)->first()) {
|
if (null === TransactionType::where('type', $type->value)->first()) {
|
||||||
try {
|
try {
|
||||||
TransactionType::create(['type' => $type->value]);
|
TransactionType::create(['type' => $type->value]);
|
||||||
|
@@ -40,7 +40,7 @@ class UserRoleSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
/** @var UserRoleEnum $role */
|
/** @var UserRoleEnum $role */
|
||||||
foreach (UserRoleEnum::cases() as $role) {
|
foreach (UserRoleEnum::cases() as $role) { // @phpstan-ignore-line
|
||||||
if (null === UserRole::where('title', $role->value)->first()) {
|
if (null === UserRole::where('title', $role->value)->first()) {
|
||||||
try {
|
try {
|
||||||
UserRole::create(['title' => $role->value]);
|
UserRole::create(['title' => $role->value]);
|
||||||
|
Reference in New Issue
Block a user