Skip to content

Commit f880072

Browse files
authored
refactor: general codebase upgrade to latest practices (#883)
1 parent 7427478 commit f880072

File tree

88 files changed

+183
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+183
-261
lines changed

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
'on_multiline' => 'ensure_fully_multiline',
9494
'keep_multiple_spaces_after_comma' => true,
9595
],
96+
'type_declaration_spaces' => true,
9697
'single_trait_insert_per_statement' => true,
9798
'declare_strict_types' => true,
9899
'no_empty_comment' => true,

bin/release

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function getCurrentVersion(): string
3131

3232
function normalizeVersion(string $version): string
3333
{
34-
return preg_replace('/^(\d+\.\d+\.\d+)\.0(-|$|\+)/', '$1$2', (new VersionParser())->normalize($version));
34+
return preg_replace('/^(\d+\.\d+\.\d+)\.0(-|$|\+)/', '$1$2', new VersionParser()->normalize($version));
3535
}
3636

3737
function suggestNextVersions(string $current): array

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@
4444
"jenssegers/blade": "^2.0",
4545
"mikey179/vfsstream": "^2.0@dev",
4646
"nyholm/psr7": "^1.8",
47+
"phpat/phpat": "^0.11.0",
4748
"phpbench/phpbench": "84.x-dev",
4849
"phpstan/phpstan": "^2.0",
4950
"phpunit/phpunit": "^11.3.5",
5051
"rector/rector": "^2.0-rc2",
5152
"spatie/phpunit-snapshot-assertions": "^5.1.6",
5253
"spaze/phpstan-disallowed-calls": "^4.0",
5354
"symplify/monorepo-builder": "^11.2",
54-
"twig/twig": "^3.16",
55-
"phpat/phpat": "^0.11.0"
55+
"twig/twig": "^3.16"
5656
},
5757
"replace": {
5858
"tempest/auth": "self.version",

phpstan.neon.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ parameters:
1818
- src
1919
- tests
2020
ignoreErrors:
21+
-
22+
identifier: assign.propertyReadOnly
2123
-
2224
identifier: argument.named
2325
-

rector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
77
use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
88
use Rector\Config\RectorConfig;
9-
use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPublicMethodParameterRector;
109
use Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
1110
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
1211
use Rector\Php74\Rector\Closure\ClosureToArrowFunctionRector;
@@ -51,7 +50,6 @@
5150
ReadOnlyPropertyRector::class,
5251
RemoveNullPropertyInitializationRector::class,
5352
AddSensitiveParameterAttributeRector::class,
54-
RemoveUnusedPublicMethodParameterRector::class,
5553
RestoreDefaultNullToNullableTypePropertyRector::class,
5654
ReturnNeverTypeRector::class,
5755
StaticCallOnNonStaticToInstanceCallRector::class,

src/Tempest/Auth/src/Install/CreateUserPermissionsTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class CreateUserPermissionsTable implements DatabaseMigration
1616

1717
public function up(): CreateTableStatement
1818
{
19-
return (new CreateTableStatement('user_permissions'))
19+
return new CreateTableStatement('user_permissions')
2020
->primary()
2121
->belongsTo('user_permissions.user_id', 'users.id')
2222
->belongsTo('user_permissions.permission_id', 'permissions.id');

src/Tempest/Auth/src/Install/User.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ public function grantPermission(string|UnitEnum|Permission $permission): self
4141
{
4242
$permission = $this->resolvePermission($permission);
4343

44-
(new UserPermission(
44+
new UserPermission(
4545
user: $this,
4646
permission: $permission,
47-
))->save();
47+
)->save();
4848

4949
return $this->load('userPermissions.permission');
5050
}
@@ -81,10 +81,6 @@ private function resolvePermission(string|UnitEnum|Permission $permission): Perm
8181

8282
$permission = Permission::query()->whereField('name', $name)->first();
8383

84-
if ($permission === null) {
85-
return (new Permission($name))->save();
86-
}
87-
88-
return $permission;
84+
return $permission ?? new Permission($name)->save();
8985
}
9086
}

src/Tempest/Clock/tests/GenericClockTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function test_that_generic_clock_sleeps(): void
4747
{
4848
$timeBefore = time();
4949

50-
(new GenericClock())->sleep(1);
50+
new GenericClock()->sleep(1);
5151

5252
$timeAfter = time();
5353

src/Tempest/CommandBus/src/MonitorAsyncCommands.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __invoke(): void
5555
}
5656

5757
$availableCommands = arr($this->repository->getPendingCommands())
58-
->filter(fn (object $command, string $uuid) => ! in_array($uuid, array_keys($processes)));
58+
->filter(fn (object $command, string $uuid) => ! array_key_exists($uuid, $processes));
5959

6060
if (count($processes) === 5) {
6161
$this->sleep(0.5);

src/Tempest/Console/src/Actions/ResolveConsoleCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use Tempest\Console\ConsoleCommand;
99
use Tempest\Console\ConsoleConfig;
1010

11-
final class ResolveConsoleCommand
11+
final readonly class ResolveConsoleCommand
1212
{
1313
public function __construct(
14-
private readonly ConsoleConfig $consoleConfig,
14+
private ConsoleConfig $consoleConfig,
1515
) {
1616
}
1717

0 commit comments

Comments
 (0)