Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add annotated methods.
James Coleac8776aea42d
diff --git a/app/Api/V1/Requests/LinkTypeRequest.php b/app/Api/V1/Requests/LinkTypeRequest.phpindex 3692bc5ea6..34cb49dd57 100644--- a/app/Api/V1/Requests/LinkTypeRequest.php+++ b/app/Api/V1/Requests/LinkTypeRequest.php@@ -71,7 +71,6 @@ class LinkTypeRequest extends Request'outward' => 'required|unique:link_types,outward|min:1|different:inward','inward' => 'required|unique:link_types,inward|min:1|different:outward',];- // Rule::unique('users')->ignore($user->id),switch ($this->method()) {diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 46aec0c792..5d6899c52b 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -31,7 +31,7 @@ use Exception;use FireflyIII\Jobs\MailError;use Illuminate\Auth\AuthenticationException;use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;-use Illuminate\Validation\ValidationException;+use Illuminate\Validation\ValidationException as LaravelValidationException;use League\OAuth2\Server\Exception\OAuthServerException;use Request;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;@@ -54,7 +54,7 @@ class Handler extends ExceptionHandler*/public function render($request, Exception $exception){- if ($exception instanceof ValidationException && $request->expectsJson()) {+ if ($exception instanceof LaravelValidationException && $request->expectsJson()) {// ignore it: controller will handle it.return parent::render($request, $exception);}diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.phpindex f3d757e63d..0d5e42f4f2 100644--- a/app/Generator/Report/Support.php+++ b/app/Generator/Report/Support.php@@ -29,6 +29,8 @@ use Illuminate\Support\Collection;/*** Class Support.+ * @method Collection getExpenses()+ * @method Collection getIncome()*/class Support{diff --git a/app/Models/Transaction.php b/app/Models/Transaction.phpindex 58b3ac5e9a..7e5d34ac17 100644--- a/app/Models/Transaction.php+++ b/app/Models/Transaction.php@@ -64,6 +64,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property string $transaction_journal_category_name* @property int $bill_id* @property string $bill_name+ * @property string $bill_name_encrypted* @property string $notes* @property string $tags* @property string $transaction_currency_symbol@@ -87,7 +88,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;* @property string $after // used in audit reports.* @property int $opposing_id // ID of the opposing transaction, used in collector* @property bool $encrypted // is the journal encrypted- * @property $bill_name_encrypted*/class Transaction extends Model{diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpindex 487a5d4da9..bb2bc9c25c 100644--- a/app/Support/ExpandedForm.php+++ b/app/Support/ExpandedForm.php@@ -43,6 +43,7 @@ use Session;/*** Class ExpandedForm.+ **/class ExpandedForm{diff --git a/app/Support/Facades/Amount.php b/app/Support/Facades/Amount.phpindex f575f3ac01..2dc79c0dc9 100644--- a/app/Support/Facades/Amount.php+++ b/app/Support/Facades/Amount.php@@ -24,13 +24,20 @@ namespace FireflyIII\Support\Facades;use FireflyIII\Models\TransactionCurrency;use FireflyIII\User;+use Illuminate\Support\Collection;use Illuminate\Support\Facades\Facade;/*** @codeCoverageIgnore* Class Amount.*+ * @method string formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true)+ * @method Collection getAllCurrencies()+ * @method string getCurrencyCode()+ * @method string getCurrencySymbol()+ * @method TransactionCurrency getDefaultCurrency()* @method TransactionCurrency getDefaultCurrencyByUser(User $user)+ * @method array getJsConfig(array $config)*/class Amount extends Facade{diff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.phpindex 909313f951..983373509d 100644--- a/app/Support/Facades/ExpandedForm.php+++ b/app/Support/Facades/ExpandedForm.php@@ -22,11 +22,15 @@ declare(strict_types=1);namespace FireflyIII\Support\Facades;+use Illuminate\Support\Collection;use Illuminate\Support\Facades\Facade;/*** @codeCoverageIgnore* Class ExpandedForm.+ *+ * @method array makeSelectList(Collection $set)+ * @method array makeSelectListWithEmpty(Collection $set)*/class ExpandedForm extends Facade{diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.phpindex 2b2fe45e7d..49e1a22e62 100644--- a/app/Support/Facades/Navigation.php+++ b/app/Support/Facades/Navigation.php@@ -22,14 +22,28 @@ declare(strict_types=1);namespace FireflyIII\Support\Facades;+use Carbon\Carbon;use Illuminate\Support\Facades\Facade;/*** @codeCoverageIgnore* Class Navigation.*- * @method array blockPeriods(\Carbon\Carbon $start, \Carbon\Carbon $end, string $range)- * @method string periodShow(\Carbon\Carbon $theDate, string $repeatFrequency)+ * @method Carbon addPeriod(Carbon $theDate, string $repeatFreq, int $skip)+ * @method array blockPeriods(Carbon $start, Carbon $end, string $range)+ * @method Carbon endOfPeriod(Carbon $end, string $repeatFreq)+ * @method Carbon endOfX(Carbon $theCurrentEnd, string $repeatFreq, Carbon $maxDate = null)+ * @method array listOfPeriods(Carbon $start, Carbon $end)+ * @method string periodShow(Carbon $theDate, string $repeatFrequency)+ * @method string preferredCarbonFormat(Carbon $start, Carbon $end)+ * @method string preferredCarbonLocalizedFormat(Carbon $start, Carbon $end)+ * @method string preferredEndOfPeriod(Carbon $start, Carbon $end)+ * @method string preferredRangeFormat(Carbon $start, Carbon $end)+ * @method string preferredSqlFormat(Carbon $start, Carbon $end)+ * @method Carbon startOfPeriod(Carbon $theDate, string $repeatFreq)+ * @method Carbon subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1)+ * @method Carbon updateEndDate(string $range, Carbon $start)+ * @method Carbon updateStartDate(string $range, Carbon $start)*/class Navigation extends Facade{diff --git a/app/Support/Facades/Preferences.php b/app/Support/Facades/Preferences.phpindex 98ae01a5d0..b5d6eacafb 100644--- a/app/Support/Facades/Preferences.php+++ b/app/Support/Facades/Preferences.php@@ -24,16 +24,23 @@ namespace FireflyIII\Support\Facades;use FireflyIII\Models\Preference;use FireflyIII\User;+use Illuminate\Support\Collection;use Illuminate\Support\Facades\Facade;/*** @codeCoverageIgnore* Class Preferences.*- * @method Preference set(string $name, $value)+ * @method Collection beginsWith(User $user, string $search)+ * @method bool delete(string $name)+ * @method Collection findByName(string $name)* @method Preference get(string $name, $value)+ * @method array getArrayForUser(User $user, array $list)* @method Preference|null getForUser(User $user, string $name, $default = null)+ * @method string lastActivity()* @method void mark()+ * @method Preference set(string $name, $value)+ * @method Preference setForUser(User $user, string $name, $value)*/class Preferences extends Facade{diff --git a/app/Support/Facades/Steam.php b/app/Support/Facades/Steam.phpindex 33b8c847df..7a9bee11e8 100644--- a/app/Support/Facades/Steam.php+++ b/app/Support/Facades/Steam.php@@ -22,12 +22,26 @@ declare(strict_types=1);namespace FireflyIII\Support\Facades;+use Carbon\Carbon;+use FireflyIII\Models\Account;+use Illuminate\Support\Collection;use Illuminate\Support\Facades\Facade;/*** @codeCoverageIgnore* Class Steam.+ * @method string balance(Account $account, Carbon $date)+ * @method string balanceIgnoreVirtual(Account $account, Carbon $date)+ * @method array balanceInRange(Account $account, Carbon $start, Carbon $end)+ * @method array balancesByAccounts(Collection $accounts, Carbon $date)+ * @method decrypt(int $isEncrypted, string $value)+ * @method array getLastActivities(array $accounts)+ * @method string negative(string $amount)+ * @method string|null opposite(string $amount = null)+ * @method int phpBytes(string $string)+ * @method tryDecrypt($value)* @method string positive(string $amount)+ **/class Steam extends Facade{diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex 5e348990af..3e1fc6b818 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -505,9 +505,10 @@ class Navigation** @throws \FireflyIII\Exceptions\FireflyException*/- public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1): Carbon+ public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = null): Carbon{- $date = clone $theDate;+ $subtract = $subtract ?? 1;+ $date = clone $theDate;// 1D 1W 1M 3M 6M 1YLog::debug(sprintf('subtractPeriod: date is %s, repeat frequency is %s and subtract is %d', $date->format('Y-m-d'), $repeatFreq, $subtract));$functionMap = [diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 6c6003e6d2..6dd329cf86 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -302,11 +302,11 @@ class Steam}/**- * @param $string+ * @param string $string** @return int*/- public function phpBytes($string): int+ public function phpBytes(string $string): int{$string = strtolower($string);diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.phpindex f4ef17b211..128c740131 100644--- a/app/Validation/TransactionValidation.php+++ b/app/Validation/TransactionValidation.php@@ -123,7 +123,7 @@ trait TransactionValidation}// no valid descriptions and empty journal description? error.- if ($validDescriptions === 0 && '' === $journalDescription) {+ if (0 === $validDescriptions && '' === $journalDescription) {$validator->errors()->add('description', (string)trans('validation.filled', ['attribute' => (string)trans('validation.attributes.description')]));}}@@ -179,7 +179,7 @@ trait TransactionValidation$data = $validator->getData();$transactions = $data['transactions'] ?? [];// need at least one transaction- if (\count($transactions) === 0) {+ if (0 === \count($transactions)) {$validator->errors()->add('description', (string)trans('validation.at_least_one_transaction'));}}@@ -293,7 +293,7 @@ trait TransactionValidation$repository->setUser($admin);$set = $repository->getAccountsById([$accountId]);Log::debug(sprintf('Count of accounts found by ID %d is: %d', $accountId, $set->count()));- if ($set->count() === 1) {+ if (1 === $set->count()) {/** @var Account $first */$first = $set->first();if ($first->accountType->type !== AccountType::ASSET) {