Code cleanup.

This commit is contained in:
James Cole
2021-03-28 11:46:23 +02:00
parent 2c575f3ca5
commit b5eeacc128
124 changed files with 1568 additions and 1384 deletions

View File

@@ -39,36 +39,36 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class Account
*
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property int $account_type_id
* @property string $name
* @property string|null $virtual_balance
* @property string|null $iban
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property int $account_type_id
* @property string $name
* @property string|null $virtual_balance
* @property string|null $iban
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
* @property-read int|null $account_meta_count
* @property-read \FireflyIII\Models\AccountType $accountType
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read string $account_number
* @property-read string $edit_name
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Location[] $locations
* @property-read int|null $locations_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
* @property-read int|null $notes_count
* @property-read int|null $account_meta_count
* @property-read \FireflyIII\Models\AccountType $accountType
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read string $account_number
* @property-read string $edit_name
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Location[] $locations
* @property-read int|null $locations_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
* @property-read int|null $notes_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ObjectGroup[] $objectGroups
* @property-read int|null $object_groups_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
* @property-read int|null $piggy_banks_count
* @property-read int|null $object_groups_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
* @property-read int|null $piggy_banks_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @property-read int|null $transactions_count
* @property-read User $user
* @property-read int|null $transactions_count
* @property-read User $user
* @method static EloquentBuilder|Account accountTypeIn($types)
* @method static EloquentBuilder|Account newModelQuery()
* @method static EloquentBuilder|Account newQuery()
@@ -120,13 +120,13 @@ class Account extends Model
*
* @param string $value
*
* @throws NotFoundHttpException
* @return Account
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): Account
{
if (auth()->check()) {
$accountId = (int) $value;
$accountId = (int)$value;
/** @var User $user */
$user = auth()->user();
/** @var Account $account */
@@ -255,7 +255,7 @@ class Account extends Model
public function setVirtualBalanceAttribute($value): void
{
$value = (string)$value;
if('' === $value) {
if ('' === $value) {
$value = null;
}
$this->attributes['virtual_balance'] = $value;

View File

@@ -22,51 +22,51 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Collection;
use Illuminate\Support\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Bill
*
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property int|null $transaction_currency_id
* @property string $name
* @property string $match
* @property string $amount_min
* @property string $amount_max
* @property \Illuminate\Support\Carbon $date
* @property string|null $end_date
* @property string|null $extension_date
* @property string $repeat_freq
* @property int $skip
* @property bool $automatch
* @property bool $active
* @property bool $name_encrypted
* @property bool $match_encrypted
* @property int $order
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
* @property-read int|null $notes_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\ObjectGroup[] $objectGroups
* @property-read int|null $object_groups_count
* @property-read \FireflyIII\Models\TransactionCurrency|null $transactionCurrency
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read User $user
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int|null $transaction_currency_id
* @property string $name
* @property string $match
* @property string $amount_min
* @property string $amount_max
* @property Carbon $date
* @property string|null $end_date
* @property string|null $extension_date
* @property string $repeat_freq
* @property int $skip
* @property bool $automatch
* @property bool $active
* @property bool $name_encrypted
* @property bool $match_encrypted
* @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|Note[] $notes
* @property-read int|null $notes_count
* @property-read Collection|ObjectGroup[] $objectGroups
* @property-read int|null $object_groups_count
* @property-read TransactionCurrency|null $transactionCurrency
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read User $user
* @method static \Illuminate\Database\Eloquent\Builder|Bill newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Bill newQuery()
* @method static Builder|Bill onlyTrashed()

View File

@@ -22,9 +22,9 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
@@ -32,32 +32,32 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Collection;
use Illuminate\Support\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Budget
*
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AutoBudget[] $autoBudgets
* @property-read int|null $auto_budgets_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
* @property-read int|null $budgetlimits_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @property-read int|null $transactions_count
* @property-read User $user
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property string $name
* @property bool $active
* @property bool $encrypted
* @property int $order
* @property-read Collection|Attachment[] $attachments
* @property-read int|null $attachments_count
* @property-read Collection|AutoBudget[] $autoBudgets
* @property-read int|null $auto_budgets_count
* @property-read Collection|BudgetLimit[] $budgetlimits
* @property-read int|null $budgetlimits_count
* @property-read Collection|TransactionJournal[] $transactionJournals
* @property-read int|null $transaction_journals_count
* @property-read Collection|Transaction[] $transactions
* @property-read int|null $transactions_count
* @property-read User $user
* @method static \Illuminate\Database\Eloquent\Builder|Budget newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Budget newQuery()
* @method static Builder|Budget onlyTrashed()
@@ -102,13 +102,13 @@ class Budget extends Model
*
* @param string $value
*
* @throws NotFoundHttpException
* @return Budget
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): Budget
{
if (auth()->check()) {
$budgetId = (int) $value;
$budgetId = (int)$value;
/** @var User $user */
$user = auth()->user();
/** @var Budget $budget */
@@ -120,6 +120,15 @@ class Budget extends Model
throw new NotFoundHttpException;
}
/**
* @codeCoverageIgnore
* @return MorphMany
*/
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}
/**
* @codeCoverageIgnore
* @return HasMany
@@ -137,14 +146,6 @@ class Budget extends Model
{
return $this->hasMany(BudgetLimit::class);
}
/**
* @codeCoverageIgnore
* @return MorphMany
*/
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}
/**
* @codeCoverageIgnore

View File

@@ -22,26 +22,25 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Carbon;
/**
* FireflyIII\Models\Note
*
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $noteable_id
* @property string $noteable_type
* @property string|null $title
* @property string|null $text
* @property-read Model|\Eloquent $noteable
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $noteable_id
* @property string $noteable_type
* @property string|null $title
* @property string|null $text
* @property-read Model|Eloquent $noteable
* @method static \Illuminate\Database\Eloquent\Builder|Note newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Note newQuery()
* @method static Builder|Note onlyTrashed()

View File

@@ -33,14 +33,14 @@ use Illuminate\Support\Carbon;
/**
* FireflyIII\Models\Role
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string $name
* @property string|null $display_name
* @property string|null $description
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string $name
* @property string|null $display_name
* @property string|null $description
* @property-read Collection|User[] $users
* @property-read int|null $users_count
* @property-read int|null $users_count
* @method static Builder|Role newModelQuery()
* @method static Builder|Role newQuery()
* @method static Builder|Role query()

View File

@@ -22,38 +22,38 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\Builder;
use Illuminate\Support\Collection;
use Illuminate\Support\Carbon;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Rule
*
* @property int $id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property int $rule_group_id
* @property string $title
* @property string|null $description
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property bool $strict
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleAction[] $ruleActions
* @property-read int|null $rule_actions_count
* @property-read \FireflyIII\Models\RuleGroup $ruleGroup
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\RuleTrigger[] $ruleTriggers
* @property-read int|null $rule_triggers_count
* @property-read User $user
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property int $rule_group_id
* @property string $title
* @property string|null $description
* @property int $order
* @property bool $active
* @property bool $stop_processing
* @property bool $strict
* @property-read Collection|RuleAction[] $ruleActions
* @property-read int|null $rule_actions_count
* @property-read RuleGroup $ruleGroup
* @property-read Collection|RuleTrigger[] $ruleTriggers
* @property-read int|null $rule_triggers_count
* @property-read User $user
* @method static \Illuminate\Database\Eloquent\Builder|Rule newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Rule newQuery()
* @method static Builder|Rule onlyTrashed()
@@ -102,13 +102,13 @@ class Rule extends Model
*
* @param string $value
*
* @throws NotFoundHttpException
* @return Rule
* @throws NotFoundHttpException
*/
public static function routeBinder(string $value): Rule
{
if (auth()->check()) {
$ruleId = (int) $value;
$ruleId = (int)$value;
/** @var User $user */
$user = auth()->user();
/** @var Rule $rule */

View File

@@ -37,14 +37,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* FireflyIII\Models\Tag
*
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $id
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property Carbon|null $deleted_at
* @property int $user_id
* @property string $tag
* @property string $tagMode
* @property Carbon|null $date
* @property Carbon|null $date
* @property string|null $description
* @property float|null $latitude
* @property float|null $longitude