Code cleanup and realign.

This commit is contained in:
James Cole
2018-08-06 19:14:30 +02:00
parent f7eef25fed
commit 5908c0ce8c
188 changed files with 1019 additions and 1031 deletions

View File

@@ -35,32 +35,32 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
*/
class AccountType extends Model
{
/** @var string */
public const DEFAULT = 'Default account';
/** @var string */
public const CASH = 'Cash account';
/** @var string */
public const ASSET = 'Asset account';
/** @var string */
public const EXPENSE = 'Expense account';
/** @var string */
public const REVENUE = 'Revenue account';
/** @var string */
/** @var string */
public const DEFAULT = 'Default account';
/** @var string */
public const CASH = 'Cash account';
/** @var string */
public const ASSET = 'Asset account';
/** @var string */
public const EXPENSE = 'Expense account';
/** @var string */
public const REVENUE = 'Revenue account';
/** @var string */
public const INITIAL_BALANCE = 'Initial balance account';
/** @var string */
public const BENEFICIARY = 'Beneficiary account';
/** @var string */
public const IMPORT = 'Import account';
/** @var string */
public const RECONCILIATION = 'Reconciliation account';
/** @var string */
public const LOAN = 'Loan';
/** @var string */
public const DEBT = 'Debt';
/** @var string */
public const MORTGAGE = 'Mortgage';
/** @var string */
public const CREDITCARD = 'Credit card';
/** @var string */
public const BENEFICIARY = 'Beneficiary account';
/** @var string */
public const IMPORT = 'Import account';
/** @var string */
public const RECONCILIATION = 'Reconciliation account';
/** @var string */
public const LOAN = 'Loan';
/** @var string */
public const DEBT = 'Debt';
/** @var string */
public const MORTGAGE = 'Mortgage';
/** @var string */
public const CREDITCARD = 'Credit card';
/**
* The attributes that should be casted to native types.
*

View File

@@ -84,7 +84,7 @@ class Attachment extends Model
/** @var User $user */
$user = auth()->user();
/** @var Attachment $attachment */
$attachment = $user->attachments()->find($attachmentId);
$attachment = $user->attachments()->find($attachmentId);
if (null !== $attachment) {
return $attachment;
}

View File

@@ -76,7 +76,7 @@ class AvailableBudget extends Model
/** @var User $user */
$user = auth()->user();
/** @var AvailableBudget $availableBudget */
$availableBudget = $user->availableBudgets()->find($availableBudgetId);
$availableBudget = $user->availableBudgets()->find($availableBudgetId);
if (null !== $availableBudget) {
return $availableBudget;
}

View File

@@ -110,9 +110,9 @@ class Bill extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
* @return MorphMany
*/
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}

View File

@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $user_id
* @property-read string $email
* @property bool encrypted
* @property Collection budgetlimits
* @property Collection budgetlimits
*/
class Budget extends Model
{
@@ -80,7 +80,7 @@ class Budget extends Model
/** @var User $user */
$user = auth()->user();
/** @var Budget $budget */
$budget = $user->budgets()->find($budgetId);
$budget = $user->budgets()->find($budgetId);
if (null !== $budget) {
return $budget;
}

View File

@@ -48,7 +48,7 @@ class BudgetLimit extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'start_date' => 'date',

View File

@@ -39,7 +39,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id
* @property float $spent // used in category reports
* @property Carbon|null lastActivity
* @property bool encrypted
* @property bool encrypted
*/
class Category extends Model
{
@@ -77,7 +77,7 @@ class Category extends Model
/** @var User $user */
$user = auth()->user();
/** @var Category $category */
$category = $user->categories()->find($categoryId);
$category = $user->categories()->find($categoryId);
if (null !== $category) {
return $category;
}

View File

@@ -46,8 +46,8 @@ class CurrencyExchangeRate extends Model
/** @var array Convert these fields to other data types */
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
'user_id' => 'int',
'from_currency_id' => 'int',
'to_currency_id' => 'int',

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Models;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -43,7 +44,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Tag $tag
* @property array $errors
* @property array extended_status
* @property int id
* @property int id
*/
class ImportJob extends Model
{
@@ -77,7 +78,7 @@ class ImportJob extends Model
public static function routeBinder(string $value): ImportJob
{
if (auth()->check()) {
$key = trim($value);
$key = trim($value);
/** @var User $user */
$user = auth()->user();
/** @var ImportJob $importJob */
@@ -91,9 +92,9 @@ class ImportJob extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
* @return MorphMany
*/
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}

View File

@@ -45,7 +45,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $order
* @property bool $active
* @property int $account_id
* @property bool encrypted
* @property bool encrypted
*
*/
class PiggyBank extends Model

View File

@@ -33,7 +33,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property int $transaction_journal_id
* @property int $piggy_bank_id
* @property int $id
* @property Carbon date
* @property Carbon date
*/
class PiggyBankEvent extends Model
{

View File

@@ -41,7 +41,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property Carbon $updated_at
* @property Carbon $created_at
* @property int $id
* @property User user
* @property User user
*/
class Preference extends Model
{
@@ -74,7 +74,7 @@ class Preference extends Model
/** @var User $user */
$user = auth()->user();
/** @var Preference $preference */
$preference = $user->preferences()->find($preferenceId);
$preference = $user->preferences()->find($preferenceId);
if (null !== $preference) {
return $preference;
}

View File

@@ -103,7 +103,7 @@ class Recurrence extends Model
/** @var User $user */
$user = auth()->user();
/** @var Recurrence $recurrence */
$recurrence = $user->recurrences()->find($recurrenceId);
$recurrence = $user->recurrences()->find($recurrenceId);
if (null !== $recurrence) {
return $recurrence;
}

View File

@@ -57,7 +57,7 @@ class RecurrenceRepetition extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',

View File

@@ -43,7 +43,7 @@ class RecurrenceTransactionMeta extends Model
* @var array
*/
protected $casts
= [
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'deleted_at' => 'datetime',

View File

@@ -88,7 +88,7 @@ class Rule extends Model
/** @var User $user */
$user = auth()->user();
/** @var Rule $rule */
$rule = $user->rules()->find($ruleId);
$rule = $user->rules()->find($ruleId);
if (null !== $rule) {
return $rule;
}

View File

@@ -43,7 +43,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property int $id
* @property int $order
* @property Collection $rules
* @property string description
* @property string description
*/
class RuleGroup extends Model
{
@@ -80,7 +80,7 @@ class RuleGroup extends Model
/** @var User $user */
$user = auth()->user();
/** @var RuleGroup $ruleGroup */
$ruleGroup = $user->ruleGroups()->find($ruleGroupId);
$ruleGroup = $user->ruleGroups()->find($ruleGroupId);
if (null !== $ruleGroup) {
return $ruleGroup;
}

View File

@@ -237,6 +237,7 @@ class Transaction extends Model
/**
* Check for transactions BEFORE the specified date.
*
* @codeCoverageIgnore
*
* @param Builder $query

View File

@@ -34,7 +34,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
* @property string $symbol
* @property int $decimal_places
* @property int $id
* @property string name
* @property string name
*
*/
class TransactionCurrency extends Model

View File

@@ -150,9 +150,9 @@ class TransactionJournal extends Model
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
* @return MorphMany
*/
public function attachments(): \Illuminate\Database\Eloquent\Relations\MorphMany
public function attachments(): MorphMany
{
return $this->morphMany(Attachment::class, 'attachable');
}

View File

@@ -45,9 +45,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
*/
class TransactionJournalLink extends Model
{
/** @var string The table to store the data in */
protected $table = 'journal_links';
/**
* The attributes that should be casted to native types.
*
@@ -55,9 +52,11 @@ class TransactionJournalLink extends Model
*/
protected $casts
= [
'created_at' => 'datetime',
'updated_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
/** @var string The table to store the data in */
protected $table = 'journal_links';
/**
* Route binder. Converts the key in the URL to the specified object (or throw 404).