Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Chore: apply ExplicitNullableParamTypeRector rule #3438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zigzagdev wants to merge 2 commits into mongodb:5.x from zigzagdev:feature/add-rule-to-rector
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/includes/fundamentals/as-avs/AtlasSearchTest.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions rector.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand All @@ -16,6 +17,9 @@
])
->withPhpSets()
->withTypeCoverageLevel(0)
->withRules([
ExplicitNullableParamTypeRector::class,
Copy link
Member

@GromNaN GromNaN Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule did not fix anything in the codebase. The explicit nullable params are already fixed by phpcs.

zigzagdev reacted with thumbs up emoji
])
->withSkip([
RemoveExtraParametersRector::class,
ClosureToArrowFunctionRector::class,
Expand Down
2 changes: 1 addition & 1 deletion src/CommandSubscriber.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ final class CommandSubscriber implements CommandSubscriberInterface
/** @var array<string, CommandStartedEvent> */
private array $commands = [];

public function __construct(private Connection $connection)
public function __construct(private readonly Connection $connection)
{
}

Expand Down
4 changes: 2 additions & 2 deletions src/Scout/ScoutEngine.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ final class ScoutEngine extends Engine

/** @param array<string, array> $indexDefinitions */
public function __construct(
private Database $database,
private bool $softDelete,
private readonly Database $database,
private readonly bool $softDelete,
Comment on lines +72 to +73
Copy link
Member

@GromNaN GromNaN Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to protect private properties with readonly, their usage is internal to this class.

zigzagdev reacted with thumbs up emoji
private array $indexDefinitions = [],
) {
}
Expand Down
4 changes: 2 additions & 2 deletions tests/AtlasSearchTest.php
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

AltStyle によって変換されたページ (->オリジナル) /