Code cleanup that (hopefully) matches style CI

This commit is contained in:
James Cole
2020-03-17 16:46:00 +01:00
parent 91c067ac9f
commit 9a25d6a741
42 changed files with 1395 additions and 1262 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Models;
use Carbon\Carbon;
use Eloquent;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
@@ -30,6 +31,7 @@ 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 Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -50,39 +52,39 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Collection accountMeta
* @property bool encrypted
* @property int account_type_id
* @property Collection piggyBanks
* @property string $interest
* @property string $interestPeriod
* @property string accountTypeString
* @property Carbon created_at
* @property Carbon updated_at
* @property Collection piggyBanks
* @property string $interest
* @property string $interestPeriod
* @property string accountTypeString
* @property Carbon created_at
* @property Carbon updated_at
* @SuppressWarnings (PHPMD.CouplingBetweenObjects)
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property-read string $edit_name
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Note[] $notes
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account accountTypeIn($types)
* @property \Illuminate\Support\Carbon|null $deleted_at
* @property int $user_id
* @property-read string $edit_name
* @property-read \Illuminate\Database\Eloquent\Collection|Note[] $notes
* @property-read \Illuminate\Database\Eloquent\Collection|Transaction[] $transactions
* @method static EloquentBuilder|Account accountTypeIn($types)
* @method static bool|null forceDelete()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account newQuery()
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account onlyTrashed()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account query()
* @method static EloquentBuilder|Account newModelQuery()
* @method static EloquentBuilder|Account newQuery()
* @method static Builder|Account onlyTrashed()
* @method static EloquentBuilder|Account query()
* @method static bool|null restore()
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereAccountTypeId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereDeletedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereEncrypted($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereIban($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereUpdatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereUserId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\FireflyIII\Models\Account whereVirtualBalance($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account withTrashed()
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\Account withoutTrashed()
* @mixin \Eloquent
* @method static EloquentBuilder|Account whereAccountTypeId($value)
* @method static EloquentBuilder|Account whereActive($value)
* @method static EloquentBuilder|Account whereCreatedAt($value)
* @method static EloquentBuilder|Account whereDeletedAt($value)
* @method static EloquentBuilder|Account whereEncrypted($value)
* @method static EloquentBuilder|Account whereIban($value)
* @method static EloquentBuilder|Account whereId($value)
* @method static EloquentBuilder|Account whereName($value)
* @method static EloquentBuilder|Account whereUpdatedAt($value)
* @method static EloquentBuilder|Account whereUserId($value)
* @method static EloquentBuilder|Account whereVirtualBalance($value)
* @method static Builder|Account withTrashed()
* @method static Builder|Account withoutTrashed()
* @mixin Eloquent
*/
class Account extends Model
{
@@ -114,13 +116,13 @@ class Account extends Model
*
* @param string $value
*
* @return Account
* @throws NotFoundHttpException
* @return Account
*/
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 */
@@ -150,15 +152,6 @@ class Account extends Model
return $this->belongsTo(AccountType::class);
}
/**
* @codeCoverageIgnore
* @return MorphMany
*/
public function locations(): MorphMany
{
return $this->morphMany(Location::class, 'locatable');
}
/**
* Get the account number.
*
@@ -189,6 +182,15 @@ class Account extends Model
return $name;
}
/**
* @codeCoverageIgnore
* @return MorphMany
*/
public function locations(): MorphMany
{
return $this->morphMany(Location::class, 'locatable');
}
/**
* @codeCoverageIgnore
* Get all of the notes.
@@ -231,7 +233,7 @@ class Account extends Model
*/
public function setVirtualBalanceAttribute($value): void
{
$this->attributes['virtual_balance'] = (string)$value;
$this->attributes['virtual_balance'] = (string) $value;
}
/**