Skip to content

Generate typed value classes for nested operator arguments - #1886

Closed
GromNaN wants to merge 7 commits into
mongodb:v2.xfrom
GromNaN:generator-nested-types
Closed

Generate typed value classes for nested operator arguments#1886
GromNaN wants to merge 7 commits into
mongodb:v2.xfrom
GromNaN:generator-nested-types

PHPLIB-1624 Add @psalm-type shape to each operator/stage class

86144d3
Select commit
Loading
Failed to load commit list.
GitHub Advanced Security / Psalm succeeded May 6, 2026 in 5s

68 new alerts

New alerts in code changed by this pull request

  • 68 notes

Alerts not introduced by this pull request might have been detected because the code changes were too large.

See annotations below for details.

View all branch alerts.

Annotations

Check notice on line 36 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $prop is being assigned to

Check notice on line 36 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $name is being assigned to

Check notice on line 37 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $val is being assigned to

Check notice on line 47 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $val is being assigned to

Check notice on line 48 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

PossibleRawObjectIteration Note

Possibly undesired iteration over regular object stdClass

Check notice on line 48 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $k is being assigned to

Check notice on line 48 in src/Builder/Encoder/TypeEncoder.php

See this annotation in the file changed.

Code scanning / Psalm

MixedAssignment Note

Unable to determine the type that $v is being assigned to

Check notice on line 516 in src/Builder/Stage/FactoryTrait.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $input has wrong type 'array{pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\RankFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 518 in src/Builder/Stage/FactoryTrait.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $combination has wrong type 'array{weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\RankFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 582 in src/Builder/Stage/FactoryTrait.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $input has wrong type 'array{normalization: string, pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass, normalization:string}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\ScoreFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 584 in src/Builder/Stage/FactoryTrait.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $combination has wrong type 'array{expression?: DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass, method?: string, weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass, method?:string, expression?:DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\ScoreFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 40 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockPropertyType Note

Parameter MongoDB\Builder\Stage\RankFusionStage::$input has wrong type 'array{pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\RankFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 46 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockPropertyType Note

Parameter MongoDB\Builder\Stage\RankFusionStage::$combination has wrong type 'array{weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\RankFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 49 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $input has wrong type 'array{pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\RankFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 51 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $combination has wrong type 'array{weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\RankFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 59 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 1 of MongoDB\Builder\Type\RankFusionInput::__construct cannot be mixed, expecting non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass

Check notice on line 65 in src/Builder/Stage/RankFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 1 of MongoDB\Builder\Type\RankFusionCombination::__construct cannot be mixed, expecting MongoDB\Builder\Type\Optional|array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass

Check notice on line 40 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockPropertyType Note

Parameter MongoDB\Builder\Stage\ScoreFusionStage::$input has wrong type 'array{normalization: string, pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass, normalization:string}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\ScoreFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 46 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockPropertyType Note

Parameter MongoDB\Builder\Stage\ScoreFusionStage::$combination has wrong type 'array{expression?: DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass, method?: string, weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass, method?:string, expression?:DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\ScoreFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 49 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $input has wrong type 'array{normalization: string, pipelines: non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>}|object{pipelines:non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass, normalization:string}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\ScoreFusionInput|array<array-key, mixed>|stdClass'

Check notice on line 51 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MismatchingDocblockParamType Note

Parameter $combination has wrong type 'array{expression?: DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass, method?: string, weights?: array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>}|object{weights?:array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass, method?:string, expression?:DateTimeInterface|MongoDB\BSON\Type|MongoDB\Builder\Type\ExpressionInterface|array<array-key, mixed>|null|scalar|stdClass}&stdClass', should be 'MongoDB\BSON\Document|MongoDB\BSON\Serializable|MongoDB\Builder\Type\Optional|MongoDB\Builder\Type\ScoreFusionCombination|array<array-key, mixed>|stdClass'

Check notice on line 59 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 1 of MongoDB\Builder\Type\ScoreFusionInput::__construct cannot be mixed, expecting non-empty-array<string, MongoDB\BSON\PackedArray|MongoDB\Builder\Pipeline|MongoDB\Model\BSONArray|array<array-key, mixed>>|stdClass

Check notice on line 59 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 2 of MongoDB\Builder\Type\ScoreFusionInput::__construct cannot be mixed, expecting string

Check notice on line 65 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 1 of MongoDB\Builder\Type\ScoreFusionCombination::__construct cannot be mixed, expecting MongoDB\Builder\Type\Optional|array<string, MongoDB\BSON\Decimal128|MongoDB\BSON\Int64|float|int>|stdClass

Check notice on line 65 in src/Builder/Stage/ScoreFusionStage.php

See this annotation in the file changed.

Code scanning / Psalm

MixedArgument Note

Argument 2 of MongoDB\Builder\Type\ScoreFusionCombination::__construct cannot be mixed, expecting MongoDB\Builder\Type\Optional|string