mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Various code fixes.
This commit is contained in:
@@ -12,7 +12,10 @@ parameters:
|
|||||||
- '#with a nullable type declaration#'
|
- '#with a nullable type declaration#'
|
||||||
-
|
-
|
||||||
message: '#Control structures using switch should not be used.#'
|
message: '#Control structures using switch should not be used.#'
|
||||||
path: ../app/Api/V1/Controllers/Data/DestroyController.php
|
paths:
|
||||||
|
- ../app/Api/V1/Controllers/Data/DestroyController.php
|
||||||
|
- ../app/Console/Commands/Correction/FixAccountTypes.php
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
- ../app
|
- ../app
|
||||||
- ../database
|
- ../database
|
||||||
|
@@ -30,6 +30,6 @@ SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|||||||
|
|
||||||
# Do static code analysis.
|
# Do static code analysis.
|
||||||
# ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress
|
# ./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress
|
||||||
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --error-format=table > phpstan.txt
|
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --error-format=table > phpstan-report.txt
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
namespace FireflyIII\Api\V1\Requests\Models\Rule;
|
||||||
|
|
||||||
|
use FireflyIII\Models\Rule;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
use FireflyIII\Rules\IsBoolean;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
@@ -131,6 +132,8 @@ class UpdateRequest extends FormRequest
|
|||||||
{
|
{
|
||||||
$validTriggers = $this->getTriggers();
|
$validTriggers = $this->getTriggers();
|
||||||
$validActions = array_keys(config('firefly.rule-actions'));
|
$validActions = array_keys(config('firefly.rule-actions'));
|
||||||
|
|
||||||
|
/** @var Rule $rule */
|
||||||
$rule = $this->route()->parameter('rule');
|
$rule = $this->route()->parameter('rule');
|
||||||
|
|
||||||
// some triggers and actions require text:
|
// some triggers and actions require text:
|
||||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionCurrency;
|
namespace FireflyIII\Api\V1\Requests\Models\TransactionCurrency;
|
||||||
|
|
||||||
|
use FireflyIII\Models\TransactionCurrency;
|
||||||
use FireflyIII\Rules\IsBoolean;
|
use FireflyIII\Rules\IsBoolean;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
@@ -66,6 +67,7 @@ class UpdateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
/** @var TransactionCurrency $currency */
|
||||||
$currency = $this->route()->parameter('currency_code');
|
$currency = $this->route()->parameter('currency_code');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -23,6 +23,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace FireflyIII\Api\V1\Requests\Models\TransactionLinkType;
|
namespace FireflyIII\Api\V1\Requests\Models\TransactionLinkType;
|
||||||
|
|
||||||
|
use FireflyIII\Models\LinkType;
|
||||||
|
use FireflyIII\Models\TransactionJournalLink;
|
||||||
use FireflyIII\Support\Request\ChecksLogin;
|
use FireflyIII\Support\Request\ChecksLogin;
|
||||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||||
use Illuminate\Foundation\Http\FormRequest;
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
@@ -59,6 +61,7 @@ class UpdateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
|
/** @var LinkType $linkType */
|
||||||
$linkType = $this->route()->parameter('linkType');
|
$linkType = $this->route()->parameter('linkType');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -84,6 +84,8 @@ class UpdateRequest extends FormRequest
|
|||||||
$triggers = implode(',', array_keys(Webhook::getTriggersForValidation()));
|
$triggers = implode(',', array_keys(Webhook::getTriggersForValidation()));
|
||||||
$responses = implode(',', array_keys(Webhook::getResponsesForValidation()));
|
$responses = implode(',', array_keys(Webhook::getResponsesForValidation()));
|
||||||
$deliveries = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
|
$deliveries = implode(',', array_keys(Webhook::getDeliveriesForValidation()));
|
||||||
|
|
||||||
|
/** @var Webhook $webhook */
|
||||||
$webhook = $this->route()->parameter('webhook');
|
$webhook = $this->route()->parameter('webhook');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@@ -96,6 +96,7 @@ class UserUpdateRequest extends FormRequest
|
|||||||
*/
|
*/
|
||||||
public function withValidator(Validator $validator): void
|
public function withValidator(Validator $validator): void
|
||||||
{
|
{
|
||||||
|
/** @var User $current */
|
||||||
$current = $this->route()->parameter('user');
|
$current = $this->route()->parameter('user');
|
||||||
$validator->after(
|
$validator->after(
|
||||||
static function (Validator $validator) use ($current) {
|
static function (Validator $validator) use ($current) {
|
||||||
|
@@ -121,11 +121,11 @@ class ExportData extends Command
|
|||||||
$exporter->setExportBills($options['export']['bills']);
|
$exporter->setExportBills($options['export']['bills']);
|
||||||
$exporter->setExportPiggies($options['export']['piggies']);
|
$exporter->setExportPiggies($options['export']['piggies']);
|
||||||
$data = $exporter->export();
|
$data = $exporter->export();
|
||||||
if (empty($data)) {
|
if (0 === count ($data)) {
|
||||||
$this->error('You must export *something*. Use --export-transactions or another option. See docs.firefly-iii.org');
|
$this->error('You must export *something*. Use --export-transactions or another option. See docs.firefly-iii.org');
|
||||||
}
|
}
|
||||||
$returnCode = 0;
|
$returnCode = 0;
|
||||||
if (!empty($data)) {
|
if (0 !== count($data)) {
|
||||||
try {
|
try {
|
||||||
$this->exportData($options, $data);
|
$this->exportData($options, $data);
|
||||||
} catch (FireflyException $e) {
|
} catch (FireflyException $e) {
|
||||||
|
@@ -148,7 +148,8 @@ class BackToJournals extends Command
|
|||||||
*/
|
*/
|
||||||
private function getIdsForBudgets(): array
|
private function getIdsForBudgets(): array
|
||||||
{
|
{
|
||||||
$transactions = DB::table('budget_transaction')->distinct()->get(['transaction_id'])->pluck('transaction_id')->toArray(); // @phpstan-ignore-line
|
$transactions = DB::table('budget_transaction')->distinct()->get(['transaction_id'])->
|
||||||
|
toCollection()->pluck('transaction_id')->toArray(); // @phpstan-ignore-line
|
||||||
$array = [];
|
$array = [];
|
||||||
$chunks = array_chunk($transactions, 500);
|
$chunks = array_chunk($transactions, 500);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user