Use PSR-12 code style

This commit is contained in:
James Cole
2022-10-30 14:24:37 +01:00
parent f53923f16c
commit f52675068b
151 changed files with 251 additions and 403 deletions

View File

@@ -154,7 +154,6 @@ class BelongsUser implements Rule
if (PiggyBank::class === $class) {
$objects = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', '=', auth()->user()->id)->get(['piggy_banks.*']);
}
if (PiggyBank::class !== $class) {
$objects = $class::where('user_id', '=', auth()->user()->id)->get();

View File

@@ -61,7 +61,7 @@ class IsBoolean implements Rule
if (is_int($value) && 1 === $value) {
return true;
}
if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'])) {
if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'], true)) {
return true;
}

View File

@@ -35,7 +35,6 @@ use Log;
*/
class IsDateOrTime implements Rule
{
/**
* Get the validation error message.
*

View File

@@ -101,7 +101,10 @@ class UniqueAccountNumber implements Rule
Log::debug(
sprintf(
'account number "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"',
$value, $count, $type, $this->expectedType
$value,
$count,
$type,
$this->expectedType
)
);
@@ -147,8 +150,7 @@ class UniqueAccountNumber implements Rule
*/
private function countHits(string $type, string $accountNumber): int
{
$query = AccountMeta
::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
$query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id')
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('accounts.user_id', auth()->user()->id)
->where('account_types.type', $type)

View File

@@ -98,7 +98,10 @@ class UniqueIban implements Rule
Log::debug(
sprintf(
'IBAN "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"',
$value, $count, $type, $this->expectedType
$value,
$count,
$type,
$this->expectedType
)
);

View File

@@ -32,7 +32,6 @@ use Illuminate\Contracts\Validation\Rule;
*/
class ValidRecurrenceRepetitionType implements Rule
{
/**
* Get the validation error message.
*
@@ -60,7 +59,7 @@ class ValidRecurrenceRepetitionType implements Rule
}
//monthly,17
//ndom,3,7
if (in_array(substr($value, 0, 6), ['yearly', 'weekly'])) {
if (in_array(substr($value, 0, 6), ['yearly', 'weekly'], true)) {
return true;
}
if (str_starts_with($value, 'monthly')) {

View File

@@ -35,7 +35,6 @@ use Log;
*/
class ValidRecurrenceRepetitionValue implements Rule
{
/**
* Get the validation error message.
*