Add void after some methods.

This commit is contained in:
James Cole 2023-12-21 04:59:23 +01:00
parent bc50d25468
commit 655d03bec4
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
14 changed files with 19 additions and 16 deletions

View File

@ -58,5 +58,6 @@ return $config->setRules([
'type_declaration_spaces' => false, 'type_declaration_spaces' => false,
'cast_spaces' => false, 'cast_spaces' => false,
'binary_operator_spaces' => false, 'binary_operator_spaces' => false,
'void_return' => true,
]) ])
->setFinder($finder); ->setFinder($finder);

View File

@ -66,7 +66,7 @@ class MoveTransactionsRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate start before end only if both are there. // validate start before end only if both are there.
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('original_account', $data) && array_key_exists('destination_account', $data)) { if (array_key_exists('original_account', $data) && array_key_exists('destination_account', $data)) {

View File

@ -67,7 +67,7 @@ class TransactionRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate transaction query data. // validate transaction query data.
$this->validateTransactionQuery($validator); $this->validateTransactionQuery($validator);
} }

View File

@ -74,7 +74,7 @@ class Request extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
// validate start before end only if both are there. // validate start before end only if both are there.
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('start', $data) && array_key_exists('end', $data)) { if (array_key_exists('start', $data) && array_key_exists('end', $data)) {

View File

@ -92,7 +92,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
$data = $validator->getData(); $data = $validator->getData();
$min = (string)($data['amount_min'] ?? '0'); $min = (string)($data['amount_min'] ?? '0');
$max = (string)($data['amount_max'] ?? '0'); $max = (string)($data['amount_max'] ?? '0');

View File

@ -95,7 +95,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('amount_min', $data) && array_key_exists('amount_max', $data)) { if (array_key_exists('amount_min', $data) && array_key_exists('amount_max', $data)) {
$min = $data['amount_min'] ?? '0'; $min = $data['amount_min'] ?? '0';

View File

@ -51,7 +51,7 @@ class FixAccountTypes extends Command
/** /**
* Execute the console command. * Execute the console command.
* *
* @throws FireflyException|\JsonException * @throws FireflyException
*/ */
public function handle(): int public function handle(): int
{ {
@ -373,7 +373,7 @@ class FixAccountTypes extends Command
$this->inspectJournal($journal); $this->inspectJournal($journal);
} }
private function giveNewExpense(TransactionJournal $journal, Transaction $destination) private function giveNewExpense(TransactionJournal $journal, Transaction $destination): void
{ {
app('log')->debug(sprintf('An account of type "%s" could be a valid destination.', AccountTypeEnum::EXPENSE->value)); app('log')->debug(sprintf('An account of type "%s" could be a valid destination.', AccountTypeEnum::EXPENSE->value));
$this->factory->setUser($journal->user); $this->factory->setUser($journal->user);

View File

@ -374,7 +374,7 @@ class ForceDecimalSize extends Command
/** /**
* This method fixes all piggy bank repetitions in currency $currency. * This method fixes all piggy bank repetitions in currency $currency.
*/ */
private function correctPiggyRepetitionAmounts(TransactionCurrency $currency, array $fields) private function correctPiggyRepetitionAmounts(TransactionCurrency $currency, array $fields): void
{ {
$operator = $this->operator; $operator = $this->operator;
$cast = $this->cast; $cast = $this->cast;

View File

@ -91,7 +91,7 @@ class UpgradeCurrencyPreferences extends Command
} }
} }
private function upgradeGroupPreferences(UserGroup $group) private function upgradeGroupPreferences(UserGroup $group): void
{ {
$currencies = TransactionCurrency::get(); $currencies = TransactionCurrency::get();
$enabled = new Collection(); $enabled = new Collection();

View File

@ -180,6 +180,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
break; break;
case WebhookResponse::TRANSACTIONS->value: case WebhookResponse::TRANSACTIONS->value:
/** @var TransactionGroup $model */
$transformer = new TransactionGroupTransformer(); $transformer = new TransactionGroupTransformer();
try { try {
@ -196,6 +197,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface
break; break;
case WebhookResponse::ACCOUNTS->value: case WebhookResponse::ACCOUNTS->value:
/** @var TransactionGroup $model */
$accounts = $this->collectAccounts($model); $accounts = $this->collectAccounts($model);
foreach ($accounts as $account) { foreach ($accounts as $account) {
$transformer = new AccountTransformer(); $transformer = new AccountTransformer();

View File

@ -222,7 +222,7 @@ class LoginController extends Controller
* *
* @throws ValidationException * @throws ValidationException
*/ */
protected function sendFailedLoginResponse(Request $request) protected function sendFailedLoginResponse(Request $request): void
{ {
$exception = ValidationException::withMessages( $exception = ValidationException::withMessages(
[ [

View File

@ -83,7 +83,7 @@ class ConvertToDeposit implements ActionInterface
try { try {
$res = $this->convertWithdrawalArray($object); $res = $this->convertWithdrawalArray($object);
} catch (FireflyException|\JsonException $e) { } catch (FireflyException $e) {
app('log')->debug('Could not convert withdrawal to deposit.'); app('log')->debug('Could not convert withdrawal to deposit.');
app('log')->error($e->getMessage()); app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error'))); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
@ -100,7 +100,7 @@ class ConvertToDeposit implements ActionInterface
try { try {
$res = $this->convertTransferArray($object); $res = $this->convertTransferArray($object);
} catch (FireflyException|\JsonException $e) { } catch (FireflyException $e) {
app('log')->debug('Could not convert transfer to deposit.'); app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage()); app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error'))); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));

View File

@ -86,7 +86,7 @@ class ConvertToWithdrawal implements ActionInterface
try { try {
$res = $this->convertDepositArray($object); $res = $this->convertDepositArray($object);
} catch (FireflyException|\JsonException $e) { } catch (FireflyException $e) {
app('log')->debug('Could not convert transfer to deposit.'); app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage()); app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error'))); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));
@ -102,7 +102,7 @@ class ConvertToWithdrawal implements ActionInterface
try { try {
$res = $this->convertTransferArray($object); $res = $this->convertTransferArray($object);
} catch (FireflyException|\JsonException $e) { } catch (FireflyException $e) {
app('log')->debug('Could not convert transfer to deposit.'); app('log')->debug('Could not convert transfer to deposit.');
app('log')->error($e->getMessage()); app('log')->error($e->getMessage());
event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error'))); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.complex_error')));

View File

@ -527,7 +527,7 @@ class User extends Authenticatable
* *
* @deprecated * @deprecated
*/ */
public function setLdapDomain($domain) public function setLdapDomain($domain): void
{ {
$this->{$this->getLdapDomainColumn()} = $domain; $this->{$this->getLdapDomainColumn()} = $domain;
} }
@ -539,7 +539,7 @@ class User extends Authenticatable
* *
* @deprecated * @deprecated
*/ */
public function setLdapGuid($guid) public function setLdapGuid($guid): void
{ {
$this->{$this->getLdapGuidColumn()} = $guid; $this->{$this->getLdapGuidColumn()} = $guid;
} }