Skip to content

Commit 0541817

Browse files
Masatoshi OgiwaraMasatoshi Ogiwara
authored andcommitted
chore: apply-rector-changes-for-code-style-and-type-safety
1 parent e4ee3b3 commit 0541817

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

docs/includes/fundamentals/as-avs/AtlasSearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ public function testVectorSearch(): void
149149
/** Generates random vectors using fixed seed to make tests deterministic */
150150
private function addVector(array $items): array
151151
{
152-
srand(1);
152+
mt_srand(1);
153153
foreach ($items as &$item) {
154-
$this->vectors[] = $item['vector4'] = array_map(fn () => rand() / mt_getrandmax(), range(0, 3));
154+
$this->vectors[] = $item['vector4'] = array_map(fn () => random_int(0, mt_getrandmax()) / mt_getrandmax(), range(0, 3));
155155
}
156156

157157
return $items;

src/CommandSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ final class CommandSubscriber implements CommandSubscriberInterface
1818
/** @var array<string, CommandStartedEvent> */
1919
private array $commands = [];
2020

21-
public function __construct(private Connection $connection)
21+
public function __construct(private readonly Connection $connection)
2222
{
2323
}
2424

src/Scout/ScoutEngine.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ final class ScoutEngine extends Engine
6969

7070
/** @param array<string, array> $indexDefinitions */
7171
public function __construct(
72-
private Database $database,
73-
private bool $softDelete,
72+
private readonly Database $database,
73+
private readonly bool $softDelete,
7474
private array $indexDefinitions = [],
7575
) {
7676
}

tests/AtlasSearchTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,9 @@ public function testEloquentBuilderVectorSearch()
256256
/** Generate random vectors using fixed seed to make tests deterministic */
257257
private function addVector(array $items): array
258258
{
259-
srand(1);
259+
mt_srand(1);
260260
foreach ($items as &$item) {
261-
$this->vectors[] = $item['vector4'] = array_map(fn () => rand() / mt_getrandmax(), range(0, 3));
261+
$this->vectors[] = $item['vector4'] = array_map(fn () => random_int(0, mt_getrandmax()) / mt_getrandmax(), range(0, 3));
262262
}
263263

264264
return $items;

0 commit comments

Comments
 (0)