diff --git a/docs/includes/fundamentals/as-avs/AtlasSearchTest.php b/docs/includes/fundamentals/as-avs/AtlasSearchTest.php index 79dfe46df..bec0d6638 100644 --- a/docs/includes/fundamentals/as-avs/AtlasSearchTest.php +++ b/docs/includes/fundamentals/as-avs/AtlasSearchTest.php @@ -149,9 +149,9 @@ public function testVectorSearch(): void /** Generates random vectors using fixed seed to make tests deterministic */ private function addVector(array $items): array { - srand(1); + mt_srand(1); foreach ($items as &$item) { - $this->vectors[] = $item['vector4'] = array_map(fn () => rand() / mt_getrandmax(), range(0, 3)); + $this->vectors[] = $item['vector4'] = array_map(fn () => random_int(0, mt_getrandmax()) / mt_getrandmax(), range(0, 3)); } return $items; diff --git a/rector.php b/rector.php index 23afcb2ea..3776c15d7 100644 --- a/rector.php +++ b/rector.php @@ -6,6 +6,7 @@ use Rector\Php80\Rector\FunctionLike\MixedTypeRector; use Rector\Php81\Rector\FuncCall\NullToStrictStringFuncCallArgRector; use Rector\TypeDeclaration\Rector\Closure\AddClosureVoidReturnTypeWhereNoReturnRector; +use Rector\Php84\Rector\Param\ExplicitNullableParamTypeRector; return RectorConfig::configure() ->withPaths([ @@ -16,6 +17,9 @@ ]) ->withPhpSets() ->withTypeCoverageLevel(0) + ->withRules([ + ExplicitNullableParamTypeRector::class, + ]) ->withSkip([ RemoveExtraParametersRector::class, ClosureToArrowFunctionRector::class, diff --git a/src/CommandSubscriber.php b/src/CommandSubscriber.php index 1cad23280..1a3f41b0b 100644 --- a/src/CommandSubscriber.php +++ b/src/CommandSubscriber.php @@ -18,7 +18,7 @@ final class CommandSubscriber implements CommandSubscriberInterface /** @var array */ private array $commands = []; - public function __construct(private Connection $connection) + public function __construct(private readonly Connection $connection) { } diff --git a/src/Scout/ScoutEngine.php b/src/Scout/ScoutEngine.php index 9455608bb..e026aa03d 100644 --- a/src/Scout/ScoutEngine.php +++ b/src/Scout/ScoutEngine.php @@ -69,8 +69,8 @@ final class ScoutEngine extends Engine /** @param array $indexDefinitions */ public function __construct( - private Database $database, - private bool $softDelete, + private readonly Database $database, + private readonly bool $softDelete, private array $indexDefinitions = [], ) { } diff --git a/tests/AtlasSearchTest.php b/tests/AtlasSearchTest.php index 43848c09a..4f953644b 100644 --- a/tests/AtlasSearchTest.php +++ b/tests/AtlasSearchTest.php @@ -256,9 +256,9 @@ public function testEloquentBuilderVectorSearch() /** Generate random vectors using fixed seed to make tests deterministic */ private function addVector(array $items): array { - srand(1); + mt_srand(1); foreach ($items as &$item) { - $this->vectors[] = $item['vector4'] = array_map(fn () => rand() / mt_getrandmax(), range(0, 3)); + $this->vectors[] = $item['vector4'] = array_map(fn () => random_int(0, mt_getrandmax()) / mt_getrandmax(), range(0, 3)); } return $items;