diff --git a/.ci/php-cs-fixer/.php-cs-fixer.php b/.ci/php-cs-fixer/.php-cs-fixer.php index 51e31775a7..14e3802470 100644 --- a/.ci/php-cs-fixer/.php-cs-fixer.php +++ b/.ci/php-cs-fixer/.php-cs-fixer.php @@ -19,26 +19,24 @@ * along with this program. If not, see . */ -use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; - $current = __DIR__; $paths = [ $current . '/../../app', $current . '/../../config', - $current . '/../../database', $current . '/../../routes', $current . '/../../tests', - $current . '/../../resources/lang/en_US', ]; $finder = PhpCsFixer\Finder::create() ->in($paths); -$config = new PhpCsFixer\Config(); -$config->setParallelConfig(ParallelConfigFactory::detect()); +$config = (new PhpCsFixer\Config()) + ->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) + ; return $config->setRules( + [ // rule sets '@PHP83Migration' => true, @@ -53,9 +51,6 @@ return $config->setRules( 'statement_indentation' => true, 'void_return' => true, - // about importing statements - 'global_namespace_import' => ['import_classes' => true, 'import_constants' => true, 'import_functions' => true], - // disabled rules 'native_function_invocation' => false, // annoying 'php_unit_data_provider_name' => false, // bloody annoying long test names @@ -64,9 +59,14 @@ return $config->setRules( 'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm. 'type_declaration_spaces' => false, 'cast_spaces' => false, - 'phpdoc_to_comment' => false, // do not overrule single line comment style, breaks phpstan. + + // enabled rules + 'global_namespace_import' => true, // matches with rector. // complex rules + 'php_unit_test_case_static_method_calls' => [ + 'call_type' => 'this', + ], 'array_syntax' => ['syntax' => 'short'], 'binary_operator_spaces' => [ 'default' => 'at_least_single_space', @@ -76,5 +76,7 @@ return $config->setRules( '??=' => 'align_single_space_minimal_by_scope', ], ], - ]) + ] + +) ->setFinder($finder); diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index f917fad788..675bcea2d5 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -82,7 +82,7 @@ class NetWorth implements NetWorthInterface /** @var Account $account */ foreach ($accounts as $account) { - Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name)); +// Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name)); $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; $useNative = $convertToNative && $default->id !== $currency->id; $currency = $useNative ? $default : $currency; @@ -93,12 +93,12 @@ class NetWorth implements NetWorthInterface $balance = $balances[$account->id]['balance'] ?? '0'; $nativeBalance = $balances[$account->id]['native_balance'] ?? '0'; } - Log::debug(sprintf('Balance is %s, native balance is %s', $balance, $nativeBalance)); +// Log::debug(sprintf('Balance is %s, native balance is %s', $balance, $nativeBalance)); // always subtract virtual balance again. $balance = '' !== (string) $account->virtual_balance ? bcsub($balance, (string) $account->virtual_balance) : $balance; $nativeBalance = '' !== (string) $account->native_virtual_balance ? bcsub($nativeBalance, (string) $account->native_virtual_balance) : $nativeBalance; $amountToUse = $useNative ? $nativeBalance : $balance; - Log::debug(sprintf('Will use %s %s', $currencyCode, $amountToUse)); +// Log::debug(sprintf('Will use %s %s', $currencyCode, $amountToUse)); $netWorth[$currencyCode] ??= [ 'balance' => '0', diff --git a/app/Support/Report/Summarizer/TransactionSummarizer.php b/app/Support/Report/Summarizer/TransactionSummarizer.php index 25196bb19a..02d54b5659 100644 --- a/app/Support/Report/Summarizer/TransactionSummarizer.php +++ b/app/Support/Report/Summarizer/TransactionSummarizer.php @@ -71,12 +71,12 @@ class TransactionSummarizer $foreignCurrencyDecimalPlaces = null; if ($this->convertToNative) { - Log::debug('convertToNative is true.'); +// Log::debug('convertToNative is true.'); // if convert to native, use the native amount yes or no? $useNative = $this->default->id !== (int) $journal['currency_id']; $useForeign = $this->default->id === (int) $journal['foreign_currency_id']; if ($useNative) { - Log::debug(sprintf('Journal #%d switches to native amount (original is %s)', $journal['transaction_journal_id'], $journal['currency_code'])); +// Log::debug(sprintf('Journal #%d switches to native amount (original is %s)', $journal['transaction_journal_id'], $journal['currency_code'])); $field = 'native_amount'; $currencyId = $this->default->id; $currencyName = $this->default->name; @@ -85,7 +85,7 @@ class TransactionSummarizer $currencyDecimalPlaces = $this->default->decimal_places; } if ($useForeign) { - Log::debug(sprintf('Journal #%d switches to foreign amount (foreign is %s)', $journal['transaction_journal_id'], $journal['foreign_currency_code'])); +// Log::debug(sprintf('Journal #%d switches to foreign amount (foreign is %s)', $journal['transaction_journal_id'], $journal['foreign_currency_code'])); $field = 'foreign_amount'; $currencyId = (int) $journal['foreign_currency_id']; $currencyName = $journal['foreign_currency_name']; @@ -95,7 +95,7 @@ class TransactionSummarizer } } if (!$this->convertToNative) { - Log::debug('convertToNative is false.'); +// Log::debug('convertToNative is false.'); // use foreign amount? $foreignCurrencyId = (int) $journal['foreign_currency_id']; if (0 !== $foreignCurrencyId) {