Skip to content

Commit 95eaf21

Browse files
Merge pull request #50 from Relaticle/chore/rector-code-quality-improvements
Chore/rector code quality improvements
2 parents 760d19c + d178af4 commit 95eaf21

23 files changed

+265
-355
lines changed

.github/workflows/run-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
laravel: [12.*]
1818
stability: [prefer-stable]
1919
include:
20-
- laravel: 12.*
21-
testbench: 10.*
22-
carbon: ^3.8.4
20+
- laravel: 11.*
21+
testbench: 9.*
22+
carbon: 2.*
2323

2424
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2525

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"larastan/larastan": "^3.0",
5050
"laravel/pint": "^1.0",
5151
"nunomaduro/collision": "^8.1",
52-
"orchestra/testbench": "^10.0",
52+
"orchestra/testbench": "^9.0",
5353
"pestphp/pest": "^4.0",
5454
"pestphp/pest-plugin-arch": "^4.0",
5555
"pestphp/pest-plugin-laravel": "^4.0",

composer.lock

Lines changed: 232 additions & 313 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@
2929
privatization: true,
3030
instanceOf: true,
3131
earlyReturn: true,
32-
strictBooleans: true
3332
);

src/CustomFields.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static function useCustomFieldModel(string $model): static
7070
*/
7171
public static function valueModel(): string
7272
{
73-
return static::$valueModel;
73+
return self::$valueModel;
7474
}
7575

7676
/**
@@ -88,7 +88,7 @@ public static function newValueModel(): mixed
8888
*/
8989
public static function useValueModel(string $model): static
9090
{
91-
static::$valueModel = $model;
91+
self::$valueModel = $model;
9292

9393
return new self;
9494
}
@@ -100,7 +100,7 @@ public static function useValueModel(string $model): static
100100
*/
101101
public static function optionModel(): string
102102
{
103-
return static::$optionModel;
103+
return self::$optionModel;
104104
}
105105

106106
/**
@@ -118,7 +118,7 @@ public static function newOptionModel(): mixed
118118
*/
119119
public static function useOptionModel(string $model): static
120120
{
121-
static::$optionModel = $model;
121+
self::$optionModel = $model;
122122

123123
return new self;
124124
}
@@ -130,7 +130,7 @@ public static function useOptionModel(string $model): static
130130
*/
131131
public static function sectionModel(): string
132132
{
133-
return static::$sectionModel;
133+
return self::$sectionModel;
134134
}
135135

136136
/**
@@ -148,7 +148,7 @@ public static function newSectionModel(): mixed
148148
*/
149149
public static function useSectionModel(string $model): static
150150
{
151-
static::$sectionModel = $model;
151+
self::$sectionModel = $model;
152152

153153
return new self;
154154
}

src/Data/CustomFieldSectionSettingsData.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@
77
use Spatie\LaravelData\Mappers\SnakeCaseMapper;
88

99
#[MapName(SnakeCaseMapper::class)]
10-
class CustomFieldSectionSettingsData extends Data
11-
{
12-
public function __construct(
13-
) {}
14-
}
10+
class CustomFieldSectionSettingsData extends Data {}

src/EntitySystem/EntityCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function sortedByLabel(): static
159159
*/
160160
public function toOptions(bool $usePlural = true): array
161161
{
162-
return $this->mapWithKeys(fn (EntityConfigurationData $entity) => [
162+
return $this->mapWithKeys(fn (EntityConfigurationData $entity): array => [
163163
$entity->getAlias() => $usePlural
164164
? $entity->getLabelPlural()
165165
: $entity->getLabelSingular(),
@@ -171,7 +171,7 @@ public function toOptions(bool $usePlural = true): array
171171
*/
172172
public function toDetailedOptions(): array
173173
{
174-
return $this->mapWithKeys(fn (EntityConfigurationData $entity) => [
174+
return $this->mapWithKeys(fn (EntityConfigurationData $entity): array => [
175175
$entity->getAlias() => [
176176
'label' => $entity->getLabelPlural(),
177177
'icon' => $entity->getIcon(),

src/Enums/FieldDataType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getCompatibleOperators(): array
8787
public function getCompatibleOperatorOptions(): array
8888
{
8989
return collect($this->getCompatibleOperators())
90-
->mapWithKeys(fn (VisibilityOperator $operator) => [$operator->value => $operator->getLabel()])
90+
->mapWithKeys(fn (VisibilityOperator $operator): array => [$operator->value => $operator->getLabel()])
9191
->toArray();
9292
}
9393
}

src/Enums/ValidationRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ public function getDescription(): string
164164
*/
165165
private static function isEmptyRule(mixed $rule): bool
166166
{
167-
return $rule === null || $rule === '' || $rule === '0';
167+
return in_array($rule, [null, '', '0'], true);
168168
}
169169

170170
public static function hasParameterForRule(?string $rule): bool

src/Enums/VisibilityOperator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private function evaluateIsEmpty(mixed $fieldValue): bool
161161
public static function options(): array
162162
{
163163
return collect(self::cases())
164-
->mapWithKeys(fn (self $operator) => [$operator->value => $operator->getLabel()])
164+
->mapWithKeys(fn (self $operator): array => [$operator->value => $operator->getLabel()])
165165
->toArray();
166166
}
167167

0 commit comments

Comments
 (0)