From 1b8896a261c9d6e2c559134f058808e0b54fe7e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Thu, 23 Jan 2025 15:02:54 +0100 Subject: [PATCH] PHPLIB-1597 Accept a $-prefixed string anywhere an expression is accepted --- generator/config/expressions.php | 6 + .../Accumulator/AccumulatorAccumulator.php | 16 +- src/Builder/Accumulator/AvgAccumulator.php | 8 +- src/Builder/Accumulator/BottomAccumulator.php | 8 +- .../Accumulator/BottomNAccumulator.php | 16 +- .../Accumulator/CovariancePopAccumulator.php | 16 +- .../Accumulator/CovarianceSampAccumulator.php | 16 +- .../Accumulator/DerivativeAccumulator.php | 8 +- .../Accumulator/ExpMovingAvgAccumulator.php | 24 +- src/Builder/Accumulator/FactoryTrait.php | 145 ++-- src/Builder/Accumulator/FirstNAccumulator.php | 8 +- .../Accumulator/IntegralAccumulator.php | 8 +- src/Builder/Accumulator/LastNAccumulator.php | 18 +- .../Accumulator/LinearFillAccumulator.php | 8 +- src/Builder/Accumulator/MaxNAccumulator.php | 18 +- src/Builder/Accumulator/MedianAccumulator.php | 8 +- .../Accumulator/MergeObjectsAccumulator.php | 8 +- src/Builder/Accumulator/MinNAccumulator.php | 18 +- .../Accumulator/PercentileAccumulator.php | 16 +- src/Builder/Accumulator/ShiftAccumulator.php | 8 +- .../Accumulator/StdDevPopAccumulator.php | 8 +- .../Accumulator/StdDevSampAccumulator.php | 8 +- src/Builder/Accumulator/SumAccumulator.php | 8 +- src/Builder/Accumulator/TopAccumulator.php | 8 +- src/Builder/Accumulator/TopNAccumulator.php | 16 +- src/Builder/Expression/AbsOperator.php | 8 +- src/Builder/Expression/AcosOperator.php | 8 +- src/Builder/Expression/AcoshOperator.php | 8 +- src/Builder/Expression/AddOperator.php | 9 +- .../Expression/AllElementsTrueOperator.php | 8 +- .../Expression/AnyElementTrueOperator.php | 8 +- .../Expression/ArrayElemAtOperator.php | 18 +- .../Expression/ArrayToObjectOperator.php | 8 +- src/Builder/Expression/AsinOperator.php | 8 +- src/Builder/Expression/AsinhOperator.php | 8 +- src/Builder/Expression/Atan2Operator.php | 16 +- src/Builder/Expression/AtanOperator.php | 8 +- src/Builder/Expression/AtanhOperator.php | 8 +- src/Builder/Expression/AvgOperator.php | 6 +- src/Builder/Expression/BitAndOperator.php | 6 +- src/Builder/Expression/BitNotOperator.php | 8 +- src/Builder/Expression/BitOrOperator.php | 6 +- src/Builder/Expression/BitXorOperator.php | 6 +- src/Builder/Expression/BsonSizeOperator.php | 11 +- src/Builder/Expression/CaseOperator.php | 8 +- src/Builder/Expression/CeilOperator.php | 8 +- .../Expression/ConcatArraysOperator.php | 6 +- src/Builder/Expression/CondOperator.php | 8 +- src/Builder/Expression/CosOperator.php | 8 +- src/Builder/Expression/CoshOperator.php | 8 +- src/Builder/Expression/DateAddOperator.php | 16 +- src/Builder/Expression/DateDiffOperator.php | 16 +- .../Expression/DateFromPartsOperator.php | 80 +-- .../Expression/DateSubtractOperator.php | 16 +- .../Expression/DateToPartsOperator.php | 16 +- .../Expression/DateToStringOperator.php | 8 +- src/Builder/Expression/DateTruncOperator.php | 16 +- src/Builder/Expression/DayOfMonthOperator.php | 8 +- src/Builder/Expression/DayOfWeekOperator.php | 8 +- src/Builder/Expression/DayOfYearOperator.php | 8 +- .../Expression/DegreesToRadiansOperator.php | 8 +- src/Builder/Expression/DivideOperator.php | 16 +- src/Builder/Expression/ExpOperator.php | 8 +- src/Builder/Expression/FactoryTrait.php | 628 +++++++++--------- src/Builder/Expression/FilterOperator.php | 24 +- src/Builder/Expression/FirstNOperator.php | 18 +- src/Builder/Expression/FirstOperator.php | 8 +- src/Builder/Expression/FloorOperator.php | 8 +- src/Builder/Expression/FunctionOperator.php | 13 +- src/Builder/Expression/HourOperator.php | 8 +- src/Builder/Expression/InOperator.php | 8 +- .../Expression/IndexOfArrayOperator.php | 24 +- .../Expression/IndexOfBytesOperator.php | 16 +- src/Builder/Expression/IndexOfCPOperator.php | 16 +- .../Expression/IsoDayOfWeekOperator.php | 8 +- src/Builder/Expression/IsoWeekOperator.php | 8 +- .../Expression/IsoWeekYearOperator.php | 8 +- src/Builder/Expression/LastNOperator.php | 18 +- src/Builder/Expression/LastOperator.php | 8 +- src/Builder/Expression/LetOperator.php | 8 +- src/Builder/Expression/LnOperator.php | 8 +- src/Builder/Expression/Log10Operator.php | 8 +- src/Builder/Expression/LogOperator.php | 16 +- src/Builder/Expression/MapOperator.php | 8 +- src/Builder/Expression/MaxNOperator.php | 18 +- src/Builder/Expression/MedianOperator.php | 8 +- .../Expression/MergeObjectsOperator.php | 6 +- .../Expression/MillisecondOperator.php | 8 +- src/Builder/Expression/MinNOperator.php | 18 +- src/Builder/Expression/MinuteOperator.php | 8 +- src/Builder/Expression/ModOperator.php | 16 +- src/Builder/Expression/MonthOperator.php | 8 +- src/Builder/Expression/MultiplyOperator.php | 6 +- .../Expression/ObjectToArrayOperator.php | 8 +- src/Builder/Expression/PercentileOperator.php | 16 +- src/Builder/Expression/PowOperator.php | 16 +- .../Expression/RadiansToDegreesOperator.php | 8 +- src/Builder/Expression/RangeOperator.php | 24 +- src/Builder/Expression/ReduceOperator.php | 8 +- .../Expression/ReverseArrayOperator.php | 8 +- src/Builder/Expression/RoundOperator.php | 16 +- src/Builder/Expression/SecondOperator.php | 8 +- .../Expression/SetDifferenceOperator.php | 16 +- src/Builder/Expression/SetEqualsOperator.php | 6 +- src/Builder/Expression/SetFieldOperator.php | 8 +- .../Expression/SetIntersectionOperator.php | 6 +- .../Expression/SetIsSubsetOperator.php | 16 +- src/Builder/Expression/SetUnionOperator.php | 6 +- src/Builder/Expression/SinOperator.php | 8 +- src/Builder/Expression/SinhOperator.php | 8 +- src/Builder/Expression/SizeOperator.php | 8 +- src/Builder/Expression/SliceOperator.php | 24 +- src/Builder/Expression/SortArrayOperator.php | 16 +- src/Builder/Expression/SqrtOperator.php | 8 +- src/Builder/Expression/StdDevPopOperator.php | 6 +- src/Builder/Expression/StdDevSampOperator.php | 6 +- .../Expression/SubstrBytesOperator.php | 19 +- src/Builder/Expression/SubstrCPOperator.php | 19 +- src/Builder/Expression/SubstrOperator.php | 19 +- src/Builder/Expression/SubtractOperator.php | 16 +- src/Builder/Expression/SumOperator.php | 6 +- src/Builder/Expression/SwitchOperator.php | 8 +- src/Builder/Expression/TanOperator.php | 8 +- src/Builder/Expression/TanhOperator.php | 8 +- src/Builder/Expression/TruncOperator.php | 16 +- .../Expression/TsIncrementOperator.php | 8 +- src/Builder/Expression/TsSecondOperator.php | 8 +- src/Builder/Expression/UnsetFieldOperator.php | 8 +- src/Builder/Expression/WeekOperator.php | 8 +- src/Builder/Expression/YearOperator.php | 8 +- src/Builder/Expression/ZipOperator.php | 24 +- src/Builder/Query/BoxOperator.php | 8 +- src/Builder/Query/CenterOperator.php | 8 +- src/Builder/Query/CenterSphereOperator.php | 8 +- src/Builder/Query/ExistsOperator.php | 8 +- src/Builder/Query/FactoryTrait.php | 92 +-- src/Builder/Query/GeometryOperator.php | 16 +- src/Builder/Query/InOperator.php | 8 +- src/Builder/Query/JsonSchemaOperator.php | 8 +- src/Builder/Query/MaxDistanceOperator.php | 8 +- src/Builder/Query/MinDistanceOperator.php | 8 +- src/Builder/Query/ModOperator.php | 18 +- src/Builder/Query/NearOperator.php | 16 +- src/Builder/Query/NearSphereOperator.php | 16 +- src/Builder/Query/NinOperator.php | 8 +- src/Builder/Query/PolygonOperator.php | 8 +- src/Builder/Query/RegexOperator.php | 8 +- src/Builder/Query/SampleRateOperator.php | 8 +- src/Builder/Query/SizeOperator.php | 8 +- src/Builder/Query/TextOperator.php | 16 +- src/Builder/Search/AutocompleteOperator.php | 8 +- src/Builder/Search/CompoundOperator.php | 40 +- src/Builder/Search/FacetOperator.php | 8 +- src/Builder/Search/FactoryTrait.php | 64 +- src/Builder/Search/GeoWithinOperator.php | 16 +- src/Builder/Search/MoreLikeThisOperator.php | 8 +- src/Builder/Search/NearOperator.php | 16 +- src/Builder/Search/PhraseOperator.php | 8 +- src/Builder/Search/RegexOperator.php | 8 +- src/Builder/Search/TextOperator.php | 8 +- src/Builder/Search/WildcardOperator.php | 8 +- src/Builder/Stage/BucketAutoStage.php | 24 +- src/Builder/Stage/BucketStage.php | 16 +- src/Builder/Stage/ChangeStreamStage.php | 40 +- src/Builder/Stage/CollStatsStage.php | 32 +- src/Builder/Stage/CurrentOpStage.php | 40 +- src/Builder/Stage/DensifyStage.php | 16 +- src/Builder/Stage/DocumentsStage.php | 8 +- src/Builder/Stage/FactoryTrait.php | 228 +++---- src/Builder/Stage/FillStage.php | 24 +- src/Builder/Stage/FluentFactoryTrait.php | 228 +++---- src/Builder/Stage/GeoNearStage.php | 40 +- src/Builder/Stage/GraphLookupStage.php | 8 +- src/Builder/Stage/LimitStage.php | 8 +- src/Builder/Stage/ListLocalSessionsStage.php | 16 +- src/Builder/Stage/ListSessionsStage.php | 16 +- src/Builder/Stage/LookupStage.php | 8 +- src/Builder/Stage/MergeStage.php | 8 +- src/Builder/Stage/ReplaceRootStage.php | 8 +- src/Builder/Stage/ReplaceWithStage.php | 8 +- src/Builder/Stage/SampleStage.php | 8 +- src/Builder/Stage/SearchMetaStage.php | 8 +- src/Builder/Stage/SearchStage.php | 56 +- src/Builder/Stage/SetWindowFieldsStage.php | 16 +- src/Builder/Stage/SkipStage.php | 8 +- src/Builder/Stage/UnwindStage.php | 8 +- src/Builder/Stage/VectorSearchStage.php | 32 +- 187 files changed, 1849 insertions(+), 1800 deletions(-) diff --git a/generator/config/expressions.php b/generator/config/expressions.php index a2c649e8e..227c0cb1e 100644 --- a/generator/config/expressions.php +++ b/generator/config/expressions.php @@ -13,6 +13,7 @@ use MongoDB\Model\BSONArray; use stdClass; +use function in_array; use function ucfirst; $bsonTypes = [ @@ -45,6 +46,11 @@ $expressions = []; $resolvesToInterfaces = []; foreach ($bsonTypes as $name => $acceptedTypes) { + // an expression can be a string with a $-prefixed field name + if (! in_array('string', $acceptedTypes)) { + $acceptedTypes[] = 'string'; + } + $expressions[$name] = ['acceptedTypes' => $acceptedTypes]; $resolvesTo = 'resolvesTo' . ucfirst($name); diff --git a/src/Builder/Accumulator/AccumulatorAccumulator.php b/src/Builder/Accumulator/AccumulatorAccumulator.php index a49390fd6..e35737cbc 100644 --- a/src/Builder/Accumulator/AccumulatorAccumulator.php +++ b/src/Builder/Accumulator/AccumulatorAccumulator.php @@ -50,8 +50,8 @@ final class AccumulatorAccumulator implements AccumulatorInterface, OperatorInte /** @var Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. */ public readonly Javascript|string $accumulate; - /** @var BSONArray|PackedArray|ResolvesToArray|array $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $accumulateArgs; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs; /** @var Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. */ public readonly Javascript|string $merge; @@ -59,8 +59,8 @@ final class AccumulatorAccumulator implements AccumulatorInterface, OperatorInte /** @var string $lang The language used in the $accumulator code. */ public readonly string $lang; - /** @var Optional|BSONArray|PackedArray|ResolvesToArray|array $initArgs Arguments passed to the init function. */ - public readonly Optional|PackedArray|ResolvesToArray|BSONArray|array $initArgs; + /** @var Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. */ + public readonly Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs; /** @var Optional|Javascript|string $finalize Function used to update the result of the accumulation. */ public readonly Optional|Javascript|string $finalize; @@ -68,19 +68,19 @@ final class AccumulatorAccumulator implements AccumulatorInterface, OperatorInte /** * @param Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. * @param Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. - * @param BSONArray|PackedArray|ResolvesToArray|array $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. * @param Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. * @param string $lang The language used in the $accumulator code. - * @param Optional|BSONArray|PackedArray|ResolvesToArray|array $initArgs Arguments passed to the init function. + * @param Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. * @param Optional|Javascript|string $finalize Function used to update the result of the accumulation. */ public function __construct( Javascript|string $init, Javascript|string $accumulate, - PackedArray|ResolvesToArray|BSONArray|array $accumulateArgs, + PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs, Javascript|string $merge, string $lang, - Optional|PackedArray|ResolvesToArray|BSONArray|array $initArgs = Optional::Undefined, + Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs = Optional::Undefined, Optional|Javascript|string $finalize = Optional::Undefined, ) { if (is_string($init)) { diff --git a/src/Builder/Accumulator/AvgAccumulator.php b/src/Builder/Accumulator/AvgAccumulator.php index 4b9050117..c8400e74c 100644 --- a/src/Builder/Accumulator/AvgAccumulator.php +++ b/src/Builder/Accumulator/AvgAccumulator.php @@ -29,13 +29,13 @@ final class AvgAccumulator implements AccumulatorInterface, WindowInterface, Ope public const NAME = '$avg'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/BottomAccumulator.php b/src/Builder/Accumulator/BottomAccumulator.php index eecf0a013..6ef5252b6 100644 --- a/src/Builder/Accumulator/BottomAccumulator.php +++ b/src/Builder/Accumulator/BottomAccumulator.php @@ -31,18 +31,18 @@ final class BottomAccumulator implements AccumulatorInterface, WindowInterface, public const NAME = '$bottom'; public const PROPERTIES = ['sortBy' => 'sortBy', 'output' => 'output']; - /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ - public readonly Document|Serializable|stdClass|array $sortBy; + /** @var Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array|string $sortBy; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public function __construct( - Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->sortBy = $sortBy; diff --git a/src/Builder/Accumulator/BottomNAccumulator.php b/src/Builder/Accumulator/BottomNAccumulator.php index 94911d25e..09e7af44a 100644 --- a/src/Builder/Accumulator/BottomNAccumulator.php +++ b/src/Builder/Accumulator/BottomNAccumulator.php @@ -33,23 +33,23 @@ final class BottomNAccumulator implements AccumulatorInterface, WindowInterface, public const NAME = '$bottomN'; public const PROPERTIES = ['n' => 'n', 'sortBy' => 'sortBy', 'output' => 'output']; - /** @var ResolvesToInt|int $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; - /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ - public readonly Document|Serializable|stdClass|array $sortBy; + /** @var Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array|string $sortBy; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** - * @param ResolvesToInt|int $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public function __construct( - ResolvesToInt|int $n, - Document|Serializable|stdClass|array $sortBy, + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->n = $n; diff --git a/src/Builder/Accumulator/CovariancePopAccumulator.php b/src/Builder/Accumulator/CovariancePopAccumulator.php index d9bd9173e..71d417c06 100644 --- a/src/Builder/Accumulator/CovariancePopAccumulator.php +++ b/src/Builder/Accumulator/CovariancePopAccumulator.php @@ -28,19 +28,19 @@ final class CovariancePopAccumulator implements WindowInterface, OperatorInterfa public const NAME = '$covariancePop'; public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression1 */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression1; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression2; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Accumulator/CovarianceSampAccumulator.php b/src/Builder/Accumulator/CovarianceSampAccumulator.php index 85ba2cf28..660289d93 100644 --- a/src/Builder/Accumulator/CovarianceSampAccumulator.php +++ b/src/Builder/Accumulator/CovarianceSampAccumulator.php @@ -28,19 +28,19 @@ final class CovarianceSampAccumulator implements WindowInterface, OperatorInterf public const NAME = '$covarianceSamp'; public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression1 */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression1; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression1; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression2; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression2; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Accumulator/DerivativeAccumulator.php b/src/Builder/Accumulator/DerivativeAccumulator.php index 9ede80357..52287121a 100644 --- a/src/Builder/Accumulator/DerivativeAccumulator.php +++ b/src/Builder/Accumulator/DerivativeAccumulator.php @@ -33,8 +33,8 @@ final class DerivativeAccumulator implements WindowInterface, OperatorInterface public const NAME = '$derivative'; public const PROPERTIES = ['input' => 'input', 'unit' => 'unit']; - /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input */ - public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input; + /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */ + public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input; /** * @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". @@ -43,12 +43,12 @@ final class DerivativeAccumulator implements WindowInterface, OperatorInterface public readonly Optional|ResolvesToString|TimeUnit|string $unit; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. */ public function __construct( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, ) { $this->input = $input; diff --git a/src/Builder/Accumulator/ExpMovingAvgAccumulator.php b/src/Builder/Accumulator/ExpMovingAvgAccumulator.php index 2bfe285f8..a80cacdb8 100644 --- a/src/Builder/Accumulator/ExpMovingAvgAccumulator.php +++ b/src/Builder/Accumulator/ExpMovingAvgAccumulator.php @@ -29,34 +29,34 @@ final class ExpMovingAvgAccumulator implements WindowInterface, OperatorInterfac public const NAME = '$expMovingAvg'; public const PROPERTIES = ['input' => 'input', 'N' => 'N', 'alpha' => 'alpha']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $input */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $input; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; /** - * @var Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + * @var Optional|int|string $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. * You must specify either N or alpha. You cannot specify both. * The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: */ - public readonly Optional|int $N; + public readonly Optional|int|string $N; /** - * @var Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + * @var Optional|Int64|float|int|string $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. * You must specify either N or alpha. You cannot specify both. */ - public readonly Optional|Int64|float|int $alpha; + public readonly Optional|Int64|float|int|string $alpha; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $input - * @param Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input + * @param Optional|int|string $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. * You must specify either N or alpha. You cannot specify both. * The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: - * @param Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + * @param Optional|Int64|float|int|string $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. * You must specify either N or alpha. You cannot specify both. */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $input, - Optional|int $N = Optional::Undefined, - Optional|Int64|float|int $alpha = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + Optional|int|string $N = Optional::Undefined, + Optional|Int64|float|int|string $alpha = Optional::Undefined, ) { $this->input = $input; $this->N = $N; diff --git a/src/Builder/Accumulator/FactoryTrait.php b/src/Builder/Accumulator/FactoryTrait.php index e3ab1f24e..e666fe7c5 100644 --- a/src/Builder/Accumulator/FactoryTrait.php +++ b/src/Builder/Accumulator/FactoryTrait.php @@ -40,19 +40,19 @@ trait FactoryTrait * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/ * @param Javascript|string $init Function used to initialize the state. The init function receives its arguments from the initArgs array expression. You can specify the function definition as either BSON type Code or String. * @param Javascript|string $accumulate Function used to accumulate documents. The accumulate function receives its arguments from the current state and accumulateArgs array expression. The result of the accumulate function becomes the new state. You can specify the function definition as either BSON type Code or String. - * @param BSONArray|PackedArray|ResolvesToArray|array $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $accumulateArgs Arguments passed to the accumulate function. You can use accumulateArgs to specify what field value(s) to pass to the accumulate function. * @param Javascript|string $merge Function used to merge two internal states. merge must be either a String or Code BSON type. merge returns the combined result of the two merged states. For information on when the merge function is called, see Merge Two States with $merge. * @param string $lang The language used in the $accumulator code. - * @param Optional|BSONArray|PackedArray|ResolvesToArray|array $initArgs Arguments passed to the init function. + * @param Optional|BSONArray|PackedArray|ResolvesToArray|array|string $initArgs Arguments passed to the init function. * @param Optional|Javascript|string $finalize Function used to update the result of the accumulation. */ public static function accumulator( Javascript|string $init, Javascript|string $accumulate, - PackedArray|ResolvesToArray|BSONArray|array $accumulateArgs, + PackedArray|ResolvesToArray|BSONArray|array|string $accumulateArgs, Javascript|string $merge, string $lang, - Optional|PackedArray|ResolvesToArray|BSONArray|array $initArgs = Optional::Undefined, + Optional|PackedArray|ResolvesToArray|BSONArray|array|string $initArgs = Optional::Undefined, Optional|Javascript|string $finalize = Optional::Undefined, ): AccumulatorAccumulator { return new AccumulatorAccumulator($init, $accumulate, $accumulateArgs, $merge, $lang, $initArgs, $finalize); @@ -76,9 +76,9 @@ public static function addToSet( * Changed in MongoDB 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function avg(Decimal128|Int64|ResolvesToNumber|float|int $expression): AvgAccumulator + public static function avg(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AvgAccumulator { return new AvgAccumulator($expression); } @@ -88,11 +88,11 @@ public static function avg(Decimal128|Int64|ResolvesToNumber|float|int $expressi * New in MongoDB 5.2: Available in the $group and $setWindowFields stages. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottom/ - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public static function bottom( - Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): BottomAccumulator { return new BottomAccumulator($sortBy, $output); @@ -104,13 +104,13 @@ public static function bottom( * Available in the $group and $setWindowFields stages. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bottomN/ - * @param ResolvesToInt|int $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param ResolvesToInt|int|string $n Limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public static function bottomN( - ResolvesToInt|int $n, - Document|Serializable|stdClass|array $sortBy, + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): BottomNAccumulator { return new BottomNAccumulator($n, $sortBy, $output); @@ -133,12 +133,12 @@ public static function count(): CountAccumulator * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ public static function covariancePop( - Decimal128|Int64|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, ): CovariancePopAccumulator { return new CovariancePopAccumulator($expression1, $expression2); } @@ -148,12 +148,12 @@ public static function covariancePop( * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression2 */ public static function covarianceSamp( - Decimal128|Int64|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression2, ): CovarianceSampAccumulator { return new CovarianceSampAccumulator($expression1, $expression2); } @@ -174,12 +174,12 @@ public static function denseRank(): DenseRankAccumulator * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. */ public static function derivative( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, ): DerivativeAccumulator { return new DerivativeAccumulator($input, $unit); @@ -201,17 +201,17 @@ public static function documentNumber(): DocumentNumberAccumulator * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $input - * @param Optional|int $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input + * @param Optional|int|string $N An integer that specifies the number of historical documents that have a significant mathematical weight in the exponential moving average calculation, with the most recent documents contributing the most weight. * You must specify either N or alpha. You cannot specify both. * The N value is used in this formula to calculate the current result based on the expression value from the current document being read and the previous result of the calculation: - * @param Optional|Int64|float|int $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. + * @param Optional|Int64|float|int|string $alpha A double that specifies the exponential decay value to use in the exponential moving average calculation. A higher alpha value assigns a lower mathematical significance to previous results from the calculation. * You must specify either N or alpha. You cannot specify both. */ public static function expMovingAvg( - Decimal128|Int64|ResolvesToNumber|float|int $input, - Optional|int $N = Optional::Undefined, - Optional|Int64|float|int $alpha = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + Optional|int|string $N = Optional::Undefined, + Optional|Int64|float|int|string $alpha = Optional::Undefined, ): ExpMovingAvgAccumulator { return new ExpMovingAvgAccumulator($input, $N, $alpha); } @@ -236,11 +236,11 @@ public static function first( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. - * @param ResolvesToInt|int $n A positive integral expression that is either a constant or depends on the _id value for $group. + * @param ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. */ public static function firstN( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, - ResolvesToInt|int $n, + ResolvesToInt|int|string $n, ): FirstNAccumulator { return new FirstNAccumulator($input, $n); } @@ -250,12 +250,12 @@ public static function firstN( * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. */ public static function integral( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, ): IntegralAccumulator { return new IntegralAccumulator($input, $unit); @@ -280,12 +280,12 @@ public static function last( * If the group contains fewer than n elements, $lastN returns all elements in the group. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ public static function lastN( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToInt|int $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, ): LastNAccumulator { return new LastNAccumulator($input, $n); } @@ -296,10 +296,11 @@ public static function lastN( * New in MongoDB 5.3. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function linearFill(Decimal128|Int64|ResolvesToNumber|float|int $expression): LinearFillAccumulator - { + public static function linearFill( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, + ): LinearFillAccumulator { return new LinearFillAccumulator($expression); } @@ -334,12 +335,12 @@ public static function max( * Returns the n largest values in an array. Distinct from the $maxN accumulator. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ public static function maxN( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToInt|int $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, ): MaxNAccumulator { return new MaxNAccumulator($input, $n); } @@ -353,11 +354,11 @@ public static function maxN( * It is also available as an aggregation expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public static function median( - Decimal128|Int64|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int|string $input, string $method, ): MedianAccumulator { return new MedianAccumulator($input, $method); @@ -367,10 +368,10 @@ public static function median( * Combines multiple documents into a single document. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $document Any valid expression that resolves to a document. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. */ public static function mergeObjects( - Document|Serializable|ResolvesToObject|stdClass|array $document, + Document|Serializable|ResolvesToObject|stdClass|array|string $document, ): MergeObjectsAccumulator { return new MergeObjectsAccumulator($document); } @@ -392,12 +393,12 @@ public static function min( * Returns the n smallest values in an array. Distinct from the $minN accumulator. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ public static function minN( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToInt|int $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, ): MinNAccumulator { return new MinNAccumulator($input, $n); } @@ -414,14 +415,14 @@ public static function minN( * It is also available as an aggregation expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. - * @param BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public static function percentile( - Decimal128|Int64|ResolvesToNumber|float|int $input, - PackedArray|ResolvesToArray|BSONArray|array $p, + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, string $method, ): PercentileAccumulator { return new PercentileAccumulator($input, $p, $method); @@ -457,7 +458,7 @@ public static function rank(): RankAccumulator * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output. - * @param int $by Specifies an integer with a numeric document position relative to the current document in the output. + * @param int|string $by Specifies an integer with a numeric document position relative to the current document in the output. * For example: * 1 specifies the document position after the current document. * -1 specifies the document position before the current document. @@ -468,7 +469,7 @@ public static function rank(): RankAccumulator */ public static function shift( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, - int $by, + int|string $by, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default, ): ShiftAccumulator { return new ShiftAccumulator($output, $by, $default); @@ -480,10 +481,11 @@ public static function shift( * Changed in MongoDB 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int $expression): StdDevPopAccumulator - { + public static function stdDevPop( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, + ): StdDevPopAccumulator { return new StdDevPopAccumulator($expression); } @@ -493,10 +495,11 @@ public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int $ex * Changed in MongoDB 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function stdDevSamp(Decimal128|Int64|ResolvesToNumber|float|int $expression): StdDevSampAccumulator - { + public static function stdDevSamp( + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, + ): StdDevSampAccumulator { return new StdDevSampAccumulator($expression); } @@ -505,9 +508,9 @@ public static function stdDevSamp(Decimal128|Int64|ResolvesToNumber|float|int $e * Changed in MongoDB 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function sum(Decimal128|Int64|ResolvesToNumber|float|int $expression): SumAccumulator + public static function sum(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SumAccumulator { return new SumAccumulator($expression); } @@ -519,11 +522,11 @@ public static function sum(Decimal128|Int64|ResolvesToNumber|float|int $expressi * Available in the $group and $setWindowFields stages. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/top/ - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public static function top( - Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): TopAccumulator { return new TopAccumulator($sortBy, $output); @@ -536,13 +539,13 @@ public static function top( * Available in the $group and $setWindowFields stages. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/topN/ - * @param ResolvesToInt|int $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public static function topN( - ResolvesToInt|int $n, - Document|Serializable|stdClass|array $sortBy, + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): TopNAccumulator { return new TopNAccumulator($n, $sortBy, $output); diff --git a/src/Builder/Accumulator/FirstNAccumulator.php b/src/Builder/Accumulator/FirstNAccumulator.php index 740ebc7ae..77de95d20 100644 --- a/src/Builder/Accumulator/FirstNAccumulator.php +++ b/src/Builder/Accumulator/FirstNAccumulator.php @@ -34,16 +34,16 @@ final class FirstNAccumulator implements AccumulatorInterface, WindowInterface, /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input; - /** @var ResolvesToInt|int $n A positive integral expression that is either a constant or depends on the _id value for $group. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; /** * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $input An expression that resolves to the array from which to return n elements. - * @param ResolvesToInt|int $n A positive integral expression that is either a constant or depends on the _id value for $group. + * @param ResolvesToInt|int|string $n A positive integral expression that is either a constant or depends on the _id value for $group. */ public function __construct( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, - ResolvesToInt|int $n, + ResolvesToInt|int|string $n, ) { $this->input = $input; $this->n = $n; diff --git a/src/Builder/Accumulator/IntegralAccumulator.php b/src/Builder/Accumulator/IntegralAccumulator.php index be34f57a2..72aaa9f94 100644 --- a/src/Builder/Accumulator/IntegralAccumulator.php +++ b/src/Builder/Accumulator/IntegralAccumulator.php @@ -33,8 +33,8 @@ final class IntegralAccumulator implements WindowInterface, OperatorInterface public const NAME = '$integral'; public const PROPERTIES = ['input' => 'input', 'unit' => 'unit']; - /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input */ - public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input; + /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input */ + public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input; /** * @var Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". @@ -43,12 +43,12 @@ final class IntegralAccumulator implements WindowInterface, OperatorInterface public readonly Optional|ResolvesToString|TimeUnit|string $unit; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $input * @param Optional|ResolvesToString|TimeUnit|string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". * If the sortBy field is not a date, you must omit a unit. If you specify a unit, you must specify a date in the sortBy field. */ public function __construct( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $input, Optional|ResolvesToString|TimeUnit|string $unit = Optional::Undefined, ) { $this->input = $input; diff --git a/src/Builder/Accumulator/LastNAccumulator.php b/src/Builder/Accumulator/LastNAccumulator.php index c0ddbd9bb..965a4ea89 100644 --- a/src/Builder/Accumulator/LastNAccumulator.php +++ b/src/Builder/Accumulator/LastNAccumulator.php @@ -35,18 +35,20 @@ final class LastNAccumulator implements AccumulatorInterface, WindowInterface, O public const NAME = '$lastN'; public const PROPERTIES = ['input' => 'input', 'n' => 'n']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $input, ResolvesToInt|int $n) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); } diff --git a/src/Builder/Accumulator/LinearFillAccumulator.php b/src/Builder/Accumulator/LinearFillAccumulator.php index 59aade4a1..aeda38df7 100644 --- a/src/Builder/Accumulator/LinearFillAccumulator.php +++ b/src/Builder/Accumulator/LinearFillAccumulator.php @@ -29,13 +29,13 @@ final class LinearFillAccumulator implements WindowInterface, OperatorInterface public const NAME = '$linearFill'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/MaxNAccumulator.php b/src/Builder/Accumulator/MaxNAccumulator.php index 04530f24e..3ac67bc48 100644 --- a/src/Builder/Accumulator/MaxNAccumulator.php +++ b/src/Builder/Accumulator/MaxNAccumulator.php @@ -33,18 +33,20 @@ final class MaxNAccumulator implements AccumulatorInterface, WindowInterface, Op public const NAME = '$maxN'; public const PROPERTIES = ['input' => 'input', 'n' => 'n']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $input, ResolvesToInt|int $n) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); } diff --git a/src/Builder/Accumulator/MedianAccumulator.php b/src/Builder/Accumulator/MedianAccumulator.php index 358be201b..01017e20a 100644 --- a/src/Builder/Accumulator/MedianAccumulator.php +++ b/src/Builder/Accumulator/MedianAccumulator.php @@ -33,17 +33,17 @@ final class MedianAccumulator implements AccumulatorInterface, WindowInterface, public const NAME = '$median'; public const PROPERTIES = ['input' => 'input', 'method' => 'method']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $input; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; /** @var string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public readonly string $method; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $input, string $method) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $input, string $method) { $this->input = $input; $this->method = $method; diff --git a/src/Builder/Accumulator/MergeObjectsAccumulator.php b/src/Builder/Accumulator/MergeObjectsAccumulator.php index 87a8e6a00..db8ee615e 100644 --- a/src/Builder/Accumulator/MergeObjectsAccumulator.php +++ b/src/Builder/Accumulator/MergeObjectsAccumulator.php @@ -28,13 +28,13 @@ final class MergeObjectsAccumulator implements AccumulatorInterface, OperatorInt public const NAME = '$mergeObjects'; public const PROPERTIES = ['document' => 'document']; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $document Any valid expression that resolves to a document. */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $document; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $document; /** - * @param Document|ResolvesToObject|Serializable|array|stdClass $document Any valid expression that resolves to a document. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $document Any valid expression that resolves to a document. */ - public function __construct(Document|Serializable|ResolvesToObject|stdClass|array $document) + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $document) { $this->document = $document; } diff --git a/src/Builder/Accumulator/MinNAccumulator.php b/src/Builder/Accumulator/MinNAccumulator.php index 7a7dbcb37..fb1a6ecc1 100644 --- a/src/Builder/Accumulator/MinNAccumulator.php +++ b/src/Builder/Accumulator/MinNAccumulator.php @@ -33,18 +33,20 @@ final class MinNAccumulator implements AccumulatorInterface, WindowInterface, Op public const NAME = '$minN'; public const PROPERTIES = ['input' => 'input', 'n' => 'n']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $input, ResolvesToInt|int $n) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); } diff --git a/src/Builder/Accumulator/PercentileAccumulator.php b/src/Builder/Accumulator/PercentileAccumulator.php index 3766d8f1d..b3175a88c 100644 --- a/src/Builder/Accumulator/PercentileAccumulator.php +++ b/src/Builder/Accumulator/PercentileAccumulator.php @@ -43,27 +43,27 @@ final class PercentileAccumulator implements AccumulatorInterface, WindowInterfa public const NAME = '$percentile'; public const PROPERTIES = ['input' => 'input', 'p' => 'p', 'method' => 'method']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $input; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $input; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $p; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $p; /** @var string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public readonly string $method; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. - * @param BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $input, - PackedArray|ResolvesToArray|BSONArray|array $p, + Decimal128|Int64|ResolvesToNumber|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, string $method, ) { $this->input = $input; diff --git a/src/Builder/Accumulator/ShiftAccumulator.php b/src/Builder/Accumulator/ShiftAccumulator.php index 5f4200307..8c24afab1 100644 --- a/src/Builder/Accumulator/ShiftAccumulator.php +++ b/src/Builder/Accumulator/ShiftAccumulator.php @@ -32,13 +32,13 @@ final class ShiftAccumulator implements WindowInterface, OperatorInterface public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** - * @var int $by Specifies an integer with a numeric document position relative to the current document in the output. + * @var int|string $by Specifies an integer with a numeric document position relative to the current document in the output. * For example: * 1 specifies the document position after the current document. * -1 specifies the document position before the current document. * -2 specifies the document position that is two positions before the current document. */ - public readonly int $by; + public readonly int|string $by; /** * @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default Specifies an optional default expression to evaluate if the document position is outside of the implicit $setWindowFields stage window. The implicit window contains all the documents in the partition. @@ -49,7 +49,7 @@ final class ShiftAccumulator implements WindowInterface, OperatorInterface /** * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Specifies an expression to evaluate and return in the output. - * @param int $by Specifies an integer with a numeric document position relative to the current document in the output. + * @param int|string $by Specifies an integer with a numeric document position relative to the current document in the output. * For example: * 1 specifies the document position after the current document. * -1 specifies the document position before the current document. @@ -60,7 +60,7 @@ final class ShiftAccumulator implements WindowInterface, OperatorInterface */ public function __construct( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, - int $by, + int|string $by, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default, ) { $this->output = $output; diff --git a/src/Builder/Accumulator/StdDevPopAccumulator.php b/src/Builder/Accumulator/StdDevPopAccumulator.php index efa166707..5f6969fa9 100644 --- a/src/Builder/Accumulator/StdDevPopAccumulator.php +++ b/src/Builder/Accumulator/StdDevPopAccumulator.php @@ -30,13 +30,13 @@ final class StdDevPopAccumulator implements AccumulatorInterface, WindowInterfac public const NAME = '$stdDevPop'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/StdDevSampAccumulator.php b/src/Builder/Accumulator/StdDevSampAccumulator.php index d02f9e485..b081c7c03 100644 --- a/src/Builder/Accumulator/StdDevSampAccumulator.php +++ b/src/Builder/Accumulator/StdDevSampAccumulator.php @@ -30,13 +30,13 @@ final class StdDevSampAccumulator implements AccumulatorInterface, WindowInterfa public const NAME = '$stdDevSamp'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/SumAccumulator.php b/src/Builder/Accumulator/SumAccumulator.php index 172915e2c..2fa5b0b8f 100644 --- a/src/Builder/Accumulator/SumAccumulator.php +++ b/src/Builder/Accumulator/SumAccumulator.php @@ -29,13 +29,13 @@ final class SumAccumulator implements AccumulatorInterface, WindowInterface, Ope public const NAME = '$sum'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/TopAccumulator.php b/src/Builder/Accumulator/TopAccumulator.php index 7fac97efc..54652da0e 100644 --- a/src/Builder/Accumulator/TopAccumulator.php +++ b/src/Builder/Accumulator/TopAccumulator.php @@ -32,18 +32,18 @@ final class TopAccumulator implements AccumulatorInterface, OperatorInterface public const NAME = '$top'; public const PROPERTIES = ['sortBy' => 'sortBy', 'output' => 'output']; - /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ - public readonly Document|Serializable|stdClass|array $sortBy; + /** @var Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array|string $sortBy; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public function __construct( - Document|Serializable|stdClass|array $sortBy, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->sortBy = $sortBy; diff --git a/src/Builder/Accumulator/TopNAccumulator.php b/src/Builder/Accumulator/TopNAccumulator.php index ea0ae9bc0..4bafc12be 100644 --- a/src/Builder/Accumulator/TopNAccumulator.php +++ b/src/Builder/Accumulator/TopNAccumulator.php @@ -33,23 +33,23 @@ final class TopNAccumulator implements AccumulatorInterface, OperatorInterface public const NAME = '$topN'; public const PROPERTIES = ['n' => 'n', 'sortBy' => 'sortBy', 'output' => 'output']; - /** @var ResolvesToInt|int $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. */ + public readonly ResolvesToInt|int|string $n; - /** @var Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ - public readonly Document|Serializable|stdClass|array $sortBy; + /** @var Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. */ + public readonly Document|Serializable|stdClass|array|string $sortBy; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** - * @param ResolvesToInt|int $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. - * @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. + * @param ResolvesToInt|int|string $n limits the number of results per group and has to be a positive integral expression that is either a constant or depends on the _id value for $group. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the order of results, with syntax similar to $sort. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $output Represents the output for each element in the group and can be any expression. */ public function __construct( - ResolvesToInt|int $n, - Document|Serializable|stdClass|array $sortBy, + ResolvesToInt|int|string $n, + Document|Serializable|stdClass|array|string $sortBy, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->n = $n; diff --git a/src/Builder/Expression/AbsOperator.php b/src/Builder/Expression/AbsOperator.php index 977a05a44..7905edfdb 100644 --- a/src/Builder/Expression/AbsOperator.php +++ b/src/Builder/Expression/AbsOperator.php @@ -25,13 +25,13 @@ final class AbsOperator implements ResolvesToNumber, OperatorInterface public const NAME = '$abs'; public const PROPERTIES = ['value' => 'value']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $value */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $value; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $value */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $value; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $value + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $value */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $value) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $value) { $this->value = $value; } diff --git a/src/Builder/Expression/AcosOperator.php b/src/Builder/Expression/AcosOperator.php index 47ae210d3..9bd357ed7 100644 --- a/src/Builder/Expression/AcosOperator.php +++ b/src/Builder/Expression/AcosOperator.php @@ -26,18 +26,18 @@ final class AcosOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AcoshOperator.php b/src/Builder/Expression/AcoshOperator.php index 8be5bc4a7..30c8ac89f 100644 --- a/src/Builder/Expression/AcoshOperator.php +++ b/src/Builder/Expression/AcoshOperator.php @@ -26,18 +26,18 @@ final class AcoshOperator implements ResolvesToDouble, ResolvesToDecimal, Operat public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. * $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. * $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AddOperator.php b/src/Builder/Expression/AddOperator.php index 259e64b08..c7fe70d36 100644 --- a/src/Builder/Expression/AddOperator.php +++ b/src/Builder/Expression/AddOperator.php @@ -29,15 +29,16 @@ final class AddOperator implements ResolvesToInt, ResolvesToLong, ResolvesToDoub public const NAME = '$add'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */ + /** @var list $expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */ public readonly array $expression; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. * @no-named-arguments */ - public function __construct(Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int ...$expression) - { + public function __construct( + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string ...$expression, + ) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); } diff --git a/src/Builder/Expression/AllElementsTrueOperator.php b/src/Builder/Expression/AllElementsTrueOperator.php index dbb74d967..ec170e888 100644 --- a/src/Builder/Expression/AllElementsTrueOperator.php +++ b/src/Builder/Expression/AllElementsTrueOperator.php @@ -29,13 +29,13 @@ final class AllElementsTrueOperator implements ResolvesToBool, OperatorInterface public const NAME = '$allElementsTrue'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/AnyElementTrueOperator.php b/src/Builder/Expression/AnyElementTrueOperator.php index c8dd665b6..1ed6f1dd9 100644 --- a/src/Builder/Expression/AnyElementTrueOperator.php +++ b/src/Builder/Expression/AnyElementTrueOperator.php @@ -29,13 +29,13 @@ final class AnyElementTrueOperator implements ResolvesToBool, OperatorInterface public const NAME = '$anyElementTrue'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/ArrayElemAtOperator.php b/src/Builder/Expression/ArrayElemAtOperator.php index a5f333359..d7687eee3 100644 --- a/src/Builder/Expression/ArrayElemAtOperator.php +++ b/src/Builder/Expression/ArrayElemAtOperator.php @@ -29,18 +29,20 @@ final class ArrayElemAtOperator implements ResolvesToAny, OperatorInterface public const NAME = '$arrayElemAt'; public const PROPERTIES = ['array' => 'array', 'idx' => 'idx']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $array */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $array; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; - /** @var ResolvesToInt|int $idx */ - public readonly ResolvesToInt|int $idx; + /** @var ResolvesToInt|int|string $idx */ + public readonly ResolvesToInt|int|string $idx; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $array - * @param ResolvesToInt|int $idx + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array + * @param ResolvesToInt|int|string $idx */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $array, ResolvesToInt|int $idx) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ResolvesToInt|int|string $idx, + ) { if (is_array($array) && ! array_is_list($array)) { throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); } diff --git a/src/Builder/Expression/ArrayToObjectOperator.php b/src/Builder/Expression/ArrayToObjectOperator.php index 657f67676..6a97594e3 100644 --- a/src/Builder/Expression/ArrayToObjectOperator.php +++ b/src/Builder/Expression/ArrayToObjectOperator.php @@ -29,13 +29,13 @@ final class ArrayToObjectOperator implements ResolvesToObject, OperatorInterface public const NAME = '$arrayToObject'; public const PROPERTIES = ['array' => 'array']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $array */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $array; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $array + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $array) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $array) { if (is_array($array) && ! array_is_list($array)) { throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/AsinOperator.php b/src/Builder/Expression/AsinOperator.php index 4f9a205e3..1cdd56910 100644 --- a/src/Builder/Expression/AsinOperator.php +++ b/src/Builder/Expression/AsinOperator.php @@ -26,18 +26,18 @@ final class AsinOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AsinhOperator.php b/src/Builder/Expression/AsinhOperator.php index 4e5c72ef3..91d16061d 100644 --- a/src/Builder/Expression/AsinhOperator.php +++ b/src/Builder/Expression/AsinhOperator.php @@ -26,18 +26,18 @@ final class AsinhOperator implements ResolvesToDouble, ResolvesToDecimal, Operat public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number. * $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number. * $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/Atan2Operator.php b/src/Builder/Expression/Atan2Operator.php index 78f56c8a8..ba0dfe54f 100644 --- a/src/Builder/Expression/Atan2Operator.php +++ b/src/Builder/Expression/Atan2Operator.php @@ -26,24 +26,24 @@ final class Atan2Operator implements ResolvesToDouble, ResolvesToDecimal, Operat public const PROPERTIES = ['y' => 'y', 'x' => 'x']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number. * $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $y; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $y; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $x */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $x; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $x */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $x; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number. * $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. - * @param Decimal128|Int64|ResolvesToNumber|float|int $x + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $x */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $y, - Decimal128|Int64|ResolvesToNumber|float|int $x, + Decimal128|Int64|ResolvesToNumber|float|int|string $y, + Decimal128|Int64|ResolvesToNumber|float|int|string $x, ) { $this->y = $y; $this->x = $x; diff --git a/src/Builder/Expression/AtanOperator.php b/src/Builder/Expression/AtanOperator.php index 6362570d6..faa81825b 100644 --- a/src/Builder/Expression/AtanOperator.php +++ b/src/Builder/Expression/AtanOperator.php @@ -26,18 +26,18 @@ final class AtanOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number. * $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number. * $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AtanhOperator.php b/src/Builder/Expression/AtanhOperator.php index bdfba8ad9..6e19862e5 100644 --- a/src/Builder/Expression/AtanhOperator.php +++ b/src/Builder/Expression/AtanhOperator.php @@ -26,18 +26,18 @@ final class AtanhOperator implements ResolvesToDouble, ResolvesToDecimal, Operat public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AvgOperator.php b/src/Builder/Expression/AvgOperator.php index 31745f14a..52be761a9 100644 --- a/src/Builder/Expression/AvgOperator.php +++ b/src/Builder/Expression/AvgOperator.php @@ -29,14 +29,14 @@ final class AvgOperator implements ResolvesToNumber, OperatorInterface public const NAME = '$avg'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/BitAndOperator.php b/src/Builder/Expression/BitAndOperator.php index bf0e3cd73..eb6fffaca 100644 --- a/src/Builder/Expression/BitAndOperator.php +++ b/src/Builder/Expression/BitAndOperator.php @@ -28,14 +28,14 @@ final class BitAndOperator implements ResolvesToInt, ResolvesToLong, OperatorInt public const NAME = '$bitAnd'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression * @no-named-arguments */ - public function __construct(Int64|ResolvesToInt|ResolvesToLong|int ...$expression) + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/BitNotOperator.php b/src/Builder/Expression/BitNotOperator.php index 6f388919f..4d9f623fa 100644 --- a/src/Builder/Expression/BitNotOperator.php +++ b/src/Builder/Expression/BitNotOperator.php @@ -25,13 +25,13 @@ final class BitNotOperator implements ResolvesToInt, ResolvesToLong, OperatorInt public const NAME = '$bitNot'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Int64|ResolvesToInt|ResolvesToLong|int $expression */ - public readonly Int64|ResolvesToInt|ResolvesToLong|int $expression; + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $expression */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $expression; /** - * @param Int64|ResolvesToInt|ResolvesToLong|int $expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $expression */ - public function __construct(Int64|ResolvesToInt|ResolvesToLong|int $expression) + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/BitOrOperator.php b/src/Builder/Expression/BitOrOperator.php index b2490a4f6..bc68838e9 100644 --- a/src/Builder/Expression/BitOrOperator.php +++ b/src/Builder/Expression/BitOrOperator.php @@ -28,14 +28,14 @@ final class BitOrOperator implements ResolvesToInt, ResolvesToLong, OperatorInte public const NAME = '$bitOr'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression * @no-named-arguments */ - public function __construct(Int64|ResolvesToInt|ResolvesToLong|int ...$expression) + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/BitXorOperator.php b/src/Builder/Expression/BitXorOperator.php index 0f0bc0e5a..adbf5eb2e 100644 --- a/src/Builder/Expression/BitXorOperator.php +++ b/src/Builder/Expression/BitXorOperator.php @@ -28,14 +28,14 @@ final class BitXorOperator implements ResolvesToInt, ResolvesToLong, OperatorInt public const NAME = '$bitXor'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression * @no-named-arguments */ - public function __construct(Int64|ResolvesToInt|ResolvesToLong|int ...$expression) + public function __construct(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/BsonSizeOperator.php b/src/Builder/Expression/BsonSizeOperator.php index 962d8c6db..88c73fd80 100644 --- a/src/Builder/Expression/BsonSizeOperator.php +++ b/src/Builder/Expression/BsonSizeOperator.php @@ -26,14 +26,15 @@ final class BsonSizeOperator implements ResolvesToInt, OperatorInterface public const NAME = '$bsonSize'; public const PROPERTIES = ['object' => 'object']; - /** @var Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass $object */ - public readonly Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null $object; + /** @var Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object */ + public readonly Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object; /** - * @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass $object + * @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object */ - public function __construct(Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null $object) - { + public function __construct( + Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object, + ) { $this->object = $object; } } diff --git a/src/Builder/Expression/CaseOperator.php b/src/Builder/Expression/CaseOperator.php index 27da77d71..a87c6d110 100644 --- a/src/Builder/Expression/CaseOperator.php +++ b/src/Builder/Expression/CaseOperator.php @@ -27,18 +27,18 @@ final class CaseOperator implements SwitchBranchInterface, OperatorInterface public const NAME = null; public const PROPERTIES = ['case' => 'case', 'then' => 'then']; - /** @var ResolvesToBool|bool $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. */ - public readonly ResolvesToBool|bool $case; + /** @var ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. */ + public readonly ResolvesToBool|bool|string $case; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then; /** - * @param ResolvesToBool|bool $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * @param ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. */ public function __construct( - ResolvesToBool|bool $case, + ResolvesToBool|bool|string $case, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, ) { $this->case = $case; diff --git a/src/Builder/Expression/CeilOperator.php b/src/Builder/Expression/CeilOperator.php index c6771b81f..24feba8c4 100644 --- a/src/Builder/Expression/CeilOperator.php +++ b/src/Builder/Expression/CeilOperator.php @@ -25,13 +25,13 @@ final class CeilOperator implements ResolvesToInt, OperatorInterface public const NAME = '$ceil'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/ConcatArraysOperator.php b/src/Builder/Expression/ConcatArraysOperator.php index 17e736a78..12f862086 100644 --- a/src/Builder/Expression/ConcatArraysOperator.php +++ b/src/Builder/Expression/ConcatArraysOperator.php @@ -28,14 +28,14 @@ final class ConcatArraysOperator implements ResolvesToArray, OperatorInterface public const NAME = '$concatArrays'; public const PROPERTIES = ['array' => 'array']; - /** @var list $array */ + /** @var list $array */ public readonly array $array; /** - * @param BSONArray|PackedArray|ResolvesToArray|array ...$array + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array * @no-named-arguments */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array ...$array) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$array) { if (\count($array) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $array, got %d.', 1, \count($array))); diff --git a/src/Builder/Expression/CondOperator.php b/src/Builder/Expression/CondOperator.php index 26ca336f5..6239dc73c 100644 --- a/src/Builder/Expression/CondOperator.php +++ b/src/Builder/Expression/CondOperator.php @@ -26,8 +26,8 @@ final class CondOperator implements ResolvesToAny, OperatorInterface public const NAME = '$cond'; public const PROPERTIES = ['if' => 'if', 'then' => 'then', 'else' => 'else']; - /** @var ResolvesToBool|bool $if */ - public readonly ResolvesToBool|bool $if; + /** @var ResolvesToBool|bool|string $if */ + public readonly ResolvesToBool|bool|string $if; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then; @@ -36,12 +36,12 @@ final class CondOperator implements ResolvesToAny, OperatorInterface public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else; /** - * @param ResolvesToBool|bool $if + * @param ResolvesToBool|bool|string $if * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else */ public function __construct( - ResolvesToBool|bool $if, + ResolvesToBool|bool|string $if, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else, ) { diff --git a/src/Builder/Expression/CosOperator.php b/src/Builder/Expression/CosOperator.php index e06afa635..05d1b05b1 100644 --- a/src/Builder/Expression/CosOperator.php +++ b/src/Builder/Expression/CosOperator.php @@ -26,16 +26,16 @@ final class CosOperator implements ResolvesToDouble, ResolvesToDecimal, Operator public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/CoshOperator.php b/src/Builder/Expression/CoshOperator.php index c44dccb0b..9f1d4cf9e 100644 --- a/src/Builder/Expression/CoshOperator.php +++ b/src/Builder/Expression/CoshOperator.php @@ -26,16 +26,16 @@ final class CoshOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/DateAddOperator.php b/src/Builder/Expression/DateAddOperator.php index 0c0bbf100..00fc01492 100644 --- a/src/Builder/Expression/DateAddOperator.php +++ b/src/Builder/Expression/DateAddOperator.php @@ -29,28 +29,28 @@ final class DateAddOperator implements ResolvesToDate, OperatorInterface public const NAME = '$dateAdd'; public const PROPERTIES = ['startDate' => 'startDate', 'unit' => 'unit', 'amount' => 'amount', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; /** @var ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. */ public readonly ResolvesToString|TimeUnit|string $unit; - /** @var Int64|ResolvesToInt|ResolvesToLong|int $amount */ - public readonly Int64|ResolvesToInt|ResolvesToLong|int $amount; + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $amount */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $amount; /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. - * @param Int64|ResolvesToInt|ResolvesToLong|int $amount + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, ResolvesToString|TimeUnit|string $unit, - Int64|ResolvesToInt|ResolvesToLong|int $amount, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->startDate = $startDate; diff --git a/src/Builder/Expression/DateDiffOperator.php b/src/Builder/Expression/DateDiffOperator.php index a12ea935c..c120e00a7 100644 --- a/src/Builder/Expression/DateDiffOperator.php +++ b/src/Builder/Expression/DateDiffOperator.php @@ -35,11 +35,11 @@ final class DateDiffOperator implements ResolvesToInt, OperatorInterface 'startOfWeek' => 'startOfWeek', ]; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $endDate; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate; /** @var ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate */ public readonly ResolvesToString|TimeUnit|string $unit; @@ -51,15 +51,15 @@ final class DateDiffOperator implements ResolvesToInt, OperatorInterface public readonly Optional|ResolvesToString|string $startOfWeek; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. * @param Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $endDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate, ResolvesToString|TimeUnit|string $unit, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|ResolvesToString|string $startOfWeek = Optional::Undefined, diff --git a/src/Builder/Expression/DateFromPartsOperator.php b/src/Builder/Expression/DateFromPartsOperator.php index 877bfdd65..216c5ae7a 100644 --- a/src/Builder/Expression/DateFromPartsOperator.php +++ b/src/Builder/Expression/DateFromPartsOperator.php @@ -39,63 +39,63 @@ final class DateFromPartsOperator implements ResolvesToDate, OperatorInterface 'timezone' => 'timezone', ]; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $year; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $month Month. Defaults to 1. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $month; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $day Day of month. Defaults to 1. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $day; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour Hour. Defaults to 0. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute Minute. Defaults to 0. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $second Second. Defaults to 0. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $second; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second; - /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond; + /** @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. */ + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond; /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $month Month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $day Day of month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour Hour. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute Minute. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $second Second. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - Optional|Decimal128|Int64|ResolvesToNumber|float|int $year = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $month = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $day = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $second = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->year = $year; diff --git a/src/Builder/Expression/DateSubtractOperator.php b/src/Builder/Expression/DateSubtractOperator.php index 11fbfdcfd..9e9ec7212 100644 --- a/src/Builder/Expression/DateSubtractOperator.php +++ b/src/Builder/Expression/DateSubtractOperator.php @@ -29,28 +29,28 @@ final class DateSubtractOperator implements ResolvesToDate, OperatorInterface public const NAME = '$dateSubtract'; public const PROPERTIES = ['startDate' => 'startDate', 'unit' => 'unit', 'amount' => 'amount', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate; /** @var ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. */ public readonly ResolvesToString|TimeUnit|string $unit; - /** @var Int64|ResolvesToInt|ResolvesToLong|int $amount */ - public readonly Int64|ResolvesToInt|ResolvesToLong|int $amount; + /** @var Int64|ResolvesToInt|ResolvesToLong|int|string $amount */ + public readonly Int64|ResolvesToInt|ResolvesToLong|int|string $amount; /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. - * @param Int64|ResolvesToInt|ResolvesToLong|int $amount + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, ResolvesToString|TimeUnit|string $unit, - Int64|ResolvesToInt|ResolvesToLong|int $amount, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->startDate = $startDate; diff --git a/src/Builder/Expression/DateToPartsOperator.php b/src/Builder/Expression/DateToPartsOperator.php index 3573e59c8..811797b3d 100644 --- a/src/Builder/Expression/DateToPartsOperator.php +++ b/src/Builder/Expression/DateToPartsOperator.php @@ -27,24 +27,24 @@ final class DateToPartsOperator implements ResolvesToObject, OperatorInterface public const NAME = '$dateToParts'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone', 'iso8601' => 'iso8601']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; - /** @var Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. */ - public readonly Optional|bool $iso8601; + /** @var Optional|bool|string $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. */ + public readonly Optional|bool|string $iso8601; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. - * @param Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. + * @param Optional|bool|string $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|bool $iso8601 = Optional::Undefined, + Optional|bool|string $iso8601 = Optional::Undefined, ) { $this->date = $date; $this->timezone = $timezone; diff --git a/src/Builder/Expression/DateToStringOperator.php b/src/Builder/Expression/DateToStringOperator.php index 7f9ede2d9..6b9b39178 100644 --- a/src/Builder/Expression/DateToStringOperator.php +++ b/src/Builder/Expression/DateToStringOperator.php @@ -30,8 +30,8 @@ final class DateToStringOperator implements ResolvesToString, OperatorInterface public const NAME = '$dateToString'; public const PROPERTIES = ['date' => 'date', 'format' => 'format', 'timezone' => 'timezone', 'onNull' => 'onNull']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** * @var Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. @@ -49,7 +49,7 @@ final class DateToStringOperator implements ResolvesToString, OperatorInterface public readonly Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. @@ -57,7 +57,7 @@ final class DateToStringOperator implements ResolvesToString, OperatorInterface * If unspecified, $dateToString returns null if the date is null or missing. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, diff --git a/src/Builder/Expression/DateTruncOperator.php b/src/Builder/Expression/DateTruncOperator.php index b5e162bba..4570d4980 100644 --- a/src/Builder/Expression/DateTruncOperator.php +++ b/src/Builder/Expression/DateTruncOperator.php @@ -37,8 +37,8 @@ final class DateTruncOperator implements ResolvesToDate, OperatorInterface 'startOfWeek' => 'startOfWeek', ]; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** * @var ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. @@ -47,10 +47,10 @@ final class DateTruncOperator implements ResolvesToDate, OperatorInterface public readonly ResolvesToString|TimeUnit|string $unit; /** - * @var Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * @var Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. * Together, binSize and unit specify the time period used in the $dateTrunc calculation. */ - public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize; + public readonly Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize; /** @var Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; @@ -62,19 +62,19 @@ final class DateTruncOperator implements ResolvesToDate, OperatorInterface public readonly Optional|string $startOfWeek; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. * Together, binSize and unit specify the time period used in the $dateTrunc calculation. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. * Together, binSize and unit specify the time period used in the $dateTrunc calculation. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. * @param Optional|string $startOfWeek The start of the week. Used when * unit is week. Defaults to Sunday. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, ResolvesToString|TimeUnit|string $unit, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|string $startOfWeek = Optional::Undefined, ) { diff --git a/src/Builder/Expression/DayOfMonthOperator.php b/src/Builder/Expression/DayOfMonthOperator.php index bc0ccb28f..9c20e556d 100644 --- a/src/Builder/Expression/DayOfMonthOperator.php +++ b/src/Builder/Expression/DayOfMonthOperator.php @@ -27,18 +27,18 @@ final class DayOfMonthOperator implements ResolvesToInt, OperatorInterface public const NAME = '$dayOfMonth'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/DayOfWeekOperator.php b/src/Builder/Expression/DayOfWeekOperator.php index e9dbbfa08..166b674f8 100644 --- a/src/Builder/Expression/DayOfWeekOperator.php +++ b/src/Builder/Expression/DayOfWeekOperator.php @@ -27,18 +27,18 @@ final class DayOfWeekOperator implements ResolvesToInt, OperatorInterface public const NAME = '$dayOfWeek'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/DayOfYearOperator.php b/src/Builder/Expression/DayOfYearOperator.php index 86c20ab20..09150ab85 100644 --- a/src/Builder/Expression/DayOfYearOperator.php +++ b/src/Builder/Expression/DayOfYearOperator.php @@ -27,18 +27,18 @@ final class DayOfYearOperator implements ResolvesToInt, OperatorInterface public const NAME = '$dayOfYear'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/DegreesToRadiansOperator.php b/src/Builder/Expression/DegreesToRadiansOperator.php index b8d2bb07a..27d300211 100644 --- a/src/Builder/Expression/DegreesToRadiansOperator.php +++ b/src/Builder/Expression/DegreesToRadiansOperator.php @@ -26,16 +26,16 @@ final class DegreesToRadiansOperator implements ResolvesToDouble, ResolvesToDeci public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/DivideOperator.php b/src/Builder/Expression/DivideOperator.php index 74de49c20..6911e5d44 100644 --- a/src/Builder/Expression/DivideOperator.php +++ b/src/Builder/Expression/DivideOperator.php @@ -25,19 +25,19 @@ final class DivideOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$divide'; public const PROPERTIES = ['dividend' => 'dividend', 'divisor' => 'divisor']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $dividend; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $dividend; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $divisor */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $divisor; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $divisor; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. - * @param Decimal128|Int64|ResolvesToNumber|float|int $divisor + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, ) { $this->dividend = $dividend; $this->divisor = $divisor; diff --git a/src/Builder/Expression/ExpOperator.php b/src/Builder/Expression/ExpOperator.php index 78037fb9e..a7a8e886f 100644 --- a/src/Builder/Expression/ExpOperator.php +++ b/src/Builder/Expression/ExpOperator.php @@ -25,13 +25,13 @@ final class ExpOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$exp'; public const PROPERTIES = ['exponent' => 'exponent']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $exponent */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $exponent; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $exponent; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $exponent) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $exponent) { $this->exponent = $exponent; } diff --git a/src/Builder/Expression/FactoryTrait.php b/src/Builder/Expression/FactoryTrait.php index 78f460fa0..26117454c 100644 --- a/src/Builder/Expression/FactoryTrait.php +++ b/src/Builder/Expression/FactoryTrait.php @@ -36,9 +36,9 @@ trait FactoryTrait * Returns the absolute value of a number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $value + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $value */ - public static function abs(Decimal128|Int64|ResolvesToNumber|float|int $value): AbsOperator + public static function abs(Decimal128|Int64|ResolvesToNumber|float|int|string $value): AbsOperator { return new AbsOperator($value); } @@ -47,11 +47,11 @@ public static function abs(Decimal128|Int64|ResolvesToNumber|float|int $value): * Returns the inverse cosine (arc cosine) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/acos/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acos takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $acos returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acos returns values as a double. $acos can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function acos(Decimal128|Int64|ResolvesToNumber|float|int $expression): AcosOperator + public static function acos(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AcosOperator { return new AcosOperator($expression); } @@ -60,11 +60,11 @@ public static function acos(Decimal128|Int64|ResolvesToNumber|float|int $express * Returns the inverse hyperbolic cosine (hyperbolic arc cosine) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/acosh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $acosh takes any valid expression that resolves to a number between 1 and +Infinity, e.g. 1 <= value <= +Infinity. * $acosh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $acosh returns values as a double. $acosh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function acosh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AcoshOperator + public static function acosh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AcoshOperator { return new AcoshOperator($expression); } @@ -74,10 +74,10 @@ public static function acosh(Decimal128|Int64|ResolvesToNumber|float|int $expres * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/ * @no-named-arguments - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */ public static function add( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int ...$expression, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string ...$expression, ): AddOperator { return new AddOperator(...$expression); } @@ -86,10 +86,10 @@ public static function add( * Returns true if no element of a set evaluates to false, otherwise, returns false. Accepts a single argument expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/allElementsTrue/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ public static function allElementsTrue( - PackedArray|ResolvesToArray|BSONArray|array $expression, + PackedArray|ResolvesToArray|BSONArray|array|string $expression, ): AllElementsTrueOperator { return new AllElementsTrueOperator($expression); } @@ -111,10 +111,10 @@ public static function and( * Returns true if any elements of a set evaluate to true; otherwise, returns false. Accepts a single argument expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/anyElementTrue/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ public static function anyElementTrue( - PackedArray|ResolvesToArray|BSONArray|array $expression, + PackedArray|ResolvesToArray|BSONArray|array|string $expression, ): AnyElementTrueOperator { return new AnyElementTrueOperator($expression); } @@ -123,12 +123,12 @@ public static function anyElementTrue( * Returns the element at the specified array index. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayElemAt/ - * @param BSONArray|PackedArray|ResolvesToArray|array $array - * @param ResolvesToInt|int $idx + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array + * @param ResolvesToInt|int|string $idx */ public static function arrayElemAt( - PackedArray|ResolvesToArray|BSONArray|array $array, - ResolvesToInt|int $idx, + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ResolvesToInt|int|string $idx, ): ArrayElemAtOperator { return new ArrayElemAtOperator($array, $idx); } @@ -137,10 +137,11 @@ public static function arrayElemAt( * Converts an array of key value pairs to a document. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/arrayToObject/ - * @param BSONArray|PackedArray|ResolvesToArray|array $array + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array */ - public static function arrayToObject(PackedArray|ResolvesToArray|BSONArray|array $array): ArrayToObjectOperator - { + public static function arrayToObject( + PackedArray|ResolvesToArray|BSONArray|array|string $array, + ): ArrayToObjectOperator { return new ArrayToObjectOperator($array); } @@ -148,11 +149,11 @@ public static function arrayToObject(PackedArray|ResolvesToArray|BSONArray|array * Returns the inverse sin (arc sine) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/asin/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asin takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $asin returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asin returns values as a double. $asin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function asin(Decimal128|Int64|ResolvesToNumber|float|int $expression): AsinOperator + public static function asin(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AsinOperator { return new AsinOperator($expression); } @@ -161,11 +162,11 @@ public static function asin(Decimal128|Int64|ResolvesToNumber|float|int $express * Returns the inverse hyperbolic sine (hyperbolic arc sine) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/asinh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $asinh takes any valid expression that resolves to a number. * $asinh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $asinh returns values as a double. $asinh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function asinh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AsinhOperator + public static function asinh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AsinhOperator { return new AsinhOperator($expression); } @@ -174,11 +175,11 @@ public static function asinh(Decimal128|Int64|ResolvesToNumber|float|int $expres * Returns the inverse tangent (arc tangent) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atan takes any valid expression that resolves to a number. * $atan returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function atan(Decimal128|Int64|ResolvesToNumber|float|int $expression): AtanOperator + public static function atan(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AtanOperator { return new AtanOperator($expression); } @@ -187,14 +188,14 @@ public static function atan(Decimal128|Int64|ResolvesToNumber|float|int $express * Returns the inverse tangent (arc tangent) of y / x in radians, where y and x are the first and second values passed to the expression respectively. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atan2/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $y $atan2 takes any valid expression that resolves to a number. * $atan2 returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atan returns values as a double. $atan2 can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. - * @param Decimal128|Int64|ResolvesToNumber|float|int $x + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $x */ public static function atan2( - Decimal128|Int64|ResolvesToNumber|float|int $y, - Decimal128|Int64|ResolvesToNumber|float|int $x, + Decimal128|Int64|ResolvesToNumber|float|int|string $y, + Decimal128|Int64|ResolvesToNumber|float|int|string $x, ): Atan2Operator { return new Atan2Operator($y, $x); } @@ -203,11 +204,11 @@ public static function atan2( * Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/atanh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $atanh takes any valid expression that resolves to a number between -1 and 1, e.g. -1 <= value <= 1. * $atanh returns values in radians. Use $radiansToDegrees operator to convert the output value from radians to degrees. * By default $atanh returns values as a double. $atanh can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function atanh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AtanhOperator + public static function atanh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): AtanhOperator { return new AtanhOperator($expression); } @@ -218,9 +219,9 @@ public static function atanh(Decimal128|Int64|ResolvesToNumber|float|int $expres * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/ * @no-named-arguments - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression */ - public static function avg(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): AvgOperator + public static function avg(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression): AvgOperator { return new AvgOperator(...$expression); } @@ -243,9 +244,9 @@ public static function binarySize( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitAnd/ * @no-named-arguments - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression */ - public static function bitAnd(Int64|ResolvesToInt|ResolvesToLong|int ...$expression): BitAndOperator + public static function bitAnd(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression): BitAndOperator { return new BitAndOperator(...$expression); } @@ -255,9 +256,9 @@ public static function bitAnd(Int64|ResolvesToInt|ResolvesToLong|int ...$express * New in MongoDB 6.3. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitNot/ - * @param Int64|ResolvesToInt|ResolvesToLong|int $expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $expression */ - public static function bitNot(Int64|ResolvesToInt|ResolvesToLong|int $expression): BitNotOperator + public static function bitNot(Int64|ResolvesToInt|ResolvesToLong|int|string $expression): BitNotOperator { return new BitNotOperator($expression); } @@ -268,9 +269,9 @@ public static function bitNot(Int64|ResolvesToInt|ResolvesToLong|int $expression * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitOr/ * @no-named-arguments - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression */ - public static function bitOr(Int64|ResolvesToInt|ResolvesToLong|int ...$expression): BitOrOperator + public static function bitOr(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression): BitOrOperator { return new BitOrOperator(...$expression); } @@ -281,9 +282,9 @@ public static function bitOr(Int64|ResolvesToInt|ResolvesToLong|int ...$expressi * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bitXor/ * @no-named-arguments - * @param Int64|ResolvesToInt|ResolvesToLong|int ...$expression + * @param Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression */ - public static function bitXor(Int64|ResolvesToInt|ResolvesToLong|int ...$expression): BitXorOperator + public static function bitXor(Int64|ResolvesToInt|ResolvesToLong|int|string ...$expression): BitXorOperator { return new BitXorOperator(...$expression); } @@ -292,10 +293,10 @@ public static function bitXor(Int64|ResolvesToInt|ResolvesToLong|int ...$express * Returns the size in bytes of a given document (i.e. BSON type Object) when encoded as BSON. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bsonSize/ - * @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass $object + * @param Document|ResolvesToNull|ResolvesToObject|Serializable|array|null|stdClass|string $object */ public static function bsonSize( - Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null $object, + Document|Serializable|ResolvesToNull|ResolvesToObject|stdClass|array|null|string $object, ): BsonSizeOperator { return new BsonSizeOperator($object); } @@ -304,11 +305,11 @@ public static function bsonSize( * Represents a single case in a $switch expression * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/ - * @param ResolvesToBool|bool $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. + * @param ResolvesToBool|bool|string $case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then Can be any valid expression. */ public static function case( - ResolvesToBool|bool $case, + ResolvesToBool|bool|string $case, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, ): CaseOperator { return new CaseOperator($case, $then); @@ -318,9 +319,9 @@ public static function case( * Returns the smallest integer greater than or equal to the specified number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ceil/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression If the argument resolves to a value of null or refers to a field that is missing, $ceil returns null. If the argument resolves to NaN, $ceil returns NaN. */ - public static function ceil(Decimal128|Int64|ResolvesToNumber|float|int $expression): CeilOperator + public static function ceil(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): CeilOperator { return new CeilOperator($expression); } @@ -356,10 +357,11 @@ public static function concat(ResolvesToString|string ...$expression): ConcatOpe * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/concatArrays/ * @no-named-arguments - * @param BSONArray|PackedArray|ResolvesToArray|array ...$array + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$array */ - public static function concatArrays(PackedArray|ResolvesToArray|BSONArray|array ...$array): ConcatArraysOperator - { + public static function concatArrays( + PackedArray|ResolvesToArray|BSONArray|array|string ...$array, + ): ConcatArraysOperator { return new ConcatArraysOperator(...$array); } @@ -367,12 +369,12 @@ public static function concatArrays(PackedArray|ResolvesToArray|BSONArray|array * A ternary operator that evaluates one expression, and depending on the result, returns the value of one of the other two expressions. Accepts either three expressions in an ordered list or three named parameters. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/ - * @param ResolvesToBool|bool $if + * @param ResolvesToBool|bool|string $if * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $then * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $else */ public static function cond( - ResolvesToBool|bool $if, + ResolvesToBool|bool|string $if, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else, ): CondOperator { @@ -404,10 +406,10 @@ public static function convert( * Returns the cosine of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cos/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cos takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $cos returns values as a double. $cos can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ - public static function cos(Decimal128|Int64|ResolvesToNumber|float|int $expression): CosOperator + public static function cos(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): CosOperator { return new CosOperator($expression); } @@ -416,10 +418,10 @@ public static function cos(Decimal128|Int64|ResolvesToNumber|float|int $expressi * Returns the hyperbolic cosine of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cosh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $cosh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $cosh returns values as a double. $cosh can also return values as a 128-bit decimal if the resolves to a 128-bit decimal value. */ - public static function cosh(Decimal128|Int64|ResolvesToNumber|float|int $expression): CoshOperator + public static function cosh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): CoshOperator { return new CoshOperator($expression); } @@ -428,15 +430,15 @@ public static function cosh(Decimal128|Int64|ResolvesToNumber|float|int $express * Adds a number of time units to a date object. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateAdd/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. - * @param Int64|ResolvesToInt|ResolvesToLong|int $amount + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dateAdd( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, ResolvesToString|TimeUnit|string $unit, - Int64|ResolvesToInt|ResolvesToLong|int $amount, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DateAddOperator { return new DateAddOperator($startDate, $unit, $amount, $timezone); @@ -446,15 +448,15 @@ public static function dateAdd( * Returns the difference between two dates. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateDiff/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The start of the time period. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $endDate The end of the time period. The endDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The time measurement unit between the startDate and endDate * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. * @param Optional|ResolvesToString|string $startOfWeek Used when the unit is equal to week. Defaults to Sunday. The startOfWeek parameter is an expression that resolves to a case insensitive string */ public static function dateDiff( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $endDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $endDate, ResolvesToString|TimeUnit|string $unit, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|ResolvesToString|string $startOfWeek = Optional::Undefined, @@ -466,29 +468,29 @@ public static function dateDiff( * Constructs a BSON Date object given the date's constituent parts. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateFromParts/ - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $month Month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $day Day of month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour Hour. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute Minute. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $second Second. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year Calendar year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month Month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek Week of year. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day Day of month. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour Hour. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute Minute. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second Second. Defaults to 0. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond Millisecond. Defaults to 0. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dateFromParts( - Optional|Decimal128|Int64|ResolvesToNumber|float|int $year = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $month = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $day = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $second = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $year = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeekYear = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $month = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $day = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $isoDayOfWeek = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $hour = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $minute = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $second = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $millisecond = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DateFromPartsOperator { return new DateFromPartsOperator($year, $isoWeekYear, $month, $isoWeek, $day, $isoDayOfWeek, $hour, $minute, $second, $millisecond, $timezone); @@ -521,15 +523,15 @@ public static function dateFromString( * Subtracts a number of time units from a date object. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateSubtract/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $startDate The beginning date, in UTC, for the addition operation. The startDate can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit used to measure the amount of time added to the startDate. - * @param Int64|ResolvesToInt|ResolvesToLong|int $amount + * @param Int64|ResolvesToInt|ResolvesToLong|int|string $amount * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dateSubtract( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $startDate, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $startDate, ResolvesToString|TimeUnit|string $unit, - Int64|ResolvesToInt|ResolvesToLong|int $amount, + Int64|ResolvesToInt|ResolvesToLong|int|string $amount, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DateSubtractOperator { return new DateSubtractOperator($startDate, $unit, $amount, $timezone); @@ -539,14 +541,14 @@ public static function dateSubtract( * Returns a document containing the constituent parts of a date. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToParts/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The input date for which to return parts. date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. - * @param Optional|bool $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. + * @param Optional|bool|string $iso8601 If set to true, modifies the output document to use ISO week date fields. Defaults to false. */ public static function dateToParts( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|bool $iso8601 = Optional::Undefined, + Optional|bool|string $iso8601 = Optional::Undefined, ): DateToPartsOperator { return new DateToPartsOperator($date, $timezone, $iso8601); } @@ -555,7 +557,7 @@ public static function dateToParts( * Returns the date as a formatted string. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateToString/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to convert to string. Must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $format The date format specification of the dateString. The format can be any expression that evaluates to a string literal, containing 0 or more format specifiers. * If unspecified, $dateFromString uses "%Y-%m-%dT%H:%M:%S.%LZ" as the default format but accepts a variety of formats and attempts to parse the dateString if possible. * @param Optional|ResolvesToString|string $timezone The time zone to use to format the date. @@ -563,7 +565,7 @@ public static function dateToParts( * If unspecified, $dateToString returns null if the date is null or missing. */ public static function dateToString( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, @@ -575,19 +577,19 @@ public static function dateToString( * Truncates a date. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dateTrunc/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to truncate, specified in UTC. The date can be any expression that resolves to a Date, a Timestamp, or an ObjectID. * @param ResolvesToString|TimeUnit|string $unit The unit of time, specified as an expression that must resolve to one of these strings: year, quarter, week, month, day, hour, minute, second. * Together, binSize and unit specify the time period used in the $dateTrunc calculation. - * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. + * @param Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize The numeric time value, specified as an expression that must resolve to a positive non-zero number. Defaults to 1. * Together, binSize and unit specify the time period used in the $dateTrunc calculation. * @param Optional|ResolvesToString|string $timezone The timezone to carry out the operation. $timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. * @param Optional|string $startOfWeek The start of the week. Used when * unit is week. Defaults to Sunday. */ public static function dateTrunc( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, ResolvesToString|TimeUnit|string $unit, - Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int|string $binSize = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|string $startOfWeek = Optional::Undefined, ): DateTruncOperator { @@ -598,11 +600,11 @@ public static function dateTrunc( * Returns the day of the month for a date as a number between 1 and 31. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfMonth/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dayOfMonth( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DayOfMonthOperator { return new DayOfMonthOperator($date, $timezone); @@ -612,11 +614,11 @@ public static function dayOfMonth( * Returns the day of the week for a date as a number between 1 (Sunday) and 7 (Saturday). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfWeek/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dayOfWeek( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DayOfWeekOperator { return new DayOfWeekOperator($date, $timezone); @@ -626,11 +628,11 @@ public static function dayOfWeek( * Returns the day of the year for a date as a number between 1 and 366 (leap year). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/dayOfYear/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function dayOfYear( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): DayOfYearOperator { return new DayOfYearOperator($date, $timezone); @@ -640,11 +642,11 @@ public static function dayOfYear( * Converts a value from degrees to radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/degreesToRadians/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $degreesToRadians takes any valid expression that resolves to a number. * By default $degreesToRadians returns values as a double. $degreesToRadians can also return values as a 128-bit decimal as long as the resolves to a 128-bit decimal value. */ public static function degreesToRadians( - Decimal128|Int64|ResolvesToNumber|float|int $expression, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, ): DegreesToRadiansOperator { return new DegreesToRadiansOperator($expression); } @@ -653,12 +655,12 @@ public static function degreesToRadians( * Returns the result of dividing the first number by the second. Accepts two argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/divide/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. - * @param Decimal128|Int64|ResolvesToNumber|float|int $divisor + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. the first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ public static function divide( - Decimal128|Int64|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, ): DivideOperator { return new DivideOperator($dividend, $divisor); } @@ -681,9 +683,9 @@ public static function eq( * Raises e to the specified exponent. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/exp/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ - public static function exp(Decimal128|Int64|ResolvesToNumber|float|int $exponent): ExpOperator + public static function exp(Decimal128|Int64|ResolvesToNumber|float|int|string $exponent): ExpOperator { return new ExpOperator($exponent); } @@ -692,17 +694,17 @@ public static function exp(Decimal128|Int64|ResolvesToNumber|float|int $exponent * Selects a subset of the array to return an array with only the elements that match the filter condition. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/filter/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input - * @param ResolvesToBool|bool $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input + * @param ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. * @param Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. - * @param Optional|ResolvesToInt|int $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * @param Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. */ public static function filter( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToBool|bool $cond, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToBool|bool|string $cond, Optional|string $as = Optional::Undefined, - Optional|ResolvesToInt|int $limit = Optional::Undefined, + Optional|ResolvesToInt|int|string $limit = Optional::Undefined, ): FilterOperator { return new FilterOperator($input, $cond, $as, $limit); } @@ -711,9 +713,9 @@ public static function filter( * Returns the result of an expression for the first document in an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public static function first(PackedArray|ResolvesToArray|BSONArray|array $expression): FirstOperator + public static function first(PackedArray|ResolvesToArray|BSONArray|array|string $expression): FirstOperator { return new FirstOperator($expression); } @@ -722,12 +724,12 @@ public static function first(PackedArray|ResolvesToArray|BSONArray|array $expres * Returns a specified number of elements from the beginning of an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/firstN-array-element/ - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ public static function firstN( - ResolvesToInt|int $n, - PackedArray|ResolvesToArray|BSONArray|array $input, + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, ): FirstNOperator { return new FirstNOperator($n, $input); } @@ -736,9 +738,9 @@ public static function firstN( * Returns the largest integer less than or equal to the specified number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/floor/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public static function floor(Decimal128|Int64|ResolvesToNumber|float|int $expression): FloorOperator + public static function floor(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): FloorOperator { return new FloorOperator($expression); } @@ -750,12 +752,12 @@ public static function floor(Decimal128|Int64|ResolvesToNumber|float|int $expres * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/function/ * @param Javascript|string $body The function definition. You can specify the function definition as either BSON\JavaScript or string. * function(arg1, arg2, ...) { ... } - * @param BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. + * @param BSONArray|PackedArray|array|string $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. * @param string $lang */ public static function function( Javascript|string $body, - PackedArray|BSONArray|array $args = [], + PackedArray|BSONArray|array|string $args = [], string $lang = 'js', ): FunctionOperator { return new FunctionOperator($body, $args, $lang); @@ -810,11 +812,11 @@ public static function gte( * Returns the hour for a date as a number between 0 and 23. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/hour/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function hour( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): HourOperator { return new HourOperator($date, $timezone); @@ -838,11 +840,11 @@ public static function ifNull( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. - * @param BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. */ public static function in( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, - PackedArray|ResolvesToArray|BSONArray|array $array, + PackedArray|ResolvesToArray|BSONArray|array|string $array, ): InOperator { return new InOperator($expression, $array); } @@ -851,20 +853,20 @@ public static function in( * Searches an array for an occurrence of a specified value and returns the array index of the first occurrence. Array indexes start at zero. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexOfArray/ - * @param BSONArray|PackedArray|ResolvesToArray|array $array Can be any valid expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public static function indexOfArray( - PackedArray|ResolvesToArray|BSONArray|array $array, + PackedArray|ResolvesToArray|BSONArray|array|string $array, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ): IndexOfArrayOperator { return new IndexOfArrayOperator($array, $search, $start, $end); } @@ -877,16 +879,16 @@ public static function indexOfArray( * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public static function indexOfBytes( ResolvesToString|string $string, ResolvesToString|string $substring, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ): IndexOfBytesOperator { return new IndexOfBytesOperator($string, $substring, $start, $end); } @@ -899,16 +901,16 @@ public static function indexOfBytes( * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public static function indexOfCP( ResolvesToString|string $string, ResolvesToString|string $substring, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ): IndexOfCPOperator { return new IndexOfCPOperator($string, $substring, $start, $end); } @@ -943,11 +945,11 @@ public static function isNumber( * Returns the weekday number in ISO 8601 format, ranging from 1 (for Monday) to 7 (for Sunday). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoDayOfWeek/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function isoDayOfWeek( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): IsoDayOfWeekOperator { return new IsoDayOfWeekOperator($date, $timezone); @@ -957,11 +959,11 @@ public static function isoDayOfWeek( * Returns the week number in ISO 8601 format, ranging from 1 to 53. Week numbers start at 1 with the week (Monday through Sunday) that contains the year's first Thursday. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeek/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function isoWeek( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): IsoWeekOperator { return new IsoWeekOperator($date, $timezone); @@ -971,11 +973,11 @@ public static function isoWeek( * Returns the year number in ISO 8601 format. The year starts with the Monday of week 1 (ISO 8601) and ends with the Sunday of the last week (ISO 8601). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isoWeekYear/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function isoWeekYear( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): IsoWeekYearOperator { return new IsoWeekYearOperator($date, $timezone); @@ -985,9 +987,9 @@ public static function isoWeekYear( * Returns the result of an expression for the last document in an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public static function last(PackedArray|ResolvesToArray|BSONArray|array $expression): LastOperator + public static function last(PackedArray|ResolvesToArray|BSONArray|array|string $expression): LastOperator { return new LastOperator($expression); } @@ -996,12 +998,12 @@ public static function last(PackedArray|ResolvesToArray|BSONArray|array $express * Returns a specified number of elements from the end of an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lastN-array-element/ - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ public static function lastN( - ResolvesToInt|int $n, - PackedArray|ResolvesToArray|BSONArray|array $input, + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, ): LastNOperator { return new LastNOperator($n, $input); } @@ -1011,12 +1013,12 @@ public static function lastN( * Accepts any number of argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/let/ - * @param Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * @param Document|Serializable|array|stdClass|string $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. * The variable assignments have no meaning outside the in expression, not even within the vars block itself. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. */ public static function let( - Document|Serializable|stdClass|array $vars, + Document|Serializable|stdClass|array|string $vars, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ): LetOperator { return new LetOperator($vars, $in); @@ -1038,9 +1040,9 @@ public static function literal(Type|stdClass|array|bool|float|int|null|string $v * $ln is equivalent to $log: [ , Math.E ] expression, where Math.E is a JavaScript representation for Euler's number e. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ln/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. */ - public static function ln(Decimal128|Int64|ResolvesToNumber|float|int $number): LnOperator + public static function ln(Decimal128|Int64|ResolvesToNumber|float|int|string $number): LnOperator { return new LnOperator($number); } @@ -1049,12 +1051,12 @@ public static function ln(Decimal128|Int64|ResolvesToNumber|float|int $number): * Calculates the log of a number in the specified base. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. - * @param Decimal128|Int64|ResolvesToNumber|float|int $base Any valid expression as long as it resolves to a positive number greater than 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. */ public static function log( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToNumber|float|int $base, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $base, ): LogOperator { return new LogOperator($number, $base); } @@ -1063,9 +1065,9 @@ public static function log( * Calculates the log base 10 of a number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/log10/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ - public static function log10(Decimal128|Int64|ResolvesToNumber|float|int $number): Log10Operator + public static function log10(Decimal128|Int64|ResolvesToNumber|float|int|string $number): Log10Operator { return new Log10Operator($number); } @@ -1119,12 +1121,12 @@ public static function ltrim( * Applies a subexpression to each element of an array and returns the array of resulting values in order. Accepts named parameters. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/map/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. * @param Optional|ResolvesToString|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. */ public static function map( - PackedArray|ResolvesToArray|BSONArray|array $input, + PackedArray|ResolvesToArray|BSONArray|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, Optional|ResolvesToString|string $as = Optional::Undefined, ): MapOperator { @@ -1149,12 +1151,12 @@ public static function max( * Returns the n largest values in an array. Distinct from the $maxN accumulator. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/maxN-array-element/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ public static function maxN( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToInt|int $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, ): MaxNOperator { return new MaxNOperator($input, $n); } @@ -1168,11 +1170,11 @@ public static function maxN( * It is also available as an aggregation expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/median/ - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public static function median( - Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input, + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, string $method, ): MedianOperator { return new MedianOperator($input, $method); @@ -1183,10 +1185,10 @@ public static function median( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mergeObjects/ * @no-named-arguments - * @param Document|ResolvesToObject|Serializable|array|stdClass ...$document Any valid expression that resolves to a document. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string ...$document Any valid expression that resolves to a document. */ public static function mergeObjects( - Document|Serializable|ResolvesToObject|stdClass|array ...$document, + Document|Serializable|ResolvesToObject|stdClass|array|string ...$document, ): MergeObjectsOperator { return new MergeObjectsOperator(...$document); } @@ -1206,11 +1208,11 @@ public static function meta(string $keyword): MetaOperator * Returns the milliseconds of a date as a number between 0 and 999. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/millisecond/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function millisecond( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): MillisecondOperator { return new MillisecondOperator($date, $timezone); @@ -1234,12 +1236,12 @@ public static function min( * Returns the n smallest values in an array. Distinct from the $minN accumulator. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minN-array-element/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ public static function minN( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToInt|int $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, ): MinNOperator { return new MinNOperator($input, $n); } @@ -1248,11 +1250,11 @@ public static function minN( * Returns the minute for a date as a number between 0 and 59. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/minute/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function minute( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): MinuteOperator { return new MinuteOperator($date, $timezone); @@ -1262,12 +1264,12 @@ public static function minute( * Returns the remainder of the first number divided by the second. Accepts two argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/mod/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. - * @param Decimal128|Int64|ResolvesToNumber|float|int $divisor + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ public static function mod( - Decimal128|Int64|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, ): ModOperator { return new ModOperator($dividend, $divisor); } @@ -1276,11 +1278,11 @@ public static function mod( * Returns the month for a date as a number between 1 (January) and 12 (December). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/month/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function month( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): MonthOperator { return new MonthOperator($date, $timezone); @@ -1291,11 +1293,12 @@ public static function month( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/ * @no-named-arguments - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to numbers. * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. */ - public static function multiply(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): MultiplyOperator - { + public static function multiply( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): MultiplyOperator { return new MultiplyOperator(...$expression); } @@ -1329,10 +1332,10 @@ public static function not( * Converts a document to an array of documents representing key-value pairs. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/objectToArray/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. */ public static function objectToArray( - Document|Serializable|ResolvesToObject|stdClass|array $object, + Document|Serializable|ResolvesToObject|stdClass|array|string $object, ): ObjectToArrayOperator { return new ObjectToArrayOperator($object); } @@ -1362,14 +1365,14 @@ public static function or( * It is also available as an aggregation expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/ - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. - * @param BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public static function percentile( - Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input, - PackedArray|ResolvesToArray|BSONArray|array $p, + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, string $method, ): PercentileOperator { return new PercentileOperator($input, $p, $method); @@ -1379,12 +1382,12 @@ public static function percentile( * Raises a number to the specified exponent. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/pow/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number - * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ public static function pow( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToNumber|float|int $exponent, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $exponent, ): PowOperator { return new PowOperator($number, $exponent); } @@ -1393,10 +1396,10 @@ public static function pow( * Converts a value from radians to degrees. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/radiansToDegrees/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ public static function radiansToDegrees( - Decimal128|Int64|ResolvesToNumber|float|int $expression, + Decimal128|Int64|ResolvesToNumber|float|int|string $expression, ): RadiansToDegreesOperator { return new RadiansToDegreesOperator($expression); } @@ -1415,14 +1418,14 @@ public static function rand(): RandOperator * Outputs an array containing a sequence of integers according to user-defined inputs. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/range/ - * @param ResolvesToInt|int $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. - * @param ResolvesToInt|int $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. - * @param Optional|ResolvesToInt|int $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. + * @param ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. + * @param ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. + * @param Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. */ public static function range( - ResolvesToInt|int $start, - ResolvesToInt|int $end, - Optional|ResolvesToInt|int $step = Optional::Undefined, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $end, + Optional|ResolvesToInt|int|string $step = Optional::Undefined, ): RangeOperator { return new RangeOperator($start, $end, $step); } @@ -1431,7 +1434,7 @@ public static function range( * Applies an expression to each element in an array and combines them into a single value. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/reduce/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input Can be any valid expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. @@ -1441,7 +1444,7 @@ public static function range( * - this is the variable that refers to the element being processed. */ public static function reduce( - PackedArray|ResolvesToArray|BSONArray|array $input, + PackedArray|ResolvesToArray|BSONArray|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ): ReduceOperator { @@ -1538,10 +1541,11 @@ public static function replaceOne( * Returns an array with the elements in reverse order. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/reverseArray/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression The argument can be any valid expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. */ - public static function reverseArray(PackedArray|ResolvesToArray|BSONArray|array $expression): ReverseArrayOperator - { + public static function reverseArray( + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ): ReverseArrayOperator { return new ReverseArrayOperator($expression); } @@ -1549,13 +1553,13 @@ public static function reverseArray(PackedArray|ResolvesToArray|BSONArray|array * Rounds a number to a whole integer or to a specified decimal place. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/round/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $round returns an error if the expression resolves to a non-numeric data type. - * @param Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. */ public static function round( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Optional|ResolvesToInt|int $place = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, ): RoundOperator { return new RoundOperator($number, $place); } @@ -1580,11 +1584,11 @@ public static function rtrim( * Returns the seconds for a date as a number between 0 and 60 (leap seconds). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/second/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function second( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): SecondOperator { return new SecondOperator($date, $timezone); @@ -1594,12 +1598,12 @@ public static function second( * Returns a set with elements that appear in the first set but not in the second set; i.e. performs a relative complement of the second set relative to the first. Accepts exactly two argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setDifference/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression1 The arguments can be any valid expression as long as they each resolve to an array. - * @param BSONArray|PackedArray|ResolvesToArray|array $expression2 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. */ public static function setDifference( - PackedArray|ResolvesToArray|BSONArray|array $expression1, - PackedArray|ResolvesToArray|BSONArray|array $expression2, + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, ): SetDifferenceOperator { return new SetDifferenceOperator($expression1, $expression2); } @@ -1609,10 +1613,11 @@ public static function setDifference( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setEquals/ * @no-named-arguments - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression */ - public static function setEquals(PackedArray|ResolvesToArray|BSONArray|array ...$expression): SetEqualsOperator - { + public static function setEquals( + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, + ): SetEqualsOperator { return new SetEqualsOperator(...$expression); } @@ -1622,13 +1627,13 @@ public static function setEquals(PackedArray|ResolvesToArray|BSONArray|array ... * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/ * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. - * @param Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. * Set to $$REMOVE to remove field from the input document. */ public static function setField( ResolvesToString|string $field, - Document|Serializable|ResolvesToObject|stdClass|array $input, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, ): SetFieldOperator { return new SetFieldOperator($field, $input, $value); @@ -1639,10 +1644,10 @@ public static function setField( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIntersection/ * @no-named-arguments - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression */ public static function setIntersection( - PackedArray|ResolvesToArray|BSONArray|array ...$expression, + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, ): SetIntersectionOperator { return new SetIntersectionOperator(...$expression); } @@ -1651,12 +1656,12 @@ public static function setIntersection( * Returns true if all elements of the first set appear in the second set, including when the first set equals the second set; i.e. not a strict subset. Accepts exactly two argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setIsSubset/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression1 - * @param BSONArray|PackedArray|ResolvesToArray|array $expression2 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 */ public static function setIsSubset( - PackedArray|ResolvesToArray|BSONArray|array $expression1, - PackedArray|ResolvesToArray|BSONArray|array $expression2, + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, ): SetIsSubsetOperator { return new SetIsSubsetOperator($expression1, $expression2); } @@ -1666,10 +1671,11 @@ public static function setIsSubset( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setUnion/ * @no-named-arguments - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression */ - public static function setUnion(PackedArray|ResolvesToArray|BSONArray|array ...$expression): SetUnionOperator - { + public static function setUnion( + PackedArray|ResolvesToArray|BSONArray|array|string ...$expression, + ): SetUnionOperator { return new SetUnionOperator(...$expression); } @@ -1677,10 +1683,10 @@ public static function setUnion(PackedArray|ResolvesToArray|BSONArray|array ...$ * Returns the sine of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sin/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function sin(Decimal128|Int64|ResolvesToNumber|float|int $expression): SinOperator + public static function sin(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SinOperator { return new SinOperator($expression); } @@ -1689,10 +1695,10 @@ public static function sin(Decimal128|Int64|ResolvesToNumber|float|int $expressi * Returns the hyperbolic sine of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sinh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public static function sinh(Decimal128|Int64|ResolvesToNumber|float|int $expression): SinhOperator + public static function sinh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): SinhOperator { return new SinhOperator($expression); } @@ -1701,9 +1707,9 @@ public static function sinh(Decimal128|Int64|ResolvesToNumber|float|int $express * Returns the number of elements in the array. Accepts a single expression as argument. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/size/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression The argument for $size can be any expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. */ - public static function size(PackedArray|ResolvesToArray|BSONArray|array $expression): SizeOperator + public static function size(PackedArray|ResolvesToArray|BSONArray|array|string $expression): SizeOperator { return new SizeOperator($expression); } @@ -1712,18 +1718,18 @@ public static function size(PackedArray|ResolvesToArray|BSONArray|array $express * Returns a subset of an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/slice/ - * @param BSONArray|PackedArray|ResolvesToArray|array $expression Any valid expression as long as it resolves to an array. - * @param ResolvesToInt|int $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. + * @param ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. - * @param Optional|ResolvesToInt|int $position Any valid expression as long as it resolves to an integer. + * @param Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. */ public static function slice( - PackedArray|ResolvesToArray|BSONArray|array $expression, - ResolvesToInt|int $n, - Optional|ResolvesToInt|int $position = Optional::Undefined, + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ResolvesToInt|int|string $n, + Optional|ResolvesToInt|int|string $position = Optional::Undefined, ): SliceOperator { return new SliceOperator($expression, $n, $position); } @@ -1732,14 +1738,14 @@ public static function slice( * Sorts the elements of an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortArray/ - * @param BSONArray|PackedArray|ResolvesToArray|array $input The array to be sorted. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined * If the expression evaluates to any other non-array value, the document returns an error. - * @param Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. + * @param Document|Serializable|Sort|array|int|stdClass|string $sortBy The document specifies a sort ordering. */ public static function sortArray( - PackedArray|ResolvesToArray|BSONArray|array $input, - Document|Serializable|Sort|stdClass|array|int $sortBy, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + Document|Serializable|Sort|stdClass|array|int|string $sortBy, ): SortArrayOperator { return new SortArrayOperator($input, $sortBy); } @@ -1760,9 +1766,9 @@ public static function split(ResolvesToString|string $string, ResolvesToString|s * Calculates the square root. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sqrt/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number The argument can be any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public static function sqrt(Decimal128|Int64|ResolvesToNumber|float|int $number): SqrtOperator + public static function sqrt(Decimal128|Int64|ResolvesToNumber|float|int|string $number): SqrtOperator { return new SqrtOperator($number); } @@ -1774,10 +1780,11 @@ public static function sqrt(Decimal128|Int64|ResolvesToNumber|float|int $number) * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/ * @no-named-arguments - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression */ - public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): StdDevPopOperator - { + public static function stdDevPop( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): StdDevPopOperator { return new StdDevPopOperator(...$expression); } @@ -1787,10 +1794,11 @@ public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int ... * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/ * @no-named-arguments - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression */ - public static function stdDevSamp(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): StdDevSampOperator - { + public static function stdDevSamp( + Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression, + ): StdDevSampOperator { return new StdDevSampOperator(...$expression); } @@ -1835,13 +1843,13 @@ public static function strLenCP(ResolvesToString|string $expression): StrLenCPOp * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substr/ * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ public static function substr( ResolvesToString|string $string, - ResolvesToInt|int $start, - ResolvesToInt|int $length, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, ): SubstrOperator { return new SubstrOperator($string, $start, $length); } @@ -1851,13 +1859,13 @@ public static function substr( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrBytes/ * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ public static function substrBytes( ResolvesToString|string $string, - ResolvesToInt|int $start, - ResolvesToInt|int $length, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, ): SubstrBytesOperator { return new SubstrBytesOperator($string, $start, $length); } @@ -1867,13 +1875,13 @@ public static function substrBytes( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/substrCP/ * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ public static function substrCP( ResolvesToString|string $string, - ResolvesToInt|int $start, - ResolvesToInt|int $length, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, ): SubstrCPOperator { return new SubstrCPOperator($string, $start, $length); } @@ -1882,12 +1890,12 @@ public static function substrCP( * Returns the result of subtracting the second value from the first. If the two values are numbers, return the difference. If the two values are dates, return the difference in milliseconds. If the two values are a date and a number in milliseconds, return the resulting date. Accepts two argument expressions. If the two values are a date and a number, specify the date argument first as it is not meaningful to subtract a date from a number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/subtract/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 */ public static function subtract( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2, ): SubtractOperator { return new SubtractOperator($expression1, $expression2); } @@ -1898,10 +1906,10 @@ public static function subtract( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/ * @no-named-arguments - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int ...$expression + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int|string ...$expression */ public static function sum( - Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int ...$expression, + Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int|string ...$expression, ): SumOperator { return new SumOperator(...$expression); } @@ -1910,7 +1918,7 @@ public static function sum( * Evaluates a series of case expressions. When it finds an expression which evaluates to true, $switch executes a specified expression and breaks out of the control flow. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/switch/ - * @param BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * @param BSONArray|PackedArray|array|string $branches An array of control branch documents. Each branch is a document with the following fields: * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. * - then Can be any valid expression. * The branches array must contain at least one branch document. @@ -1918,7 +1926,7 @@ public static function sum( * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. */ public static function switch( - PackedArray|BSONArray|array $branches, + PackedArray|BSONArray|array|string $branches, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, ): SwitchOperator { return new SwitchOperator($branches, $default); @@ -1928,10 +1936,10 @@ public static function switch( * Returns the tangent of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tan/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public static function tan(Decimal128|Int64|ResolvesToNumber|float|int $expression): TanOperator + public static function tan(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): TanOperator { return new TanOperator($expression); } @@ -1940,10 +1948,10 @@ public static function tan(Decimal128|Int64|ResolvesToNumber|float|int $expressi * Returns the hyperbolic tangent of a value that is measured in radians. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tanh/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public static function tanh(Decimal128|Int64|ResolvesToNumber|float|int $expression): TanhOperator + public static function tanh(Decimal128|Int64|ResolvesToNumber|float|int|string $expression): TanhOperator { return new TanhOperator($expression); } @@ -2107,13 +2115,13 @@ public static function trim( * Truncates a number to a whole integer or to a specified decimal place. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/trunc/ - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $trunc returns an error if the expression resolves to a non-numeric data type. - * @param Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. */ public static function trunc( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Optional|ResolvesToInt|int $place = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, ): TruncOperator { return new TruncOperator($number, $place); } @@ -2123,9 +2131,9 @@ public static function trunc( * New in MongoDB 5.1. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsIncrement/ - * @param ResolvesToTimestamp|Timestamp|int $expression + * @param ResolvesToTimestamp|Timestamp|int|string $expression */ - public static function tsIncrement(Timestamp|ResolvesToTimestamp|int $expression): TsIncrementOperator + public static function tsIncrement(Timestamp|ResolvesToTimestamp|int|string $expression): TsIncrementOperator { return new TsIncrementOperator($expression); } @@ -2135,9 +2143,9 @@ public static function tsIncrement(Timestamp|ResolvesToTimestamp|int $expression * New in MongoDB 5.1. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/tsSecond/ - * @param ResolvesToTimestamp|Timestamp|int $expression + * @param ResolvesToTimestamp|Timestamp|int|string $expression */ - public static function tsSecond(Timestamp|ResolvesToTimestamp|int $expression): TsSecondOperator + public static function tsSecond(Timestamp|ResolvesToTimestamp|int|string $expression): TsSecondOperator { return new TsSecondOperator($expression); } @@ -2160,11 +2168,11 @@ public static function type( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unsetField/ * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. - * @param Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ public static function unsetField( ResolvesToString|string $field, - Document|Serializable|ResolvesToObject|stdClass|array $input, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, ): UnsetFieldOperator { return new UnsetFieldOperator($field, $input); } @@ -2173,11 +2181,11 @@ public static function unsetField( * Returns the week number for a date as a number between 0 (the partial week that precedes the first Sunday of the year) and 53 (leap year). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/week/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function week( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): WeekOperator { return new WeekOperator($date, $timezone); @@ -2187,11 +2195,11 @@ public static function week( * Returns the year for a date as a number (e.g. 2014). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/year/ - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public static function year( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ): YearOperator { return new YearOperator($date, $timezone); @@ -2201,19 +2209,19 @@ public static function year( * Merge two arrays together. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/zip/ - * @param BSONArray|PackedArray|ResolvesToArray|array $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. - * @param Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * @param Optional|bool|string $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. * The default value is false: the shortest array length determines the number of arrays in the output array. - * @param Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * @param Optional|BSONArray|PackedArray|array|string $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. */ public static function zip( - PackedArray|ResolvesToArray|BSONArray|array $inputs, - Optional|bool $useLongestLength = Optional::Undefined, - Optional|PackedArray|BSONArray|array $defaults = Optional::Undefined, + PackedArray|ResolvesToArray|BSONArray|array|string $inputs, + Optional|bool|string $useLongestLength = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $defaults = Optional::Undefined, ): ZipOperator { return new ZipOperator($inputs, $useLongestLength, $defaults); } diff --git a/src/Builder/Expression/FilterOperator.php b/src/Builder/Expression/FilterOperator.php index 9bd522572..ad8e2798b 100644 --- a/src/Builder/Expression/FilterOperator.php +++ b/src/Builder/Expression/FilterOperator.php @@ -30,33 +30,33 @@ final class FilterOperator implements ResolvesToArray, OperatorInterface public const NAME = '$filter'; public const PROPERTIES = ['input' => 'input', 'cond' => 'cond', 'as' => 'as', 'limit' => 'limit']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToBool|bool $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. */ - public readonly ResolvesToBool|bool $cond; + /** @var ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. */ + public readonly ResolvesToBool|bool|string $cond; /** @var Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. */ public readonly Optional|string $as; /** - * @var Optional|ResolvesToInt|int $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * @var Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. */ - public readonly Optional|ResolvesToInt|int $limit; + public readonly Optional|ResolvesToInt|int|string $limit; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input - * @param ResolvesToBool|bool $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input + * @param ResolvesToBool|bool|string $cond An expression that resolves to a boolean value used to determine if an element should be included in the output array. The expression references each element of the input array individually with the variable name specified in as. * @param Optional|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. - * @param Optional|ResolvesToInt|int $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. + * @param Optional|ResolvesToInt|int|string $limit A number expression that restricts the number of matching array elements that $filter returns. You cannot specify a limit less than 1. The matching array elements are returned in the order they appear in the input array. * If the specified limit is greater than the number of matching array elements, $filter returns all matching array elements. If the limit is null, $filter returns all matching array elements. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $input, - ResolvesToBool|bool $cond, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToBool|bool|string $cond, Optional|string $as = Optional::Undefined, - Optional|ResolvesToInt|int $limit = Optional::Undefined, + Optional|ResolvesToInt|int|string $limit = Optional::Undefined, ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/FirstNOperator.php b/src/Builder/Expression/FirstNOperator.php index 769c38118..718d49243 100644 --- a/src/Builder/Expression/FirstNOperator.php +++ b/src/Builder/Expression/FirstNOperator.php @@ -29,18 +29,20 @@ final class FirstNOperator implements ResolvesToArray, OperatorInterface public const NAME = '$firstN'; public const PROPERTIES = ['n' => 'n', 'input' => 'input']; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; /** - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ - public function __construct(ResolvesToInt|int $n, PackedArray|ResolvesToArray|BSONArray|array $input) - { + public function __construct( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ) { $this->n = $n; if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/FirstOperator.php b/src/Builder/Expression/FirstOperator.php index 994de7bee..a8ddd4d58 100644 --- a/src/Builder/Expression/FirstOperator.php +++ b/src/Builder/Expression/FirstOperator.php @@ -29,13 +29,13 @@ final class FirstOperator implements ResolvesToAny, OperatorInterface public const NAME = '$first'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/FloorOperator.php b/src/Builder/Expression/FloorOperator.php index 741412330..6697c5394 100644 --- a/src/Builder/Expression/FloorOperator.php +++ b/src/Builder/Expression/FloorOperator.php @@ -25,13 +25,13 @@ final class FloorOperator implements ResolvesToInt, OperatorInterface public const NAME = '$floor'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/FunctionOperator.php b/src/Builder/Expression/FunctionOperator.php index 516729e3a..8f25666d8 100644 --- a/src/Builder/Expression/FunctionOperator.php +++ b/src/Builder/Expression/FunctionOperator.php @@ -38,8 +38,8 @@ final class FunctionOperator implements ResolvesToAny, OperatorInterface */ public readonly Javascript|string $body; - /** @var BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. */ - public readonly PackedArray|BSONArray|array $args; + /** @var BSONArray|PackedArray|array|string $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. */ + public readonly PackedArray|BSONArray|array|string $args; /** @var string $lang */ public readonly string $lang; @@ -47,11 +47,14 @@ final class FunctionOperator implements ResolvesToAny, OperatorInterface /** * @param Javascript|string $body The function definition. You can specify the function definition as either BSON\JavaScript or string. * function(arg1, arg2, ...) { ... } - * @param BSONArray|PackedArray|array $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. + * @param BSONArray|PackedArray|array|string $args Arguments passed to the function body. If the body function does not take an argument, you can specify an empty array [ ]. * @param string $lang */ - public function __construct(Javascript|string $body, PackedArray|BSONArray|array $args = [], string $lang = 'js') - { + public function __construct( + Javascript|string $body, + PackedArray|BSONArray|array|string $args = [], + string $lang = 'js', + ) { if (is_string($body)) { $body = new Javascript($body); } diff --git a/src/Builder/Expression/HourOperator.php b/src/Builder/Expression/HourOperator.php index 5c68b7446..89ad6a84c 100644 --- a/src/Builder/Expression/HourOperator.php +++ b/src/Builder/Expression/HourOperator.php @@ -27,18 +27,18 @@ final class HourOperator implements ResolvesToInt, OperatorInterface public const NAME = '$hour'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/InOperator.php b/src/Builder/Expression/InOperator.php index c2e24b9dc..c63e1b509 100644 --- a/src/Builder/Expression/InOperator.php +++ b/src/Builder/Expression/InOperator.php @@ -35,16 +35,16 @@ final class InOperator implements ResolvesToBool, OperatorInterface /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; - /** @var BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $array; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; /** * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $expression Any valid expression expression. - * @param BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Any valid expression that resolves to an array. */ public function __construct( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, - PackedArray|ResolvesToArray|BSONArray|array $array, + PackedArray|ResolvesToArray|BSONArray|array|string $array, ) { $this->expression = $expression; if (is_array($array) && ! array_is_list($array)) { diff --git a/src/Builder/Expression/IndexOfArrayOperator.php b/src/Builder/Expression/IndexOfArrayOperator.php index 15e3e4626..915732f52 100644 --- a/src/Builder/Expression/IndexOfArrayOperator.php +++ b/src/Builder/Expression/IndexOfArrayOperator.php @@ -34,42 +34,42 @@ final class IndexOfArrayOperator implements ResolvesToInt, OperatorInterface public const PROPERTIES = ['array' => 'array', 'search' => 'search', 'start' => 'start', 'end' => 'end']; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $array Can be any valid expression as long as it resolves to an array. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $array; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $array; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search; /** - * @var Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. */ - public readonly Optional|ResolvesToInt|int $start; + public readonly Optional|ResolvesToInt|int|string $start; /** - * @var Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ - public readonly Optional|ResolvesToInt|int $end; + public readonly Optional|ResolvesToInt|int|string $end; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $array Can be any valid expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $array Can be any valid expression as long as it resolves to an array. * If the array expression resolves to a value of null or refers to a field that is missing, $indexOfArray returns null. * If the array expression does not resolve to an array or null nor refers to a missing field, $indexOfArray returns an error. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $search - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $array, + PackedArray|ResolvesToArray|BSONArray|array|string $array, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ) { if (is_array($array) && ! array_is_list($array)) { throw new InvalidArgumentException('Expected $array argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/IndexOfBytesOperator.php b/src/Builder/Expression/IndexOfBytesOperator.php index 9f3d07533..2ffe996a8 100644 --- a/src/Builder/Expression/IndexOfBytesOperator.php +++ b/src/Builder/Expression/IndexOfBytesOperator.php @@ -35,32 +35,32 @@ final class IndexOfBytesOperator implements ResolvesToInt, OperatorInterface public readonly ResolvesToString|string $substring; /** - * @var Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. */ - public readonly Optional|ResolvesToInt|int $start; + public readonly Optional|ResolvesToInt|int|string $start; /** - * @var Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ - public readonly Optional|ResolvesToInt|int $end; + public readonly Optional|ResolvesToInt|int|string $end; /** * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfBytes returns null. * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfBytes returns an error. * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public function __construct( ResolvesToString|string $string, ResolvesToString|string $substring, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ) { $this->string = $string; $this->substring = $substring; diff --git a/src/Builder/Expression/IndexOfCPOperator.php b/src/Builder/Expression/IndexOfCPOperator.php index 735de9759..32161814f 100644 --- a/src/Builder/Expression/IndexOfCPOperator.php +++ b/src/Builder/Expression/IndexOfCPOperator.php @@ -35,32 +35,32 @@ final class IndexOfCPOperator implements ResolvesToInt, OperatorInterface public readonly ResolvesToString|string $substring; /** - * @var Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @var Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. */ - public readonly Optional|ResolvesToInt|int $start; + public readonly Optional|ResolvesToInt|int|string $start; /** - * @var Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @var Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ - public readonly Optional|ResolvesToInt|int $end; + public readonly Optional|ResolvesToInt|int|string $end; /** * @param ResolvesToString|string $string Can be any valid expression as long as it resolves to a string. * If the string expression resolves to a value of null or refers to a field that is missing, $indexOfCP returns null. * If the string expression does not resolve to a string or null nor refers to a missing field, $indexOfCP returns an error. * @param ResolvesToString|string $substring Can be any valid expression as long as it resolves to a string. - * @param Optional|ResolvesToInt|int $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. + * @param Optional|ResolvesToInt|int|string $start An integer, or a number that can be represented as integers (such as 2.0), that specifies the starting index position for the search. Can be any valid expression that resolves to a non-negative integral number. * If unspecified, the starting index position for the search is the beginning of the string. - * @param Optional|ResolvesToInt|int $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. + * @param Optional|ResolvesToInt|int|string $end An integer, or a number that can be represented as integers (such as 2.0), that specifies the ending index position for the search. Can be any valid expression that resolves to a non-negative integral number. If you specify a index value, you should also specify a index value; otherwise, $indexOfArray uses the value as the index value instead of the value. * If unspecified, the ending index position for the search is the end of the string. */ public function __construct( ResolvesToString|string $string, ResolvesToString|string $substring, - Optional|ResolvesToInt|int $start = Optional::Undefined, - Optional|ResolvesToInt|int $end = Optional::Undefined, + Optional|ResolvesToInt|int|string $start = Optional::Undefined, + Optional|ResolvesToInt|int|string $end = Optional::Undefined, ) { $this->string = $string; $this->substring = $substring; diff --git a/src/Builder/Expression/IsoDayOfWeekOperator.php b/src/Builder/Expression/IsoDayOfWeekOperator.php index 8bbc8dfe9..3cf6098ae 100644 --- a/src/Builder/Expression/IsoDayOfWeekOperator.php +++ b/src/Builder/Expression/IsoDayOfWeekOperator.php @@ -27,18 +27,18 @@ final class IsoDayOfWeekOperator implements ResolvesToInt, OperatorInterface public const NAME = '$isoDayOfWeek'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/IsoWeekOperator.php b/src/Builder/Expression/IsoWeekOperator.php index 726c53537..a66e2fe60 100644 --- a/src/Builder/Expression/IsoWeekOperator.php +++ b/src/Builder/Expression/IsoWeekOperator.php @@ -27,18 +27,18 @@ final class IsoWeekOperator implements ResolvesToInt, OperatorInterface public const NAME = '$isoWeek'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/IsoWeekYearOperator.php b/src/Builder/Expression/IsoWeekYearOperator.php index a29e2e8a6..25ec81582 100644 --- a/src/Builder/Expression/IsoWeekYearOperator.php +++ b/src/Builder/Expression/IsoWeekYearOperator.php @@ -27,18 +27,18 @@ final class IsoWeekYearOperator implements ResolvesToInt, OperatorInterface public const NAME = '$isoWeekYear'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/LastNOperator.php b/src/Builder/Expression/LastNOperator.php index 0517f92d8..cd74971c3 100644 --- a/src/Builder/Expression/LastNOperator.php +++ b/src/Builder/Expression/LastNOperator.php @@ -29,18 +29,20 @@ final class LastNOperator implements ResolvesToArray, OperatorInterface public const NAME = '$lastN'; public const PROPERTIES = ['n' => 'n', 'input' => 'input']; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. */ + public readonly ResolvesToInt|int|string $n; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; /** - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $firstN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return n elements. */ - public function __construct(ResolvesToInt|int $n, PackedArray|ResolvesToArray|BSONArray|array $input) - { + public function __construct( + ResolvesToInt|int|string $n, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ) { $this->n = $n; if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/LastOperator.php b/src/Builder/Expression/LastOperator.php index e7f2b7d46..48313100e 100644 --- a/src/Builder/Expression/LastOperator.php +++ b/src/Builder/Expression/LastOperator.php @@ -29,13 +29,13 @@ final class LastOperator implements ResolvesToAny, OperatorInterface public const NAME = '$last'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/LetOperator.php b/src/Builder/Expression/LetOperator.php index 3f0fde195..ed29e21b2 100644 --- a/src/Builder/Expression/LetOperator.php +++ b/src/Builder/Expression/LetOperator.php @@ -30,21 +30,21 @@ final class LetOperator implements ResolvesToAny, OperatorInterface public const PROPERTIES = ['vars' => 'vars', 'in' => 'in']; /** - * @var Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * @var Document|Serializable|array|stdClass|string $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. * The variable assignments have no meaning outside the in expression, not even within the vars block itself. */ - public readonly Document|Serializable|stdClass|array $vars; + public readonly Document|Serializable|stdClass|array|string $vars; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; /** - * @param Document|Serializable|array|stdClass $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. + * @param Document|Serializable|array|stdClass|string $vars Assignment block for the variables accessible in the in expression. To assign a variable, specify a string for the variable name and assign a valid expression for the value. * The variable assignments have no meaning outside the in expression, not even within the vars block itself. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in The expression to evaluate. */ public function __construct( - Document|Serializable|stdClass|array $vars, + Document|Serializable|stdClass|array|string $vars, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ) { $this->vars = $vars; diff --git a/src/Builder/Expression/LnOperator.php b/src/Builder/Expression/LnOperator.php index 6fe5993e9..31e55bdc9 100644 --- a/src/Builder/Expression/LnOperator.php +++ b/src/Builder/Expression/LnOperator.php @@ -26,13 +26,13 @@ final class LnOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$ln'; public const PROPERTIES = ['number' => 'number']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. For more information on expressions, see Expressions. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) { $this->number = $number; } diff --git a/src/Builder/Expression/Log10Operator.php b/src/Builder/Expression/Log10Operator.php index ef4a5ec3e..408fde884 100644 --- a/src/Builder/Expression/Log10Operator.php +++ b/src/Builder/Expression/Log10Operator.php @@ -25,13 +25,13 @@ final class Log10Operator implements ResolvesToDouble, OperatorInterface public const NAME = '$log10'; public const PROPERTIES = ['number' => 'number']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) { $this->number = $number; } diff --git a/src/Builder/Expression/LogOperator.php b/src/Builder/Expression/LogOperator.php index 99bbfd812..43d9b0b8b 100644 --- a/src/Builder/Expression/LogOperator.php +++ b/src/Builder/Expression/LogOperator.php @@ -25,19 +25,19 @@ final class LogOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$log'; public const PROPERTIES = ['number' => 'number', 'base' => 'base']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $base Any valid expression as long as it resolves to a positive number greater than 1. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $base; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $base; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. - * @param Decimal128|Int64|ResolvesToNumber|float|int $base Any valid expression as long as it resolves to a positive number greater than 1. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $base Any valid expression as long as it resolves to a positive number greater than 1. */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToNumber|float|int $base, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $base, ) { $this->number = $number; $this->base = $base; diff --git a/src/Builder/Expression/MapOperator.php b/src/Builder/Expression/MapOperator.php index a63685a88..83317b08d 100644 --- a/src/Builder/Expression/MapOperator.php +++ b/src/Builder/Expression/MapOperator.php @@ -33,8 +33,8 @@ final class MapOperator implements ResolvesToArray, OperatorInterface public const NAME = '$map'; public const PROPERTIES = ['input' => 'input', 'in' => 'in', 'as' => 'as']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; @@ -43,12 +43,12 @@ final class MapOperator implements ResolvesToArray, OperatorInterface public readonly Optional|ResolvesToString|string $as; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to an array. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $in An expression that is applied to each element of the input array. The expression references each element individually with the variable name specified in as. * @param Optional|ResolvesToString|string $as A name for the variable that represents each individual element of the input array. If no name is specified, the variable name defaults to this. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $input, + PackedArray|ResolvesToArray|BSONArray|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, Optional|ResolvesToString|string $as = Optional::Undefined, ) { diff --git a/src/Builder/Expression/MaxNOperator.php b/src/Builder/Expression/MaxNOperator.php index f8d387257..51c2240a3 100644 --- a/src/Builder/Expression/MaxNOperator.php +++ b/src/Builder/Expression/MaxNOperator.php @@ -29,18 +29,20 @@ final class MaxNOperator implements ResolvesToArray, OperatorInterface public const NAME = '$maxN'; public const PROPERTIES = ['input' => 'input', 'n' => 'n']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $input, ResolvesToInt|int $n) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); } diff --git a/src/Builder/Expression/MedianOperator.php b/src/Builder/Expression/MedianOperator.php index bae54c838..94aa08a2d 100644 --- a/src/Builder/Expression/MedianOperator.php +++ b/src/Builder/Expression/MedianOperator.php @@ -36,18 +36,18 @@ final class MedianOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$median'; public const PROPERTIES = ['input' => 'input', 'method' => 'method']; - /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ - public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input; + /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. */ + public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input; /** @var string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public readonly string $method; /** - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $median calculates the 50th percentile value of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $median calculation ignores it. * @param string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public function __construct( - Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input, + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, string $method, ) { if (is_array($input) && ! array_is_list($input)) { diff --git a/src/Builder/Expression/MergeObjectsOperator.php b/src/Builder/Expression/MergeObjectsOperator.php index 45e73a59e..e17e1ae1d 100644 --- a/src/Builder/Expression/MergeObjectsOperator.php +++ b/src/Builder/Expression/MergeObjectsOperator.php @@ -29,14 +29,14 @@ final class MergeObjectsOperator implements ResolvesToObject, OperatorInterface public const NAME = '$mergeObjects'; public const PROPERTIES = ['document' => 'document']; - /** @var list $document Any valid expression that resolves to a document. */ + /** @var list $document Any valid expression that resolves to a document. */ public readonly array $document; /** - * @param Document|ResolvesToObject|Serializable|array|stdClass ...$document Any valid expression that resolves to a document. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string ...$document Any valid expression that resolves to a document. * @no-named-arguments */ - public function __construct(Document|Serializable|ResolvesToObject|stdClass|array ...$document) + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string ...$document) { if (\count($document) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $document, got %d.', 1, \count($document))); diff --git a/src/Builder/Expression/MillisecondOperator.php b/src/Builder/Expression/MillisecondOperator.php index 06d8a4bd8..a7565420d 100644 --- a/src/Builder/Expression/MillisecondOperator.php +++ b/src/Builder/Expression/MillisecondOperator.php @@ -27,18 +27,18 @@ final class MillisecondOperator implements ResolvesToInt, OperatorInterface public const NAME = '$millisecond'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/MinNOperator.php b/src/Builder/Expression/MinNOperator.php index 9d032fe3e..9badbbb84 100644 --- a/src/Builder/Expression/MinNOperator.php +++ b/src/Builder/Expression/MinNOperator.php @@ -29,18 +29,20 @@ final class MinNOperator implements ResolvesToArray, OperatorInterface public const NAME = '$minN'; public const PROPERTIES = ['input' => 'input', 'n' => 'n']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public readonly ResolvesToInt|int $n; + /** @var ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ + public readonly ResolvesToInt|int|string $n; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to the array from which to return the maximal n elements. - * @param ResolvesToInt|int $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input An expression that resolves to the array from which to return the maximal n elements. + * @param ResolvesToInt|int|string $n An expression that resolves to a positive integer. The integer specifies the number of array elements that $maxN returns. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $input, ResolvesToInt|int $n) - { + public function __construct( + PackedArray|ResolvesToArray|BSONArray|array|string $input, + ResolvesToInt|int|string $n, + ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); } diff --git a/src/Builder/Expression/MinuteOperator.php b/src/Builder/Expression/MinuteOperator.php index 2be3b337d..0b76cc739 100644 --- a/src/Builder/Expression/MinuteOperator.php +++ b/src/Builder/Expression/MinuteOperator.php @@ -27,18 +27,18 @@ final class MinuteOperator implements ResolvesToInt, OperatorInterface public const NAME = '$minute'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/ModOperator.php b/src/Builder/Expression/ModOperator.php index 8a2134fac..40e56e041 100644 --- a/src/Builder/Expression/ModOperator.php +++ b/src/Builder/Expression/ModOperator.php @@ -25,19 +25,19 @@ final class ModOperator implements ResolvesToInt, OperatorInterface public const NAME = '$mod'; public const PROPERTIES = ['dividend' => 'dividend', 'divisor' => 'divisor']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $dividend; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $dividend; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $divisor */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $divisor; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $divisor; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. - * @param Decimal128|Int64|ResolvesToNumber|float|int $divisor + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $dividend The first argument is the dividend, and the second argument is the divisor; i.e. first argument is divided by the second argument. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $divisor */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int|string $dividend, + Decimal128|Int64|ResolvesToNumber|float|int|string $divisor, ) { $this->dividend = $dividend; $this->divisor = $divisor; diff --git a/src/Builder/Expression/MonthOperator.php b/src/Builder/Expression/MonthOperator.php index 36d1c2b17..7670c71e3 100644 --- a/src/Builder/Expression/MonthOperator.php +++ b/src/Builder/Expression/MonthOperator.php @@ -27,18 +27,18 @@ final class MonthOperator implements ResolvesToInt, OperatorInterface public const NAME = '$month'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/MultiplyOperator.php b/src/Builder/Expression/MultiplyOperator.php index ba2f5882e..31d781ad4 100644 --- a/src/Builder/Expression/MultiplyOperator.php +++ b/src/Builder/Expression/MultiplyOperator.php @@ -29,17 +29,17 @@ final class MultiplyOperator implements ResolvesToDecimal, OperatorInterface public const PROPERTIES = ['expression' => 'expression']; /** - * @var list $expression The arguments can be any valid expression as long as they resolve to numbers. + * @var list $expression The arguments can be any valid expression as long as they resolve to numbers. * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. */ public readonly array $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression The arguments can be any valid expression as long as they resolve to numbers. * Starting in MongoDB 6.1 you can optimize the $multiply operation. To improve performance, group references at the end of the argument list. * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/ObjectToArrayOperator.php b/src/Builder/Expression/ObjectToArrayOperator.php index 0685bed27..a3de6eeb9 100644 --- a/src/Builder/Expression/ObjectToArrayOperator.php +++ b/src/Builder/Expression/ObjectToArrayOperator.php @@ -26,13 +26,13 @@ final class ObjectToArrayOperator implements ResolvesToArray, OperatorInterface public const NAME = '$objectToArray'; public const PROPERTIES = ['object' => 'object']; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $object; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $object; /** - * @param Document|ResolvesToObject|Serializable|array|stdClass $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $object Any valid expression as long as it resolves to a document object. $objectToArray applies to the top-level fields of its argument. If the argument is a document that itself contains embedded document fields, the $objectToArray does not recursively apply to the embedded document fields. */ - public function __construct(Document|Serializable|ResolvesToObject|stdClass|array $object) + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $object) { $this->object = $object; } diff --git a/src/Builder/Expression/PercentileOperator.php b/src/Builder/Expression/PercentileOperator.php index ab956bac5..db6101b95 100644 --- a/src/Builder/Expression/PercentileOperator.php +++ b/src/Builder/Expression/PercentileOperator.php @@ -39,27 +39,27 @@ final class PercentileOperator implements ResolvesToArray, OperatorInterface public const NAME = '$percentile'; public const PROPERTIES = ['input' => 'input', 'p' => 'p', 'method' => 'method']; - /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ - public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input; + /** @var BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. */ + public readonly Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $p; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $p; /** @var string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public readonly string $method; /** - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. - * @param BSONArray|PackedArray|ResolvesToArray|array $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToNumber|array|float|int|string $input $percentile calculates the percentile values of this data. input must be a field name or an expression that evaluates to a numeric type. If the expression cannot be converted to a numeric type, the $percentile calculation ignores it. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $p $percentile calculates a percentile value for each element in p. The elements represent percentages and must evaluate to numeric values in the range 0.0 to 1.0, inclusive. * $percentile returns results in the same order as the elements in p. * @param string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public function __construct( - Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int $input, - PackedArray|ResolvesToArray|BSONArray|array $p, + Decimal128|Int64|PackedArray|ResolvesToNumber|BSONArray|array|float|int|string $input, + PackedArray|ResolvesToArray|BSONArray|array|string $p, string $method, ) { if (is_array($input) && ! array_is_list($input)) { diff --git a/src/Builder/Expression/PowOperator.php b/src/Builder/Expression/PowOperator.php index 8cf024023..2397dc57e 100644 --- a/src/Builder/Expression/PowOperator.php +++ b/src/Builder/Expression/PowOperator.php @@ -25,19 +25,19 @@ final class PowOperator implements ResolvesToNumber, OperatorInterface public const NAME = '$pow'; public const PROPERTIES = ['number' => 'number', 'exponent' => 'exponent']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $number */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $exponent */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $exponent; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $exponent; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number - * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $exponent */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToNumber|float|int $exponent, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Decimal128|Int64|ResolvesToNumber|float|int|string $exponent, ) { $this->number = $number; $this->exponent = $exponent; diff --git a/src/Builder/Expression/RadiansToDegreesOperator.php b/src/Builder/Expression/RadiansToDegreesOperator.php index b3764f0ed..d27ad314d 100644 --- a/src/Builder/Expression/RadiansToDegreesOperator.php +++ b/src/Builder/Expression/RadiansToDegreesOperator.php @@ -25,13 +25,13 @@ final class RadiansToDegreesOperator implements ResolvesToDouble, ResolvesToDeci public const NAME = '$radiansToDegrees'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/RangeOperator.php b/src/Builder/Expression/RangeOperator.php index cbb0e32e7..e5e067bc3 100644 --- a/src/Builder/Expression/RangeOperator.php +++ b/src/Builder/Expression/RangeOperator.php @@ -24,24 +24,24 @@ final class RangeOperator implements ResolvesToArray, OperatorInterface public const NAME = '$range'; public const PROPERTIES = ['start' => 'start', 'end' => 'end', 'step' => 'step']; - /** @var ResolvesToInt|int $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. */ - public readonly ResolvesToInt|int $start; + /** @var ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. */ + public readonly ResolvesToInt|int|string $start; - /** @var ResolvesToInt|int $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. */ - public readonly ResolvesToInt|int $end; + /** @var ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. */ + public readonly ResolvesToInt|int|string $end; - /** @var Optional|ResolvesToInt|int $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. */ - public readonly Optional|ResolvesToInt|int $step; + /** @var Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. */ + public readonly Optional|ResolvesToInt|int|string $step; /** - * @param ResolvesToInt|int $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. - * @param ResolvesToInt|int $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. - * @param Optional|ResolvesToInt|int $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. + * @param ResolvesToInt|int|string $start An integer that specifies the start of the sequence. Can be any valid expression that resolves to an integer. + * @param ResolvesToInt|int|string $end An integer that specifies the exclusive upper limit of the sequence. Can be any valid expression that resolves to an integer. + * @param Optional|ResolvesToInt|int|string $step An integer that specifies the increment value. Can be any valid expression that resolves to a non-zero integer. Defaults to 1. */ public function __construct( - ResolvesToInt|int $start, - ResolvesToInt|int $end, - Optional|ResolvesToInt|int $step = Optional::Undefined, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $end, + Optional|ResolvesToInt|int|string $step = Optional::Undefined, ) { $this->start = $start; $this->end = $end; diff --git a/src/Builder/Expression/ReduceOperator.php b/src/Builder/Expression/ReduceOperator.php index c35b2b530..2b894b2e2 100644 --- a/src/Builder/Expression/ReduceOperator.php +++ b/src/Builder/Expression/ReduceOperator.php @@ -33,11 +33,11 @@ final class ReduceOperator implements ResolvesToAny, OperatorInterface public const PROPERTIES = ['input' => 'input', 'initialValue' => 'initialValue', 'in' => 'in']; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $input Can be any valid expression that resolves to an array. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue; @@ -51,7 +51,7 @@ final class ReduceOperator implements ResolvesToAny, OperatorInterface public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input Can be any valid expression that resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input Can be any valid expression that resolves to an array. * If the argument resolves to a value of null or refers to a missing field, $reduce returns null. * If the argument does not resolve to an array or null nor refers to a missing field, $reduce returns an error. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $initialValue The initial cumulative value set before in is applied to the first element of the input array. @@ -61,7 +61,7 @@ final class ReduceOperator implements ResolvesToAny, OperatorInterface * - this is the variable that refers to the element being processed. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $input, + PackedArray|ResolvesToArray|BSONArray|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ) { diff --git a/src/Builder/Expression/ReverseArrayOperator.php b/src/Builder/Expression/ReverseArrayOperator.php index be6a910d4..16c7c0c03 100644 --- a/src/Builder/Expression/ReverseArrayOperator.php +++ b/src/Builder/Expression/ReverseArrayOperator.php @@ -29,13 +29,13 @@ final class ReverseArrayOperator implements ResolvesToArray, OperatorInterface public const NAME = '$reverseArray'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression The argument can be any valid expression as long as it resolves to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression The argument can be any valid expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument can be any valid expression as long as it resolves to an array. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/RoundOperator.php b/src/Builder/Expression/RoundOperator.php index 21638126d..15756ad88 100644 --- a/src/Builder/Expression/RoundOperator.php +++ b/src/Builder/Expression/RoundOperator.php @@ -27,22 +27,22 @@ final class RoundOperator implements ResolvesToInt, ResolvesToDouble, ResolvesTo public const PROPERTIES = ['number' => 'number', 'place' => 'place']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $round returns an error if the expression resolves to a non-numeric data type. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; - /** @var Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. */ - public readonly Optional|ResolvesToInt|int $place; + /** @var Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. */ + public readonly Optional|ResolvesToInt|int|string $place; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $round returns an error if the expression resolves to a non-numeric data type. - * @param Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Optional|ResolvesToInt|int $place = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, ) { $this->number = $number; $this->place = $place; diff --git a/src/Builder/Expression/SecondOperator.php b/src/Builder/Expression/SecondOperator.php index 720d57a92..9995b3951 100644 --- a/src/Builder/Expression/SecondOperator.php +++ b/src/Builder/Expression/SecondOperator.php @@ -27,18 +27,18 @@ final class SecondOperator implements ResolvesToInt, OperatorInterface public const NAME = '$second'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/SetDifferenceOperator.php b/src/Builder/Expression/SetDifferenceOperator.php index 2b4fde506..678828850 100644 --- a/src/Builder/Expression/SetDifferenceOperator.php +++ b/src/Builder/Expression/SetDifferenceOperator.php @@ -29,19 +29,19 @@ final class SetDifferenceOperator implements ResolvesToArray, OperatorInterface public const NAME = '$setDifference'; public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression1 The arguments can be any valid expression as long as they each resolve to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression1; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression1; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression2 The arguments can be any valid expression as long as they each resolve to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression2; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression2; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression1 The arguments can be any valid expression as long as they each resolve to an array. - * @param BSONArray|PackedArray|ResolvesToArray|array $expression2 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 The arguments can be any valid expression as long as they each resolve to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 The arguments can be any valid expression as long as they each resolve to an array. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $expression1, - PackedArray|ResolvesToArray|BSONArray|array $expression2, + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, ) { if (is_array($expression1) && ! array_is_list($expression1)) { throw new InvalidArgumentException('Expected $expression1 argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/SetEqualsOperator.php b/src/Builder/Expression/SetEqualsOperator.php index b7eca0089..c743c8cca 100644 --- a/src/Builder/Expression/SetEqualsOperator.php +++ b/src/Builder/Expression/SetEqualsOperator.php @@ -28,14 +28,14 @@ final class SetEqualsOperator implements ResolvesToBool, OperatorInterface public const NAME = '$setEquals'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression * @no-named-arguments */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array ...$expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/SetFieldOperator.php b/src/Builder/Expression/SetFieldOperator.php index 08559253e..e01bae4fa 100644 --- a/src/Builder/Expression/SetFieldOperator.php +++ b/src/Builder/Expression/SetFieldOperator.php @@ -32,8 +32,8 @@ final class SetFieldOperator implements ResolvesToObject, OperatorInterface /** @var ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. */ public readonly ResolvesToString|string $field; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $input; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $input; /** * @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. @@ -43,13 +43,13 @@ final class SetFieldOperator implements ResolvesToObject, OperatorInterface /** * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. - * @param Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $value The value that you want to assign to field. value can be any valid expression. * Set to $$REMOVE to remove field from the input document. */ public function __construct( ResolvesToString|string $field, - Document|Serializable|ResolvesToObject|stdClass|array $input, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, ) { $this->field = $field; diff --git a/src/Builder/Expression/SetIntersectionOperator.php b/src/Builder/Expression/SetIntersectionOperator.php index 3ec2c03dd..a27dd4e9b 100644 --- a/src/Builder/Expression/SetIntersectionOperator.php +++ b/src/Builder/Expression/SetIntersectionOperator.php @@ -28,14 +28,14 @@ final class SetIntersectionOperator implements ResolvesToArray, OperatorInterfac public const NAME = '$setIntersection'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression * @no-named-arguments */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array ...$expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/SetIsSubsetOperator.php b/src/Builder/Expression/SetIsSubsetOperator.php index 76263d138..2a4e25055 100644 --- a/src/Builder/Expression/SetIsSubsetOperator.php +++ b/src/Builder/Expression/SetIsSubsetOperator.php @@ -29,19 +29,19 @@ final class SetIsSubsetOperator implements ResolvesToBool, OperatorInterface public const NAME = '$setIsSubset'; public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression1 */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression1; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression1 */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression1; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression2 */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression2; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression2 */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression2; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression1 - * @param BSONArray|PackedArray|ResolvesToArray|array $expression2 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression1 + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression2 */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $expression1, - PackedArray|ResolvesToArray|BSONArray|array $expression2, + PackedArray|ResolvesToArray|BSONArray|array|string $expression1, + PackedArray|ResolvesToArray|BSONArray|array|string $expression2, ) { if (is_array($expression1) && ! array_is_list($expression1)) { throw new InvalidArgumentException('Expected $expression1 argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/SetUnionOperator.php b/src/Builder/Expression/SetUnionOperator.php index 62f2cb871..5a7af7651 100644 --- a/src/Builder/Expression/SetUnionOperator.php +++ b/src/Builder/Expression/SetUnionOperator.php @@ -28,14 +28,14 @@ final class SetUnionOperator implements ResolvesToArray, OperatorInterface public const NAME = '$setUnion'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array ...$expression + * @param BSONArray|PackedArray|ResolvesToArray|array|string ...$expression * @no-named-arguments */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array ...$expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/SinOperator.php b/src/Builder/Expression/SinOperator.php index 9ba0d998e..a0ed5cca4 100644 --- a/src/Builder/Expression/SinOperator.php +++ b/src/Builder/Expression/SinOperator.php @@ -26,16 +26,16 @@ final class SinOperator implements ResolvesToDouble, ResolvesToDecimal, Operator public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sin takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $sin returns values as a double. $sin can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/SinhOperator.php b/src/Builder/Expression/SinhOperator.php index e04ff231d..795c282d6 100644 --- a/src/Builder/Expression/SinhOperator.php +++ b/src/Builder/Expression/SinhOperator.php @@ -26,16 +26,16 @@ final class SinhOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $sinh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $sinh returns values as a double. $sinh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/SizeOperator.php b/src/Builder/Expression/SizeOperator.php index 7ff3b83f7..707af0b42 100644 --- a/src/Builder/Expression/SizeOperator.php +++ b/src/Builder/Expression/SizeOperator.php @@ -29,13 +29,13 @@ final class SizeOperator implements ResolvesToInt, OperatorInterface public const NAME = '$size'; public const PROPERTIES = ['expression' => 'expression']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression The argument for $size can be any expression as long as it resolves to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression The argument for $size can be any expression as long as it resolves to an array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression The argument for $size can be any expression as long as it resolves to an array. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $expression) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $expression) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/SliceOperator.php b/src/Builder/Expression/SliceOperator.php index 220810428..55d6fe697 100644 --- a/src/Builder/Expression/SliceOperator.php +++ b/src/Builder/Expression/SliceOperator.php @@ -30,36 +30,36 @@ final class SliceOperator implements ResolvesToArray, OperatorInterface public const NAME = '$slice'; public const PROPERTIES = ['expression' => 'expression', 'n' => 'n', 'position' => 'position']; - /** @var BSONArray|PackedArray|ResolvesToArray|array $expression Any valid expression as long as it resolves to an array. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $expression; + /** @var BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. */ + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $expression; /** - * @var ResolvesToInt|int $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * @var ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. */ - public readonly ResolvesToInt|int $n; + public readonly ResolvesToInt|int|string $n; /** - * @var Optional|ResolvesToInt|int $position Any valid expression as long as it resolves to an integer. + * @var Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. */ - public readonly Optional|ResolvesToInt|int $position; + public readonly Optional|ResolvesToInt|int|string $position; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $expression Any valid expression as long as it resolves to an array. - * @param ResolvesToInt|int $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $expression Any valid expression as long as it resolves to an array. + * @param ResolvesToInt|int|string $n Any valid expression as long as it resolves to an integer. If position is specified, n must resolve to a positive integer. * If positive, $slice returns up to the first n elements in the array. If the position is specified, $slice returns the first n elements starting from the position. * If negative, $slice returns up to the last n elements in the array. n cannot resolve to a negative number if is specified. - * @param Optional|ResolvesToInt|int $position Any valid expression as long as it resolves to an integer. + * @param Optional|ResolvesToInt|int|string $position Any valid expression as long as it resolves to an integer. * If positive, $slice determines the starting position from the start of the array. If position is greater than the number of elements, the $slice returns an empty array. * If negative, $slice determines the starting position from the end of the array. If the absolute value of the is greater than the number of elements, the starting position is the start of the array. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $expression, - ResolvesToInt|int $n, - Optional|ResolvesToInt|int $position = Optional::Undefined, + PackedArray|ResolvesToArray|BSONArray|array|string $expression, + ResolvesToInt|int|string $n, + Optional|ResolvesToInt|int|string $position = Optional::Undefined, ) { if (is_array($expression) && ! array_is_list($expression)) { throw new InvalidArgumentException('Expected $expression argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/SortArrayOperator.php b/src/Builder/Expression/SortArrayOperator.php index b58e2b65e..04ee9109c 100644 --- a/src/Builder/Expression/SortArrayOperator.php +++ b/src/Builder/Expression/SortArrayOperator.php @@ -34,24 +34,24 @@ final class SortArrayOperator implements ResolvesToArray, OperatorInterface public const PROPERTIES = ['input' => 'input', 'sortBy' => 'sortBy']; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $input The array to be sorted. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined * If the expression evaluates to any other non-array value, the document returns an error. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $input; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $input; - /** @var Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. */ - public readonly Document|Serializable|Sort|stdClass|array|int $sortBy; + /** @var Document|Serializable|Sort|array|int|stdClass|string $sortBy The document specifies a sort ordering. */ + public readonly Document|Serializable|Sort|stdClass|array|int|string $sortBy; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $input The array to be sorted. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $input The array to be sorted. * The result is null if the expression: is missing, evaluates to null, or evaluates to undefined * If the expression evaluates to any other non-array value, the document returns an error. - * @param Document|Serializable|Sort|array|int|stdClass $sortBy The document specifies a sort ordering. + * @param Document|Serializable|Sort|array|int|stdClass|string $sortBy The document specifies a sort ordering. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $input, - Document|Serializable|Sort|stdClass|array|int $sortBy, + PackedArray|ResolvesToArray|BSONArray|array|string $input, + Document|Serializable|Sort|stdClass|array|int|string $sortBy, ) { if (is_array($input) && ! array_is_list($input)) { throw new InvalidArgumentException('Expected $input argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/SqrtOperator.php b/src/Builder/Expression/SqrtOperator.php index 90a907ef5..ca1ebeb86 100644 --- a/src/Builder/Expression/SqrtOperator.php +++ b/src/Builder/Expression/SqrtOperator.php @@ -25,13 +25,13 @@ final class SqrtOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$sqrt'; public const PROPERTIES = ['number' => 'number']; - /** @var Decimal128|Int64|ResolvesToNumber|float|int $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + /** @var Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. */ + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number The argument can be any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $number) { $this->number = $number; } diff --git a/src/Builder/Expression/StdDevPopOperator.php b/src/Builder/Expression/StdDevPopOperator.php index e966f8e84..dae7344a1 100644 --- a/src/Builder/Expression/StdDevPopOperator.php +++ b/src/Builder/Expression/StdDevPopOperator.php @@ -30,14 +30,14 @@ final class StdDevPopOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$stdDevPop'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/StdDevSampOperator.php b/src/Builder/Expression/StdDevSampOperator.php index 1c897728b..55af36f53 100644 --- a/src/Builder/Expression/StdDevSampOperator.php +++ b/src/Builder/Expression/StdDevSampOperator.php @@ -29,14 +29,14 @@ final class StdDevSampOperator implements ResolvesToDouble, OperatorInterface public const NAME = '$stdDevSamp'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string ...$expression) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/SubstrBytesOperator.php b/src/Builder/Expression/SubstrBytesOperator.php index 72d5ee8c5..d30d12fa5 100644 --- a/src/Builder/Expression/SubstrBytesOperator.php +++ b/src/Builder/Expression/SubstrBytesOperator.php @@ -26,19 +26,22 @@ final class SubstrBytesOperator implements ResolvesToString, OperatorInterface /** @var ResolvesToString|string $string */ public readonly ResolvesToString|string $string; - /** @var ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". */ - public readonly ResolvesToInt|int $start; + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; - /** @var ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public readonly ResolvesToInt|int $length; + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; /** * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public function __construct(ResolvesToString|string $string, ResolvesToInt|int $start, ResolvesToInt|int $length) - { + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { $this->string = $string; $this->start = $start; $this->length = $length; diff --git a/src/Builder/Expression/SubstrCPOperator.php b/src/Builder/Expression/SubstrCPOperator.php index ee01339d2..b878bf0fb 100644 --- a/src/Builder/Expression/SubstrCPOperator.php +++ b/src/Builder/Expression/SubstrCPOperator.php @@ -26,19 +26,22 @@ final class SubstrCPOperator implements ResolvesToString, OperatorInterface /** @var ResolvesToString|string $string */ public readonly ResolvesToString|string $string; - /** @var ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". */ - public readonly ResolvesToInt|int $start; + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; - /** @var ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public readonly ResolvesToInt|int $length; + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; /** * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public function __construct(ResolvesToString|string $string, ResolvesToInt|int $start, ResolvesToInt|int $length) - { + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { $this->string = $string; $this->start = $start; $this->length = $length; diff --git a/src/Builder/Expression/SubstrOperator.php b/src/Builder/Expression/SubstrOperator.php index 10ece1704..e491c5f02 100644 --- a/src/Builder/Expression/SubstrOperator.php +++ b/src/Builder/Expression/SubstrOperator.php @@ -26,19 +26,22 @@ final class SubstrOperator implements ResolvesToString, OperatorInterface /** @var ResolvesToString|string $string */ public readonly ResolvesToString|string $string; - /** @var ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". */ - public readonly ResolvesToInt|int $start; + /** @var ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". */ + public readonly ResolvesToInt|int|string $start; - /** @var ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public readonly ResolvesToInt|int $length; + /** @var ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ + public readonly ResolvesToInt|int|string $length; /** * @param ResolvesToString|string $string - * @param ResolvesToInt|int $start If start is a negative number, $substr returns an empty string "". - * @param ResolvesToInt|int $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. + * @param ResolvesToInt|int|string $start If start is a negative number, $substr returns an empty string "". + * @param ResolvesToInt|int|string $length If length is a negative number, $substr returns a substring that starts at the specified index and includes the rest of the string. */ - public function __construct(ResolvesToString|string $string, ResolvesToInt|int $start, ResolvesToInt|int $length) - { + public function __construct( + ResolvesToString|string $string, + ResolvesToInt|int|string $start, + ResolvesToInt|int|string $length, + ) { $this->string = $string; $this->start = $start; $this->length = $length; diff --git a/src/Builder/Expression/SubtractOperator.php b/src/Builder/Expression/SubtractOperator.php index 8a7187b78..462f170be 100644 --- a/src/Builder/Expression/SubtractOperator.php +++ b/src/Builder/Expression/SubtractOperator.php @@ -26,19 +26,19 @@ final class SubtractOperator implements ResolvesToInt, ResolvesToLong, ResolvesT public const NAME = '$subtract'; public const PROPERTIES = ['expression1' => 'expression1', 'expression2' => 'expression2']; - /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 */ - public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1; + /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 */ + public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1; - /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 */ - public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2; + /** @var Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 */ + public readonly Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 - * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression1 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int|string $expression2 */ public function __construct( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression1, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/SumOperator.php b/src/Builder/Expression/SumOperator.php index 99d90de28..04bfaf06a 100644 --- a/src/Builder/Expression/SumOperator.php +++ b/src/Builder/Expression/SumOperator.php @@ -31,15 +31,15 @@ final class SumOperator implements ResolvesToNumber, OperatorInterface public const NAME = '$sum'; public const PROPERTIES = ['expression' => 'expression']; - /** @var list $expression */ + /** @var list $expression */ public readonly array $expression; /** - * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int ...$expression + * @param BSONArray|Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|array|float|int|string ...$expression * @no-named-arguments */ public function __construct( - Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int ...$expression, + Decimal128|Int64|PackedArray|ResolvesToArray|ResolvesToNumber|BSONArray|array|float|int|string ...$expression, ) { if (\count($expression) < 1) { throw new InvalidArgumentException(\sprintf('Expected at least %d values for $expression, got %d.', 1, \count($expression))); diff --git a/src/Builder/Expression/SwitchOperator.php b/src/Builder/Expression/SwitchOperator.php index 4179a5d52..46b6242ce 100644 --- a/src/Builder/Expression/SwitchOperator.php +++ b/src/Builder/Expression/SwitchOperator.php @@ -34,12 +34,12 @@ final class SwitchOperator implements ResolvesToAny, OperatorInterface public const PROPERTIES = ['branches' => 'branches', 'default' => 'default']; /** - * @var BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * @var BSONArray|PackedArray|array|string $branches An array of control branch documents. Each branch is a document with the following fields: * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. * - then Can be any valid expression. * The branches array must contain at least one branch document. */ - public readonly PackedArray|BSONArray|array $branches; + public readonly PackedArray|BSONArray|array|string $branches; /** * @var Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default The path to take if no branch case expression evaluates to true. @@ -48,7 +48,7 @@ final class SwitchOperator implements ResolvesToAny, OperatorInterface public readonly Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; /** - * @param BSONArray|PackedArray|array $branches An array of control branch documents. Each branch is a document with the following fields: + * @param BSONArray|PackedArray|array|string $branches An array of control branch documents. Each branch is a document with the following fields: * - case Can be any valid expression that resolves to a boolean. If the result is not a boolean, it is coerced to a boolean value. More information about how MongoDB evaluates expressions as either true or false can be found here. * - then Can be any valid expression. * The branches array must contain at least one branch document. @@ -56,7 +56,7 @@ final class SwitchOperator implements ResolvesToAny, OperatorInterface * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. */ public function __construct( - PackedArray|BSONArray|array $branches, + PackedArray|BSONArray|array|string $branches, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, ) { if (is_array($branches) && ! array_is_list($branches)) { diff --git a/src/Builder/Expression/TanOperator.php b/src/Builder/Expression/TanOperator.php index bab27a3a5..2e4ddd7b0 100644 --- a/src/Builder/Expression/TanOperator.php +++ b/src/Builder/Expression/TanOperator.php @@ -26,16 +26,16 @@ final class TanOperator implements ResolvesToDouble, ResolvesToDecimal, Operator public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tan takes any valid expression that resolves to a number. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the result to radians. * By default $tan returns values as a double. $tan can also return values as a 128-bit decimal as long as the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/TanhOperator.php b/src/Builder/Expression/TanhOperator.php index 5e31a67d1..3e565a26c 100644 --- a/src/Builder/Expression/TanhOperator.php +++ b/src/Builder/Expression/TanhOperator.php @@ -26,16 +26,16 @@ final class TanhOperator implements ResolvesToDouble, ResolvesToDecimal, Operato public const PROPERTIES = ['expression' => 'expression']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $expression; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $expression; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $expression $tanh takes any valid expression that resolves to a number, measured in radians. If the expression returns a value in degrees, use the $degreesToRadians operator to convert the value to radians. * By default $tanh returns values as a double. $tanh can also return values as a 128-bit decimal if the expression resolves to a 128-bit decimal value. */ - public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/TruncOperator.php b/src/Builder/Expression/TruncOperator.php index c6db92b34..27a231b8d 100644 --- a/src/Builder/Expression/TruncOperator.php +++ b/src/Builder/Expression/TruncOperator.php @@ -27,22 +27,22 @@ final class TruncOperator implements ResolvesToString, OperatorInterface public const PROPERTIES = ['number' => 'number', 'place' => 'place']; /** - * @var Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @var Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $trunc returns an error if the expression resolves to a non-numeric data type. */ - public readonly Decimal128|Int64|ResolvesToNumber|float|int $number; + public readonly Decimal128|Int64|ResolvesToNumber|float|int|string $number; - /** @var Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. */ - public readonly Optional|ResolvesToInt|int $place; + /** @var Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. */ + public readonly Optional|ResolvesToInt|int|string $place; /** - * @param Decimal128|Int64|ResolvesToNumber|float|int $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. + * @param Decimal128|Int64|ResolvesToNumber|float|int|string $number Can be any valid expression that resolves to a number. Specifically, the expression must resolve to an integer, double, decimal, or long. * $trunc returns an error if the expression resolves to a non-numeric data type. - * @param Optional|ResolvesToInt|int $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. + * @param Optional|ResolvesToInt|int|string $place Can be any valid expression that resolves to an integer between -20 and 100, exclusive. e.g. -20 < place < 100. Defaults to 0. */ public function __construct( - Decimal128|Int64|ResolvesToNumber|float|int $number, - Optional|ResolvesToInt|int $place = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int|string $number, + Optional|ResolvesToInt|int|string $place = Optional::Undefined, ) { $this->number = $number; $this->place = $place; diff --git a/src/Builder/Expression/TsIncrementOperator.php b/src/Builder/Expression/TsIncrementOperator.php index b39d897bc..32d8ff8d3 100644 --- a/src/Builder/Expression/TsIncrementOperator.php +++ b/src/Builder/Expression/TsIncrementOperator.php @@ -25,13 +25,13 @@ final class TsIncrementOperator implements ResolvesToLong, OperatorInterface public const NAME = '$tsIncrement'; public const PROPERTIES = ['expression' => 'expression']; - /** @var ResolvesToTimestamp|Timestamp|int $expression */ - public readonly Timestamp|ResolvesToTimestamp|int $expression; + /** @var ResolvesToTimestamp|Timestamp|int|string $expression */ + public readonly Timestamp|ResolvesToTimestamp|int|string $expression; /** - * @param ResolvesToTimestamp|Timestamp|int $expression + * @param ResolvesToTimestamp|Timestamp|int|string $expression */ - public function __construct(Timestamp|ResolvesToTimestamp|int $expression) + public function __construct(Timestamp|ResolvesToTimestamp|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/TsSecondOperator.php b/src/Builder/Expression/TsSecondOperator.php index 71af2b803..eff32f6a0 100644 --- a/src/Builder/Expression/TsSecondOperator.php +++ b/src/Builder/Expression/TsSecondOperator.php @@ -25,13 +25,13 @@ final class TsSecondOperator implements ResolvesToLong, OperatorInterface public const NAME = '$tsSecond'; public const PROPERTIES = ['expression' => 'expression']; - /** @var ResolvesToTimestamp|Timestamp|int $expression */ - public readonly Timestamp|ResolvesToTimestamp|int $expression; + /** @var ResolvesToTimestamp|Timestamp|int|string $expression */ + public readonly Timestamp|ResolvesToTimestamp|int|string $expression; /** - * @param ResolvesToTimestamp|Timestamp|int $expression + * @param ResolvesToTimestamp|Timestamp|int|string $expression */ - public function __construct(Timestamp|ResolvesToTimestamp|int $expression) + public function __construct(Timestamp|ResolvesToTimestamp|int|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/UnsetFieldOperator.php b/src/Builder/Expression/UnsetFieldOperator.php index 6b040e2c4..a420fbf4e 100644 --- a/src/Builder/Expression/UnsetFieldOperator.php +++ b/src/Builder/Expression/UnsetFieldOperator.php @@ -30,16 +30,16 @@ final class UnsetFieldOperator implements ResolvesToObject, OperatorInterface /** @var ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. */ public readonly ResolvesToString|string $field; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $input; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $input; /** * @param ResolvesToString|string $field Field in the input object that you want to add, update, or remove. field can be any valid expression that resolves to a string constant. - * @param Document|ResolvesToObject|Serializable|array|stdClass $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $input Document that contains the field that you want to add or update. input must resolve to an object, missing, null, or undefined. */ public function __construct( ResolvesToString|string $field, - Document|Serializable|ResolvesToObject|stdClass|array $input, + Document|Serializable|ResolvesToObject|stdClass|array|string $input, ) { $this->field = $field; $this->input = $input; diff --git a/src/Builder/Expression/WeekOperator.php b/src/Builder/Expression/WeekOperator.php index 2d58d0509..eace09a39 100644 --- a/src/Builder/Expression/WeekOperator.php +++ b/src/Builder/Expression/WeekOperator.php @@ -27,18 +27,18 @@ final class WeekOperator implements ResolvesToInt, OperatorInterface public const NAME = '$week'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/YearOperator.php b/src/Builder/Expression/YearOperator.php index 57fcb35ae..b35a6c0c0 100644 --- a/src/Builder/Expression/YearOperator.php +++ b/src/Builder/Expression/YearOperator.php @@ -27,18 +27,18 @@ final class YearOperator implements ResolvesToInt, OperatorInterface public const NAME = '$year'; public const PROPERTIES = ['date' => 'date', 'timezone' => 'timezone']; - /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ - public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date; + /** @var ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. */ + public readonly ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date; /** @var Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public readonly Optional|ResolvesToString|string $timezone; /** - * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. + * @param ObjectId|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|Timestamp|UTCDateTime|int|string $date The date to which the operator is applied. date must be a valid expression that resolves to a Date, a Timestamp, or an ObjectID. * @param Optional|ResolvesToString|string $timezone The timezone of the operation result. timezone must be a valid expression that resolves to a string formatted as either an Olson Timezone Identifier or a UTC Offset. If no timezone is provided, the result is displayed in UTC. */ public function __construct( - ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, + ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int|string $date, Optional|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->date = $date; diff --git a/src/Builder/Expression/ZipOperator.php b/src/Builder/Expression/ZipOperator.php index 742b7e6bf..76521dd97 100644 --- a/src/Builder/Expression/ZipOperator.php +++ b/src/Builder/Expression/ZipOperator.php @@ -31,39 +31,39 @@ final class ZipOperator implements ResolvesToArray, OperatorInterface public const PROPERTIES = ['inputs' => 'inputs', 'useLongestLength' => 'useLongestLength', 'defaults' => 'defaults']; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * @var BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $inputs; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $inputs; /** - * @var Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * @var Optional|bool|string $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. * The default value is false: the shortest array length determines the number of arrays in the output array. */ - public readonly Optional|bool $useLongestLength; + public readonly Optional|bool|string $useLongestLength; /** - * @var Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * @var Optional|BSONArray|PackedArray|array|string $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. */ - public readonly Optional|PackedArray|BSONArray|array $defaults; + public readonly Optional|PackedArray|BSONArray|array|string $defaults; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. + * @param BSONArray|PackedArray|ResolvesToArray|array|string $inputs An array of expressions that resolve to arrays. The elements of these input arrays combine to form the arrays of the output array. * If any of the inputs arrays resolves to a value of null or refers to a missing field, $zip returns null. * If any of the inputs arrays does not resolve to an array or null nor refers to a missing field, $zip returns an error. - * @param Optional|bool $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. + * @param Optional|bool|string $useLongestLength A boolean which specifies whether the length of the longest array determines the number of arrays in the output array. * The default value is false: the shortest array length determines the number of arrays in the output array. - * @param Optional|BSONArray|PackedArray|array $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. + * @param Optional|BSONArray|PackedArray|array|string $defaults An array of default element values to use if the input arrays have different lengths. You must specify useLongestLength: true along with this field, or else $zip will return an error. * If useLongestLength: true but defaults is empty or not specified, $zip uses null as the default value. * If specifying a non-empty defaults, you must specify a default for each input array or else $zip will return an error. */ public function __construct( - PackedArray|ResolvesToArray|BSONArray|array $inputs, - Optional|bool $useLongestLength = Optional::Undefined, - Optional|PackedArray|BSONArray|array $defaults = Optional::Undefined, + PackedArray|ResolvesToArray|BSONArray|array|string $inputs, + Optional|bool|string $useLongestLength = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $defaults = Optional::Undefined, ) { if (is_array($inputs) && ! array_is_list($inputs)) { throw new InvalidArgumentException('Expected $inputs argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/BoxOperator.php b/src/Builder/Query/BoxOperator.php index cce9cf8d8..cae925244 100644 --- a/src/Builder/Query/BoxOperator.php +++ b/src/Builder/Query/BoxOperator.php @@ -30,13 +30,13 @@ final class BoxOperator implements GeometryInterface, OperatorInterface public const NAME = '$box'; public const PROPERTIES = ['value' => 'value']; - /** @var BSONArray|PackedArray|array $value */ - public readonly PackedArray|BSONArray|array $value; + /** @var BSONArray|PackedArray|array|string $value */ + public readonly PackedArray|BSONArray|array|string $value; /** - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public function __construct(PackedArray|BSONArray|array $value) + public function __construct(PackedArray|BSONArray|array|string $value) { if (is_array($value) && ! array_is_list($value)) { throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/CenterOperator.php b/src/Builder/Query/CenterOperator.php index f3a0b890a..b8a17e0a5 100644 --- a/src/Builder/Query/CenterOperator.php +++ b/src/Builder/Query/CenterOperator.php @@ -30,13 +30,13 @@ final class CenterOperator implements GeometryInterface, OperatorInterface public const NAME = '$center'; public const PROPERTIES = ['value' => 'value']; - /** @var BSONArray|PackedArray|array $value */ - public readonly PackedArray|BSONArray|array $value; + /** @var BSONArray|PackedArray|array|string $value */ + public readonly PackedArray|BSONArray|array|string $value; /** - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public function __construct(PackedArray|BSONArray|array $value) + public function __construct(PackedArray|BSONArray|array|string $value) { if (is_array($value) && ! array_is_list($value)) { throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/CenterSphereOperator.php b/src/Builder/Query/CenterSphereOperator.php index 350f535f0..7439ba7f2 100644 --- a/src/Builder/Query/CenterSphereOperator.php +++ b/src/Builder/Query/CenterSphereOperator.php @@ -30,13 +30,13 @@ final class CenterSphereOperator implements GeometryInterface, OperatorInterface public const NAME = '$centerSphere'; public const PROPERTIES = ['value' => 'value']; - /** @var BSONArray|PackedArray|array $value */ - public readonly PackedArray|BSONArray|array $value; + /** @var BSONArray|PackedArray|array|string $value */ + public readonly PackedArray|BSONArray|array|string $value; /** - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public function __construct(PackedArray|BSONArray|array $value) + public function __construct(PackedArray|BSONArray|array|string $value) { if (is_array($value) && ! array_is_list($value)) { throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/ExistsOperator.php b/src/Builder/Query/ExistsOperator.php index 1d0b0a292..911270026 100644 --- a/src/Builder/Query/ExistsOperator.php +++ b/src/Builder/Query/ExistsOperator.php @@ -24,13 +24,13 @@ final class ExistsOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$exists'; public const PROPERTIES = ['exists' => 'exists']; - /** @var bool $exists */ - public readonly bool $exists; + /** @var bool|string $exists */ + public readonly bool|string $exists; /** - * @param bool $exists + * @param bool|string $exists */ - public function __construct(bool $exists = true) + public function __construct(bool|string $exists = true) { $this->exists = $exists; } diff --git a/src/Builder/Query/FactoryTrait.php b/src/Builder/Query/FactoryTrait.php index 9c11b0795..9b8164467 100644 --- a/src/Builder/Query/FactoryTrait.php +++ b/src/Builder/Query/FactoryTrait.php @@ -104,9 +104,9 @@ public static function bitsAnySet(Binary|PackedArray|BSONArray|array|int|string * Specifies a rectangular box using legacy coordinate pairs for $geoWithin queries. The 2d index supports $box. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/box/ - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public static function box(PackedArray|BSONArray|array $value): BoxOperator + public static function box(PackedArray|BSONArray|array|string $value): BoxOperator { return new BoxOperator($value); } @@ -115,9 +115,9 @@ public static function box(PackedArray|BSONArray|array $value): BoxOperator * Specifies a circle using legacy coordinate pairs to $geoWithin queries when using planar geometry. The 2d index supports $center. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/center/ - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public static function center(PackedArray|BSONArray|array $value): CenterOperator + public static function center(PackedArray|BSONArray|array|string $value): CenterOperator { return new CenterOperator($value); } @@ -126,9 +126,9 @@ public static function center(PackedArray|BSONArray|array $value): CenterOperato * Specifies a circle using either legacy coordinate pairs or GeoJSON format for $geoWithin queries when using spherical geometry. The 2dsphere and 2d indexes support $centerSphere. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/centerSphere/ - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public static function centerSphere(PackedArray|BSONArray|array $value): CenterSphereOperator + public static function centerSphere(PackedArray|BSONArray|array|string $value): CenterSphereOperator { return new CenterSphereOperator($value); } @@ -171,9 +171,9 @@ public static function eq(Type|stdClass|array|bool|float|int|null|string $value) * Matches documents that have the specified field. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/exists/ - * @param bool $exists + * @param bool|string $exists */ - public static function exists(bool $exists = true): ExistsOperator + public static function exists(bool|string $exists = true): ExistsOperator { return new ExistsOperator($exists); } @@ -207,13 +207,13 @@ public static function geoIntersects( * * @see https://www.mongodb.com/docs/manual/reference/operator/query/geometry/ * @param string $type - * @param BSONArray|PackedArray|array $coordinates - * @param Optional|Document|Serializable|array|stdClass $crs + * @param BSONArray|PackedArray|array|string $coordinates + * @param Optional|Document|Serializable|array|stdClass|string $crs */ public static function geometry( string $type, - PackedArray|BSONArray|array $coordinates, - Optional|Document|Serializable|stdClass|array $crs = Optional::Undefined, + PackedArray|BSONArray|array|string $coordinates, + Optional|Document|Serializable|stdClass|array|string $crs = Optional::Undefined, ): GeometryOperator { return new GeometryOperator($type, $coordinates, $crs); } @@ -256,9 +256,9 @@ public static function gte(Type|stdClass|array|bool|float|int|null|string $value * Matches any of the values specified in an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/in/ - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public static function in(PackedArray|BSONArray|array $value): InOperator + public static function in(PackedArray|BSONArray|array|string $value): InOperator { return new InOperator($value); } @@ -267,9 +267,9 @@ public static function in(PackedArray|BSONArray|array $value): InOperator * Validate documents against the given JSON Schema. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/jsonSchema/ - * @param Document|Serializable|array|stdClass $schema + * @param Document|Serializable|array|stdClass|string $schema */ - public static function jsonSchema(Document|Serializable|stdClass|array $schema): JsonSchemaOperator + public static function jsonSchema(Document|Serializable|stdClass|array|string $schema): JsonSchemaOperator { return new JsonSchemaOperator($schema); } @@ -300,9 +300,9 @@ public static function lte(Type|stdClass|array|bool|float|int|null|string $value * Specifies a maximum distance to limit the results of $near and $nearSphere queries. The 2dsphere and 2d indexes support $maxDistance. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/maxDistance/ - * @param Decimal128|Int64|float|int $value + * @param Decimal128|Int64|float|int|string $value */ - public static function maxDistance(Decimal128|Int64|float|int $value): MaxDistanceOperator + public static function maxDistance(Decimal128|Int64|float|int|string $value): MaxDistanceOperator { return new MaxDistanceOperator($value); } @@ -311,9 +311,9 @@ public static function maxDistance(Decimal128|Int64|float|int $value): MaxDistan * Specifies a minimum distance to limit the results of $near and $nearSphere queries. For use with 2dsphere index only. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/minDistance/ - * @param Int64|float|int $value + * @param Int64|float|int|string $value */ - public static function minDistance(Int64|float|int $value): MinDistanceOperator + public static function minDistance(Int64|float|int|string $value): MinDistanceOperator { return new MinDistanceOperator($value); } @@ -322,12 +322,12 @@ public static function minDistance(Int64|float|int $value): MinDistanceOperator * Performs a modulo operation on the value of a field and selects documents with a specified result. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/mod/ - * @param Decimal128|Int64|float|int $divisor - * @param Decimal128|Int64|float|int $remainder + * @param Decimal128|Int64|float|int|string $divisor + * @param Decimal128|Int64|float|int|string $remainder */ public static function mod( - Decimal128|Int64|float|int $divisor, - Decimal128|Int64|float|int $remainder, + Decimal128|Int64|float|int|string $divisor, + Decimal128|Int64|float|int|string $remainder, ): ModOperator { return new ModOperator($divisor, $remainder); } @@ -348,13 +348,13 @@ public static function ne(Type|stdClass|array|bool|float|int|null|string $value) * * @see https://www.mongodb.com/docs/manual/reference/operator/query/near/ * @param Document|GeometryInterface|Serializable|array|stdClass $geometry - * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. - * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ public static function near( Document|Serializable|GeometryInterface|stdClass|array $geometry, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, ): NearOperator { return new NearOperator($geometry, $maxDistance, $minDistance); } @@ -364,13 +364,13 @@ public static function near( * * @see https://www.mongodb.com/docs/manual/reference/operator/query/nearSphere/ * @param Document|GeometryInterface|Serializable|array|stdClass $geometry - * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. - * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. + * @param Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ public static function nearSphere( Document|Serializable|GeometryInterface|stdClass|array $geometry, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, ): NearSphereOperator { return new NearSphereOperator($geometry, $maxDistance, $minDistance); } @@ -379,9 +379,9 @@ public static function nearSphere( * Matches none of the values specified in an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/nin/ - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public static function nin(PackedArray|BSONArray|array $value): NinOperator + public static function nin(PackedArray|BSONArray|array|string $value): NinOperator { return new NinOperator($value); } @@ -426,9 +426,9 @@ public static function or(QueryInterface|array ...$queries): OrOperator * Specifies a polygon to using legacy coordinate pairs for $geoWithin queries. The 2d index supports $center. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/polygon/ - * @param BSONArray|PackedArray|array $points + * @param BSONArray|PackedArray|array|string $points */ - public static function polygon(PackedArray|BSONArray|array $points): PolygonOperator + public static function polygon(PackedArray|BSONArray|array|string $points): PolygonOperator { return new PolygonOperator($points); } @@ -447,9 +447,9 @@ public static function rand(): RandOperator * Selects documents where values match a specified regular expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/regex/ - * @param Regex $regex + * @param Regex|string $regex */ - public static function regex(Regex $regex): RegexOperator + public static function regex(Regex|string $regex): RegexOperator { return new RegexOperator($regex); } @@ -458,10 +458,10 @@ public static function regex(Regex $regex): RegexOperator * Randomly select documents at a given rate. Although the exact number of documents selected varies on each run, the quantity chosen approximates the sample rate expressed as a percentage of the total number of documents. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sampleRate/ - * @param Int64|ResolvesToDouble|float|int $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + * @param Int64|ResolvesToDouble|float|int|string $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. * For example, a sample rate of 0.33 selects roughly one document in three. */ - public static function sampleRate(Int64|ResolvesToDouble|float|int $rate): SampleRateOperator + public static function sampleRate(Int64|ResolvesToDouble|float|int|string $rate): SampleRateOperator { return new SampleRateOperator($rate); } @@ -470,9 +470,9 @@ public static function sampleRate(Int64|ResolvesToDouble|float|int $rate): Sampl * Selects documents if the array field is a specified size. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/size/ - * @param int $value + * @param int|string $value */ - public static function size(int $value): SizeOperator + public static function size(int|string $value): SizeOperator { return new SizeOperator($value); } @@ -484,15 +484,15 @@ public static function size(int $value): SizeOperator * @param string $search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase. * @param Optional|string $language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. * If you specify a default_language value of none, then the text index parses through each word in the field, including stop words, and ignores suffix stemming. - * @param Optional|bool $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. - * @param Optional|bool $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + * @param Optional|bool|string $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. + * @param Optional|bool|string $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. * Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. */ public static function text( string $search, Optional|string $language = Optional::Undefined, - Optional|bool $caseSensitive = Optional::Undefined, - Optional|bool $diacriticSensitive = Optional::Undefined, + Optional|bool|string $caseSensitive = Optional::Undefined, + Optional|bool|string $diacriticSensitive = Optional::Undefined, ): TextOperator { return new TextOperator($search, $language, $caseSensitive, $diacriticSensitive); } diff --git a/src/Builder/Query/GeometryOperator.php b/src/Builder/Query/GeometryOperator.php index fe52be973..cfcf8302c 100644 --- a/src/Builder/Query/GeometryOperator.php +++ b/src/Builder/Query/GeometryOperator.php @@ -37,21 +37,21 @@ final class GeometryOperator implements GeometryInterface, OperatorInterface /** @var string $type */ public readonly string $type; - /** @var BSONArray|PackedArray|array $coordinates */ - public readonly PackedArray|BSONArray|array $coordinates; + /** @var BSONArray|PackedArray|array|string $coordinates */ + public readonly PackedArray|BSONArray|array|string $coordinates; - /** @var Optional|Document|Serializable|array|stdClass $crs */ - public readonly Optional|Document|Serializable|stdClass|array $crs; + /** @var Optional|Document|Serializable|array|stdClass|string $crs */ + public readonly Optional|Document|Serializable|stdClass|array|string $crs; /** * @param string $type - * @param BSONArray|PackedArray|array $coordinates - * @param Optional|Document|Serializable|array|stdClass $crs + * @param BSONArray|PackedArray|array|string $coordinates + * @param Optional|Document|Serializable|array|stdClass|string $crs */ public function __construct( string $type, - PackedArray|BSONArray|array $coordinates, - Optional|Document|Serializable|stdClass|array $crs = Optional::Undefined, + PackedArray|BSONArray|array|string $coordinates, + Optional|Document|Serializable|stdClass|array|string $crs = Optional::Undefined, ) { $this->type = $type; if (is_array($coordinates) && ! array_is_list($coordinates)) { diff --git a/src/Builder/Query/InOperator.php b/src/Builder/Query/InOperator.php index e6f1456a4..177c52f81 100644 --- a/src/Builder/Query/InOperator.php +++ b/src/Builder/Query/InOperator.php @@ -30,13 +30,13 @@ final class InOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$in'; public const PROPERTIES = ['value' => 'value']; - /** @var BSONArray|PackedArray|array $value */ - public readonly PackedArray|BSONArray|array $value; + /** @var BSONArray|PackedArray|array|string $value */ + public readonly PackedArray|BSONArray|array|string $value; /** - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public function __construct(PackedArray|BSONArray|array $value) + public function __construct(PackedArray|BSONArray|array|string $value) { if (is_array($value) && ! array_is_list($value)) { throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/JsonSchemaOperator.php b/src/Builder/Query/JsonSchemaOperator.php index 3dc8b918e..bfd6d5d41 100644 --- a/src/Builder/Query/JsonSchemaOperator.php +++ b/src/Builder/Query/JsonSchemaOperator.php @@ -27,13 +27,13 @@ final class JsonSchemaOperator implements QueryInterface, OperatorInterface public const NAME = '$jsonSchema'; public const PROPERTIES = ['schema' => 'schema']; - /** @var Document|Serializable|array|stdClass $schema */ - public readonly Document|Serializable|stdClass|array $schema; + /** @var Document|Serializable|array|stdClass|string $schema */ + public readonly Document|Serializable|stdClass|array|string $schema; /** - * @param Document|Serializable|array|stdClass $schema + * @param Document|Serializable|array|stdClass|string $schema */ - public function __construct(Document|Serializable|stdClass|array $schema) + public function __construct(Document|Serializable|stdClass|array|string $schema) { $this->schema = $schema; } diff --git a/src/Builder/Query/MaxDistanceOperator.php b/src/Builder/Query/MaxDistanceOperator.php index 2aea7d4c8..4dd2b4516 100644 --- a/src/Builder/Query/MaxDistanceOperator.php +++ b/src/Builder/Query/MaxDistanceOperator.php @@ -26,13 +26,13 @@ final class MaxDistanceOperator implements FieldQueryInterface, OperatorInterfac public const NAME = '$maxDistance'; public const PROPERTIES = ['value' => 'value']; - /** @var Decimal128|Int64|float|int $value */ - public readonly Decimal128|Int64|float|int $value; + /** @var Decimal128|Int64|float|int|string $value */ + public readonly Decimal128|Int64|float|int|string $value; /** - * @param Decimal128|Int64|float|int $value + * @param Decimal128|Int64|float|int|string $value */ - public function __construct(Decimal128|Int64|float|int $value) + public function __construct(Decimal128|Int64|float|int|string $value) { $this->value = $value; } diff --git a/src/Builder/Query/MinDistanceOperator.php b/src/Builder/Query/MinDistanceOperator.php index 74aadb397..6940699db 100644 --- a/src/Builder/Query/MinDistanceOperator.php +++ b/src/Builder/Query/MinDistanceOperator.php @@ -25,13 +25,13 @@ final class MinDistanceOperator implements FieldQueryInterface, OperatorInterfac public const NAME = '$minDistance'; public const PROPERTIES = ['value' => 'value']; - /** @var Int64|float|int $value */ - public readonly Int64|float|int $value; + /** @var Int64|float|int|string $value */ + public readonly Int64|float|int|string $value; /** - * @param Int64|float|int $value + * @param Int64|float|int|string $value */ - public function __construct(Int64|float|int $value) + public function __construct(Int64|float|int|string $value) { $this->value = $value; } diff --git a/src/Builder/Query/ModOperator.php b/src/Builder/Query/ModOperator.php index bbabdfdc9..0c272f109 100644 --- a/src/Builder/Query/ModOperator.php +++ b/src/Builder/Query/ModOperator.php @@ -26,18 +26,20 @@ final class ModOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$mod'; public const PROPERTIES = ['divisor' => 'divisor', 'remainder' => 'remainder']; - /** @var Decimal128|Int64|float|int $divisor */ - public readonly Decimal128|Int64|float|int $divisor; + /** @var Decimal128|Int64|float|int|string $divisor */ + public readonly Decimal128|Int64|float|int|string $divisor; - /** @var Decimal128|Int64|float|int $remainder */ - public readonly Decimal128|Int64|float|int $remainder; + /** @var Decimal128|Int64|float|int|string $remainder */ + public readonly Decimal128|Int64|float|int|string $remainder; /** - * @param Decimal128|Int64|float|int $divisor - * @param Decimal128|Int64|float|int $remainder + * @param Decimal128|Int64|float|int|string $divisor + * @param Decimal128|Int64|float|int|string $remainder */ - public function __construct(Decimal128|Int64|float|int $divisor, Decimal128|Int64|float|int $remainder) - { + public function __construct( + Decimal128|Int64|float|int|string $divisor, + Decimal128|Int64|float|int|string $remainder, + ) { $this->divisor = $divisor; $this->remainder = $remainder; } diff --git a/src/Builder/Query/NearOperator.php b/src/Builder/Query/NearOperator.php index 85be90ac4..2b486a9db 100644 --- a/src/Builder/Query/NearOperator.php +++ b/src/Builder/Query/NearOperator.php @@ -34,21 +34,21 @@ final class NearOperator implements FieldQueryInterface, OperatorInterface /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; - /** @var Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. */ - public readonly Optional|Decimal128|Int64|float|int $maxDistance; + /** @var Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int|string $maxDistance; - /** @var Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ - public readonly Optional|Decimal128|Int64|float|int $minDistance; + /** @var Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int|string $minDistance; /** * @param Document|GeometryInterface|Serializable|array|stdClass $geometry - * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. - * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. Limits the results to those documents that are at most the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ public function __construct( Document|Serializable|GeometryInterface|stdClass|array $geometry, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, ) { $this->geometry = $geometry; $this->maxDistance = $maxDistance; diff --git a/src/Builder/Query/NearSphereOperator.php b/src/Builder/Query/NearSphereOperator.php index 5494048b0..ba3012cca 100644 --- a/src/Builder/Query/NearSphereOperator.php +++ b/src/Builder/Query/NearSphereOperator.php @@ -34,21 +34,21 @@ final class NearSphereOperator implements FieldQueryInterface, OperatorInterface /** @var Document|GeometryInterface|Serializable|array|stdClass $geometry */ public readonly Document|Serializable|GeometryInterface|stdClass|array $geometry; - /** @var Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. */ - public readonly Optional|Decimal128|Int64|float|int $maxDistance; + /** @var Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. */ + public readonly Optional|Decimal128|Int64|float|int|string $maxDistance; - /** @var Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ - public readonly Optional|Decimal128|Int64|float|int $minDistance; + /** @var Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ + public readonly Optional|Decimal128|Int64|float|int|string $minDistance; /** * @param Document|GeometryInterface|Serializable|array|stdClass $geometry - * @param Optional|Decimal128|Int64|float|int $maxDistance Distance in meters. - * @param Optional|Decimal128|Int64|float|int $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance Distance in meters. + * @param Optional|Decimal128|Int64|float|int|string $minDistance Distance in meters. Limits the results to those documents that are at least the specified distance from the center point. */ public function __construct( Document|Serializable|GeometryInterface|stdClass|array $geometry, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, ) { $this->geometry = $geometry; $this->maxDistance = $maxDistance; diff --git a/src/Builder/Query/NinOperator.php b/src/Builder/Query/NinOperator.php index 5c82c3fd8..bad42a7e5 100644 --- a/src/Builder/Query/NinOperator.php +++ b/src/Builder/Query/NinOperator.php @@ -30,13 +30,13 @@ final class NinOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$nin'; public const PROPERTIES = ['value' => 'value']; - /** @var BSONArray|PackedArray|array $value */ - public readonly PackedArray|BSONArray|array $value; + /** @var BSONArray|PackedArray|array|string $value */ + public readonly PackedArray|BSONArray|array|string $value; /** - * @param BSONArray|PackedArray|array $value + * @param BSONArray|PackedArray|array|string $value */ - public function __construct(PackedArray|BSONArray|array $value) + public function __construct(PackedArray|BSONArray|array|string $value) { if (is_array($value) && ! array_is_list($value)) { throw new InvalidArgumentException('Expected $value argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/PolygonOperator.php b/src/Builder/Query/PolygonOperator.php index bba3aac08..e05d8838f 100644 --- a/src/Builder/Query/PolygonOperator.php +++ b/src/Builder/Query/PolygonOperator.php @@ -30,13 +30,13 @@ final class PolygonOperator implements GeometryInterface, OperatorInterface public const NAME = '$polygon'; public const PROPERTIES = ['points' => 'points']; - /** @var BSONArray|PackedArray|array $points */ - public readonly PackedArray|BSONArray|array $points; + /** @var BSONArray|PackedArray|array|string $points */ + public readonly PackedArray|BSONArray|array|string $points; /** - * @param BSONArray|PackedArray|array $points + * @param BSONArray|PackedArray|array|string $points */ - public function __construct(PackedArray|BSONArray|array $points) + public function __construct(PackedArray|BSONArray|array|string $points) { if (is_array($points) && ! array_is_list($points)) { throw new InvalidArgumentException('Expected $points argument to be a list, got an associative array.'); diff --git a/src/Builder/Query/RegexOperator.php b/src/Builder/Query/RegexOperator.php index cf9ee31ff..2082cb8cd 100644 --- a/src/Builder/Query/RegexOperator.php +++ b/src/Builder/Query/RegexOperator.php @@ -25,13 +25,13 @@ final class RegexOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$regex'; public const PROPERTIES = ['regex' => 'regex']; - /** @var Regex $regex */ - public readonly Regex $regex; + /** @var Regex|string $regex */ + public readonly Regex|string $regex; /** - * @param Regex $regex + * @param Regex|string $regex */ - public function __construct(Regex $regex) + public function __construct(Regex|string $regex) { $this->regex = $regex; } diff --git a/src/Builder/Query/SampleRateOperator.php b/src/Builder/Query/SampleRateOperator.php index 42879cead..692a42436 100644 --- a/src/Builder/Query/SampleRateOperator.php +++ b/src/Builder/Query/SampleRateOperator.php @@ -27,16 +27,16 @@ final class SampleRateOperator implements QueryInterface, OperatorInterface public const PROPERTIES = ['rate' => 'rate']; /** - * @var Int64|ResolvesToDouble|float|int $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + * @var Int64|ResolvesToDouble|float|int|string $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. * For example, a sample rate of 0.33 selects roughly one document in three. */ - public readonly Int64|ResolvesToDouble|float|int $rate; + public readonly Int64|ResolvesToDouble|float|int|string $rate; /** - * @param Int64|ResolvesToDouble|float|int $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. + * @param Int64|ResolvesToDouble|float|int|string $rate The selection process uses a uniform random distribution. The sample rate is a floating point number between 0 and 1, inclusive, which represents the probability that a given document will be selected as it passes through the pipeline. * For example, a sample rate of 0.33 selects roughly one document in three. */ - public function __construct(Int64|ResolvesToDouble|float|int $rate) + public function __construct(Int64|ResolvesToDouble|float|int|string $rate) { $this->rate = $rate; } diff --git a/src/Builder/Query/SizeOperator.php b/src/Builder/Query/SizeOperator.php index 8ec123b11..2b080954c 100644 --- a/src/Builder/Query/SizeOperator.php +++ b/src/Builder/Query/SizeOperator.php @@ -24,13 +24,13 @@ final class SizeOperator implements FieldQueryInterface, OperatorInterface public const NAME = '$size'; public const PROPERTIES = ['value' => 'value']; - /** @var int $value */ - public readonly int $value; + /** @var int|string $value */ + public readonly int|string $value; /** - * @param int $value + * @param int|string $value */ - public function __construct(int $value) + public function __construct(int|string $value) { $this->value = $value; } diff --git a/src/Builder/Query/TextOperator.php b/src/Builder/Query/TextOperator.php index 7c1c0a7ba..efdf46423 100644 --- a/src/Builder/Query/TextOperator.php +++ b/src/Builder/Query/TextOperator.php @@ -40,28 +40,28 @@ final class TextOperator implements QueryInterface, OperatorInterface */ public readonly Optional|string $language; - /** @var Optional|bool $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. */ - public readonly Optional|bool $caseSensitive; + /** @var Optional|bool|string $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. */ + public readonly Optional|bool|string $caseSensitive; /** - * @var Optional|bool $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + * @var Optional|bool|string $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. * Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. */ - public readonly Optional|bool $diacriticSensitive; + public readonly Optional|bool|string $diacriticSensitive; /** * @param string $search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase. * @param Optional|string $language The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. * If you specify a default_language value of none, then the text index parses through each word in the field, including stop words, and ignores suffix stemming. - * @param Optional|bool $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. - * @param Optional|bool $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. + * @param Optional|bool|string $caseSensitive A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index. + * @param Optional|bool|string $diacriticSensitive A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. * Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index. */ public function __construct( string $search, Optional|string $language = Optional::Undefined, - Optional|bool $caseSensitive = Optional::Undefined, - Optional|bool $diacriticSensitive = Optional::Undefined, + Optional|bool|string $caseSensitive = Optional::Undefined, + Optional|bool|string $diacriticSensitive = Optional::Undefined, ) { $this->search = $search; $this->language = $language; diff --git a/src/Builder/Search/AutocompleteOperator.php b/src/Builder/Search/AutocompleteOperator.php index 19bdbf92d..bf0431cbd 100644 --- a/src/Builder/Search/AutocompleteOperator.php +++ b/src/Builder/Search/AutocompleteOperator.php @@ -47,8 +47,8 @@ final class AutocompleteOperator implements SearchOperatorInterface, OperatorInt /** @var Optional|string $tokenOrder */ public readonly Optional|string $tokenOrder; - /** @var Optional|Document|Serializable|array|stdClass $fuzzy */ - public readonly Optional|Document|Serializable|stdClass|array $fuzzy; + /** @var Optional|Document|Serializable|array|stdClass|string $fuzzy */ + public readonly Optional|Document|Serializable|stdClass|array|string $fuzzy; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; @@ -57,14 +57,14 @@ final class AutocompleteOperator implements SearchOperatorInterface, OperatorInt * @param array|string $path * @param string $query * @param Optional|string $tokenOrder - * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|Document|Serializable|array|stdClass|string $fuzzy * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, string $query, Optional|string $tokenOrder = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $fuzzy = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->path = $path; diff --git a/src/Builder/Search/CompoundOperator.php b/src/Builder/Search/CompoundOperator.php index 27b8c2aeb..4655c85b5 100644 --- a/src/Builder/Search/CompoundOperator.php +++ b/src/Builder/Search/CompoundOperator.php @@ -40,38 +40,38 @@ final class CompoundOperator implements SearchOperatorInterface, OperatorInterfa 'score' => 'score', ]; - /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $must */ - public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $must; + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $must */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $must; - /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $mustNot */ - public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $mustNot; + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $mustNot */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $mustNot; - /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $should */ - public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $should; + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $should */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $should; - /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $filter */ - public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $filter; + /** @var Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $filter */ + public readonly Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $filter; - /** @var Optional|int $minimumShouldMatch */ - public readonly Optional|int $minimumShouldMatch; + /** @var Optional|int|string $minimumShouldMatch */ + public readonly Optional|int|string $minimumShouldMatch; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; /** - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $must - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $mustNot - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $should - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $filter - * @param Optional|int $minimumShouldMatch + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $must + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $mustNot + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $should + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $filter + * @param Optional|int|string $minimumShouldMatch * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $must = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $mustNot = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $should = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $filter = Optional::Undefined, - Optional|int $minimumShouldMatch = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $must = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $mustNot = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $should = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $filter = Optional::Undefined, + Optional|int|string $minimumShouldMatch = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->must = $must; diff --git a/src/Builder/Search/FacetOperator.php b/src/Builder/Search/FacetOperator.php index 15fc10830..b2643b117 100644 --- a/src/Builder/Search/FacetOperator.php +++ b/src/Builder/Search/FacetOperator.php @@ -29,18 +29,18 @@ final class FacetOperator implements SearchOperatorInterface, OperatorInterface public const NAME = 'facet'; public const PROPERTIES = ['facets' => 'facets', 'operator' => 'operator']; - /** @var Document|Serializable|array|stdClass $facets */ - public readonly Document|Serializable|stdClass|array $facets; + /** @var Document|Serializable|array|stdClass|string $facets */ + public readonly Document|Serializable|stdClass|array|string $facets; /** @var Optional|Document|SearchOperatorInterface|Serializable|array|stdClass $operator */ public readonly Optional|Document|Serializable|SearchOperatorInterface|stdClass|array $operator; /** - * @param Document|Serializable|array|stdClass $facets + * @param Document|Serializable|array|stdClass|string $facets * @param Optional|Document|SearchOperatorInterface|Serializable|array|stdClass $operator */ public function __construct( - Document|Serializable|stdClass|array $facets, + Document|Serializable|stdClass|array|string $facets, Optional|Document|Serializable|SearchOperatorInterface|stdClass|array $operator = Optional::Undefined, ) { $this->facets = $facets; diff --git a/src/Builder/Search/FactoryTrait.php b/src/Builder/Search/FactoryTrait.php index 3a7762521..9eb7103a4 100644 --- a/src/Builder/Search/FactoryTrait.php +++ b/src/Builder/Search/FactoryTrait.php @@ -38,14 +38,14 @@ trait FactoryTrait * @param array|string $path * @param string $query * @param Optional|string $tokenOrder - * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|Document|Serializable|array|stdClass|string $fuzzy * @param Optional|Document|Serializable|array|stdClass $score */ public static function autocomplete( array|string $path, string $query, Optional|string $tokenOrder = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $fuzzy = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): AutocompleteOperator { return new AutocompleteOperator($path, $query, $tokenOrder, $fuzzy, $score); @@ -57,19 +57,19 @@ public static function autocomplete( * consists of one or more sub-queries. * * @see https://www.mongodb.com/docs/atlas/atlas-search/compound/ - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $must - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $mustNot - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $should - * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass $filter - * @param Optional|int $minimumShouldMatch + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $must + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $mustNot + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $should + * @param Optional|BSONArray|Document|PackedArray|SearchOperatorInterface|Serializable|array|stdClass|string $filter + * @param Optional|int|string $minimumShouldMatch * @param Optional|Document|Serializable|array|stdClass $score */ public static function compound( - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $must = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $mustNot = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $should = Optional::Undefined, - Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array $filter = Optional::Undefined, - Optional|int $minimumShouldMatch = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $must = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $mustNot = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $should = Optional::Undefined, + Optional|Document|PackedArray|Serializable|SearchOperatorInterface|BSONArray|stdClass|array|string $filter = Optional::Undefined, + Optional|int|string $minimumShouldMatch = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): CompoundOperator { return new CompoundOperator($must, $mustNot, $should, $filter, $minimumShouldMatch, $score); @@ -129,11 +129,11 @@ public static function exists( * faceted fields and returns the count for each of those groups. * * @see https://www.mongodb.com/docs/atlas/atlas-search/facet/ - * @param Document|Serializable|array|stdClass $facets + * @param Document|Serializable|array|stdClass|string $facets * @param Optional|Document|SearchOperatorInterface|Serializable|array|stdClass $operator */ public static function facet( - Document|Serializable|stdClass|array $facets, + Document|Serializable|stdClass|array|string $facets, Optional|Document|Serializable|SearchOperatorInterface|stdClass|array $operator = Optional::Undefined, ): FacetOperator { return new FacetOperator($facets, $operator); @@ -165,15 +165,15 @@ public static function geoShape( * * @see https://www.mongodb.com/docs/atlas/atlas-search/geoWithin/ * @param array|string $path - * @param Optional|Document|Serializable|array|stdClass $box - * @param Optional|Document|Serializable|array|stdClass $circle + * @param Optional|Document|Serializable|array|stdClass|string $box + * @param Optional|Document|Serializable|array|stdClass|string $circle * @param Optional|Document|GeometryInterface|Serializable|array|stdClass $geometry * @param Optional|Document|Serializable|array|stdClass $score */ public static function geoWithin( array|string $path, - Optional|Document|Serializable|stdClass|array $box = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $circle = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $box = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $circle = Optional::Undefined, Optional|Document|Serializable|GeometryInterface|stdClass|array $geometry = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): GeoWithinOperator { @@ -202,11 +202,11 @@ public static function in( * that display similar or alternative results based on one or more given documents. * * @see https://www.mongodb.com/docs/atlas/atlas-search/moreLikeThis/ - * @param BSONArray|Document|PackedArray|Serializable|array|stdClass $like + * @param BSONArray|Document|PackedArray|Serializable|array|stdClass|string $like * @param Optional|Document|Serializable|array|stdClass $score */ public static function moreLikeThis( - Document|PackedArray|Serializable|BSONArray|stdClass|array $like, + Document|PackedArray|Serializable|BSONArray|stdClass|array|string $like, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): MoreLikeThisOperator { return new MoreLikeThisOperator($like, $score); @@ -217,14 +217,14 @@ public static function moreLikeThis( * * @see https://www.mongodb.com/docs/atlas/atlas-search/near/ * @param array|string $path - * @param Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass $origin - * @param Decimal128|Int64|float|int $pivot + * @param Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass|string $origin + * @param Decimal128|Int64|float|int|string $pivot * @param Optional|Document|Serializable|array|stdClass $score */ public static function near( array|string $path, - Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int $origin, - Decimal128|Int64|float|int $pivot, + Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int|string $origin, + Decimal128|Int64|float|int|string $pivot, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): NearOperator { return new NearOperator($path, $origin, $pivot, $score); @@ -236,14 +236,14 @@ public static function near( * @see https://www.mongodb.com/docs/atlas/atlas-search/phrase/ * @param array|string $path * @param BSONArray|PackedArray|array|string $query - * @param Optional|int $slop + * @param Optional|int|string $slop * @param Optional|string $synonyms * @param Optional|Document|Serializable|array|stdClass $score */ public static function phrase( array|string $path, PackedArray|BSONArray|array|string $query, - Optional|int $slop = Optional::Undefined, + Optional|int|string $slop = Optional::Undefined, Optional|string $synonyms = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): PhraseOperator { @@ -290,13 +290,13 @@ public static function range( * @see https://www.mongodb.com/docs/atlas/atlas-search/regex/ * @param array|string $path * @param string $query - * @param Optional|bool $allowAnalyzedField + * @param Optional|bool|string $allowAnalyzedField * @param Optional|Document|Serializable|array|stdClass $score */ public static function regex( array|string $path, string $query, - Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|bool|string $allowAnalyzedField = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): RegexOperator { return new RegexOperator($path, $query, $allowAnalyzedField, $score); @@ -309,7 +309,7 @@ public static function regex( * @see https://www.mongodb.com/docs/atlas/atlas-search/text/ * @param array|string $path * @param string $query - * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|Document|Serializable|array|stdClass|string $fuzzy * @param Optional|string $matchCriteria * @param Optional|string $synonyms * @param Optional|Document|Serializable|array|stdClass $score @@ -317,7 +317,7 @@ public static function regex( public static function text( array|string $path, string $query, - Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $fuzzy = Optional::Undefined, Optional|string $matchCriteria = Optional::Undefined, Optional|string $synonyms = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, @@ -331,13 +331,13 @@ public static function text( * @see https://www.mongodb.com/docs/atlas/atlas-search/wildcard/ * @param array|string $path * @param string $query - * @param Optional|bool $allowAnalyzedField + * @param Optional|bool|string $allowAnalyzedField * @param Optional|Document|Serializable|array|stdClass $score */ public static function wildcard( array|string $path, string $query, - Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|bool|string $allowAnalyzedField = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ): WildcardOperator { return new WildcardOperator($path, $query, $allowAnalyzedField, $score); diff --git a/src/Builder/Search/GeoWithinOperator.php b/src/Builder/Search/GeoWithinOperator.php index dcf605697..7efec6aff 100644 --- a/src/Builder/Search/GeoWithinOperator.php +++ b/src/Builder/Search/GeoWithinOperator.php @@ -41,11 +41,11 @@ final class GeoWithinOperator implements SearchOperatorInterface, OperatorInterf /** @var array|string $path */ public readonly array|string $path; - /** @var Optional|Document|Serializable|array|stdClass $box */ - public readonly Optional|Document|Serializable|stdClass|array $box; + /** @var Optional|Document|Serializable|array|stdClass|string $box */ + public readonly Optional|Document|Serializable|stdClass|array|string $box; - /** @var Optional|Document|Serializable|array|stdClass $circle */ - public readonly Optional|Document|Serializable|stdClass|array $circle; + /** @var Optional|Document|Serializable|array|stdClass|string $circle */ + public readonly Optional|Document|Serializable|stdClass|array|string $circle; /** @var Optional|Document|GeometryInterface|Serializable|array|stdClass $geometry */ public readonly Optional|Document|Serializable|GeometryInterface|stdClass|array $geometry; @@ -55,15 +55,15 @@ final class GeoWithinOperator implements SearchOperatorInterface, OperatorInterf /** * @param array|string $path - * @param Optional|Document|Serializable|array|stdClass $box - * @param Optional|Document|Serializable|array|stdClass $circle + * @param Optional|Document|Serializable|array|stdClass|string $box + * @param Optional|Document|Serializable|array|stdClass|string $circle * @param Optional|Document|GeometryInterface|Serializable|array|stdClass $geometry * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, - Optional|Document|Serializable|stdClass|array $box = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $circle = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $box = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $circle = Optional::Undefined, Optional|Document|Serializable|GeometryInterface|stdClass|array $geometry = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { diff --git a/src/Builder/Search/MoreLikeThisOperator.php b/src/Builder/Search/MoreLikeThisOperator.php index 689508d53..cf21a15a3 100644 --- a/src/Builder/Search/MoreLikeThisOperator.php +++ b/src/Builder/Search/MoreLikeThisOperator.php @@ -32,18 +32,18 @@ final class MoreLikeThisOperator implements SearchOperatorInterface, OperatorInt public const NAME = 'moreLikeThis'; public const PROPERTIES = ['like' => 'like', 'score' => 'score']; - /** @var BSONArray|Document|PackedArray|Serializable|array|stdClass $like */ - public readonly Document|PackedArray|Serializable|BSONArray|stdClass|array $like; + /** @var BSONArray|Document|PackedArray|Serializable|array|stdClass|string $like */ + public readonly Document|PackedArray|Serializable|BSONArray|stdClass|array|string $like; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; /** - * @param BSONArray|Document|PackedArray|Serializable|array|stdClass $like + * @param BSONArray|Document|PackedArray|Serializable|array|stdClass|string $like * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( - Document|PackedArray|Serializable|BSONArray|stdClass|array $like, + Document|PackedArray|Serializable|BSONArray|stdClass|array|string $like, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->like = $like; diff --git a/src/Builder/Search/NearOperator.php b/src/Builder/Search/NearOperator.php index ab1b9b0c1..2afa6517d 100644 --- a/src/Builder/Search/NearOperator.php +++ b/src/Builder/Search/NearOperator.php @@ -35,25 +35,25 @@ final class NearOperator implements SearchOperatorInterface, OperatorInterface /** @var array|string $path */ public readonly array|string $path; - /** @var Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass $origin */ - public readonly Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int $origin; + /** @var Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass|string $origin */ + public readonly Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int|string $origin; - /** @var Decimal128|Int64|float|int $pivot */ - public readonly Decimal128|Int64|float|int $pivot; + /** @var Decimal128|Int64|float|int|string $pivot */ + public readonly Decimal128|Int64|float|int|string $pivot; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; /** * @param array|string $path - * @param Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass $origin - * @param Decimal128|Int64|float|int $pivot + * @param Decimal128|Document|GeometryInterface|Int64|Serializable|UTCDateTime|array|float|int|stdClass|string $origin + * @param Decimal128|Int64|float|int|string $pivot * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, - Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int $origin, - Decimal128|Int64|float|int $pivot, + Decimal128|Document|Int64|Serializable|UTCDateTime|GeometryInterface|stdClass|array|float|int|string $origin, + Decimal128|Int64|float|int|string $pivot, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->path = $path; diff --git a/src/Builder/Search/PhraseOperator.php b/src/Builder/Search/PhraseOperator.php index 2bbb707a9..c0303c34c 100644 --- a/src/Builder/Search/PhraseOperator.php +++ b/src/Builder/Search/PhraseOperator.php @@ -47,8 +47,8 @@ final class PhraseOperator implements SearchOperatorInterface, OperatorInterface /** @var BSONArray|PackedArray|array|string $query */ public readonly PackedArray|BSONArray|array|string $query; - /** @var Optional|int $slop */ - public readonly Optional|int $slop; + /** @var Optional|int|string $slop */ + public readonly Optional|int|string $slop; /** @var Optional|string $synonyms */ public readonly Optional|string $synonyms; @@ -59,14 +59,14 @@ final class PhraseOperator implements SearchOperatorInterface, OperatorInterface /** * @param array|string $path * @param BSONArray|PackedArray|array|string $query - * @param Optional|int $slop + * @param Optional|int|string $slop * @param Optional|string $synonyms * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, PackedArray|BSONArray|array|string $query, - Optional|int $slop = Optional::Undefined, + Optional|int|string $slop = Optional::Undefined, Optional|string $synonyms = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { diff --git a/src/Builder/Search/RegexOperator.php b/src/Builder/Search/RegexOperator.php index 6b2c2d63a..3cc88fcff 100644 --- a/src/Builder/Search/RegexOperator.php +++ b/src/Builder/Search/RegexOperator.php @@ -41,8 +41,8 @@ final class RegexOperator implements SearchOperatorInterface, OperatorInterface /** @var string $query */ public readonly string $query; - /** @var Optional|bool $allowAnalyzedField */ - public readonly Optional|bool $allowAnalyzedField; + /** @var Optional|bool|string $allowAnalyzedField */ + public readonly Optional|bool|string $allowAnalyzedField; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; @@ -50,13 +50,13 @@ final class RegexOperator implements SearchOperatorInterface, OperatorInterface /** * @param array|string $path * @param string $query - * @param Optional|bool $allowAnalyzedField + * @param Optional|bool|string $allowAnalyzedField * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, string $query, - Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|bool|string $allowAnalyzedField = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->path = $path; diff --git a/src/Builder/Search/TextOperator.php b/src/Builder/Search/TextOperator.php index 4ade6b434..802672efe 100644 --- a/src/Builder/Search/TextOperator.php +++ b/src/Builder/Search/TextOperator.php @@ -43,8 +43,8 @@ final class TextOperator implements SearchOperatorInterface, OperatorInterface /** @var string $query */ public readonly string $query; - /** @var Optional|Document|Serializable|array|stdClass $fuzzy */ - public readonly Optional|Document|Serializable|stdClass|array $fuzzy; + /** @var Optional|Document|Serializable|array|stdClass|string $fuzzy */ + public readonly Optional|Document|Serializable|stdClass|array|string $fuzzy; /** @var Optional|string $matchCriteria */ public readonly Optional|string $matchCriteria; @@ -58,7 +58,7 @@ final class TextOperator implements SearchOperatorInterface, OperatorInterface /** * @param array|string $path * @param string $query - * @param Optional|Document|Serializable|array|stdClass $fuzzy + * @param Optional|Document|Serializable|array|stdClass|string $fuzzy * @param Optional|string $matchCriteria * @param Optional|string $synonyms * @param Optional|Document|Serializable|array|stdClass $score @@ -66,7 +66,7 @@ final class TextOperator implements SearchOperatorInterface, OperatorInterface public function __construct( array|string $path, string $query, - Optional|Document|Serializable|stdClass|array $fuzzy = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $fuzzy = Optional::Undefined, Optional|string $matchCriteria = Optional::Undefined, Optional|string $synonyms = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, diff --git a/src/Builder/Search/WildcardOperator.php b/src/Builder/Search/WildcardOperator.php index ee481910e..3ed54ed1a 100644 --- a/src/Builder/Search/WildcardOperator.php +++ b/src/Builder/Search/WildcardOperator.php @@ -40,8 +40,8 @@ final class WildcardOperator implements SearchOperatorInterface, OperatorInterfa /** @var string $query */ public readonly string $query; - /** @var Optional|bool $allowAnalyzedField */ - public readonly Optional|bool $allowAnalyzedField; + /** @var Optional|bool|string $allowAnalyzedField */ + public readonly Optional|bool|string $allowAnalyzedField; /** @var Optional|Document|Serializable|array|stdClass $score */ public readonly Optional|Document|Serializable|stdClass|array $score; @@ -49,13 +49,13 @@ final class WildcardOperator implements SearchOperatorInterface, OperatorInterfa /** * @param array|string $path * @param string $query - * @param Optional|bool $allowAnalyzedField + * @param Optional|bool|string $allowAnalyzedField * @param Optional|Document|Serializable|array|stdClass $score */ public function __construct( array|string $path, string $query, - Optional|bool $allowAnalyzedField = Optional::Undefined, + Optional|bool|string $allowAnalyzedField = Optional::Undefined, Optional|Document|Serializable|stdClass|array $score = Optional::Undefined, ) { $this->path = $path; diff --git a/src/Builder/Stage/BucketAutoStage.php b/src/Builder/Stage/BucketAutoStage.php index 2de5b3c20..787a3629b 100644 --- a/src/Builder/Stage/BucketAutoStage.php +++ b/src/Builder/Stage/BucketAutoStage.php @@ -39,34 +39,34 @@ final class BucketAutoStage implements StageInterface, OperatorInterface /** @var ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. */ public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; - /** @var int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. */ - public readonly int $buckets; + /** @var int|string $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. */ + public readonly int|string $buckets; /** - * @var Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @var Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. */ - public readonly Optional|Document|Serializable|stdClass|array $output; + public readonly Optional|Document|Serializable|stdClass|array|string $output; /** - * @var Optional|Document|Serializable|array|stdClass $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * @var Optional|Document|Serializable|array|stdClass|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. * Available only if the all groupBy values are numeric and none of them are NaN. */ - public readonly Optional|Document|Serializable|stdClass|array $granularity; + public readonly Optional|Document|Serializable|stdClass|array|string $granularity; /** * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. - * @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param int|string $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. - * @param Optional|Document|Serializable|array|stdClass $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * @param Optional|Document|Serializable|array|stdClass|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. * Available only if the all groupBy values are numeric and none of them are NaN. */ public function __construct( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, - int $buckets, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $granularity = Optional::Undefined, + int|string $buckets, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $granularity = Optional::Undefined, ) { $this->groupBy = $groupBy; $this->buckets = $buckets; diff --git a/src/Builder/Stage/BucketStage.php b/src/Builder/Stage/BucketStage.php index 211987c66..7ddd96912 100644 --- a/src/Builder/Stage/BucketStage.php +++ b/src/Builder/Stage/BucketStage.php @@ -49,10 +49,10 @@ final class BucketStage implements StageInterface, OperatorInterface public readonly Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; /** - * @var BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * @var BSONArray|PackedArray|array|string $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: */ - public readonly PackedArray|BSONArray|array $boundaries; + public readonly PackedArray|BSONArray|array|string $boundaries; /** * @var Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. @@ -63,30 +63,30 @@ final class BucketStage implements StageInterface, OperatorInterface public readonly Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; /** - * @var Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @var Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. */ - public readonly Optional|Document|Serializable|stdClass|array $output; + public readonly Optional|Document|Serializable|stdClass|array|string $output; /** * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. - * @param BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * @param BSONArray|PackedArray|array|string $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. * The default value can be of a different type than the entries in boundaries. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. */ public function __construct( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, - PackedArray|BSONArray|array $boundaries, + PackedArray|BSONArray|array|string $boundaries, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, ) { $this->groupBy = $groupBy; if (is_array($boundaries) && ! array_is_list($boundaries)) { diff --git a/src/Builder/Stage/ChangeStreamStage.php b/src/Builder/Stage/ChangeStreamStage.php index d9c22eaa4..f67cfaada 100644 --- a/src/Builder/Stage/ChangeStreamStage.php +++ b/src/Builder/Stage/ChangeStreamStage.php @@ -38,8 +38,8 @@ final class ChangeStreamStage implements StageInterface, OperatorInterface 'startAtOperationTime' => 'startAtOperationTime', ]; - /** @var Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. */ - public readonly Optional|bool $allChangesForCluster; + /** @var Optional|bool|string $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. */ + public readonly Optional|bool|string $allChangesForCluster; /** @var Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. */ public readonly Optional|string $fullDocument; @@ -47,39 +47,39 @@ final class ChangeStreamStage implements StageInterface, OperatorInterface /** @var Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. */ public readonly Optional|string $fullDocumentBeforeChange; - /** @var Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. */ - public readonly Optional|int $resumeAfter; + /** @var Optional|int|string $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. */ + public readonly Optional|int|string $resumeAfter; /** - * @var Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * @var Optional|bool|string $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. * New in MongoDB 6.0. */ - public readonly Optional|bool $showExpandedEvents; + public readonly Optional|bool|string $showExpandedEvents; - /** @var Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. */ - public readonly Optional|Document|Serializable|stdClass|array $startAfter; + /** @var Optional|Document|Serializable|array|stdClass|string $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. */ + public readonly Optional|Document|Serializable|stdClass|array|string $startAfter; - /** @var Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ - public readonly Optional|Timestamp|int $startAtOperationTime; + /** @var Optional|Timestamp|int|string $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ + public readonly Optional|Timestamp|int|string $startAtOperationTime; /** - * @param Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + * @param Optional|bool|string $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. * @param Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. * @param Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. - * @param Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. - * @param Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * @param Optional|int|string $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + * @param Optional|bool|string $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. * New in MongoDB 6.0. - * @param Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. - * @param Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. + * @param Optional|Document|Serializable|array|stdClass|string $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + * @param Optional|Timestamp|int|string $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ public function __construct( - Optional|bool $allChangesForCluster = Optional::Undefined, + Optional|bool|string $allChangesForCluster = Optional::Undefined, Optional|string $fullDocument = Optional::Undefined, Optional|string $fullDocumentBeforeChange = Optional::Undefined, - Optional|int $resumeAfter = Optional::Undefined, - Optional|bool $showExpandedEvents = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $startAfter = Optional::Undefined, - Optional|Timestamp|int $startAtOperationTime = Optional::Undefined, + Optional|int|string $resumeAfter = Optional::Undefined, + Optional|bool|string $showExpandedEvents = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $startAfter = Optional::Undefined, + Optional|Timestamp|int|string $startAtOperationTime = Optional::Undefined, ) { $this->allChangesForCluster = $allChangesForCluster; $this->fullDocument = $fullDocument; diff --git a/src/Builder/Stage/CollStatsStage.php b/src/Builder/Stage/CollStatsStage.php index d84245320..3163c0821 100644 --- a/src/Builder/Stage/CollStatsStage.php +++ b/src/Builder/Stage/CollStatsStage.php @@ -34,29 +34,29 @@ final class CollStatsStage implements StageInterface, OperatorInterface 'queryExecStats' => 'queryExecStats', ]; - /** @var Optional|Document|Serializable|array|stdClass $latencyStats */ - public readonly Optional|Document|Serializable|stdClass|array $latencyStats; + /** @var Optional|Document|Serializable|array|stdClass|string $latencyStats */ + public readonly Optional|Document|Serializable|stdClass|array|string $latencyStats; - /** @var Optional|Document|Serializable|array|stdClass $storageStats */ - public readonly Optional|Document|Serializable|stdClass|array $storageStats; + /** @var Optional|Document|Serializable|array|stdClass|string $storageStats */ + public readonly Optional|Document|Serializable|stdClass|array|string $storageStats; - /** @var Optional|Document|Serializable|array|stdClass $count */ - public readonly Optional|Document|Serializable|stdClass|array $count; + /** @var Optional|Document|Serializable|array|stdClass|string $count */ + public readonly Optional|Document|Serializable|stdClass|array|string $count; - /** @var Optional|Document|Serializable|array|stdClass $queryExecStats */ - public readonly Optional|Document|Serializable|stdClass|array $queryExecStats; + /** @var Optional|Document|Serializable|array|stdClass|string $queryExecStats */ + public readonly Optional|Document|Serializable|stdClass|array|string $queryExecStats; /** - * @param Optional|Document|Serializable|array|stdClass $latencyStats - * @param Optional|Document|Serializable|array|stdClass $storageStats - * @param Optional|Document|Serializable|array|stdClass $count - * @param Optional|Document|Serializable|array|stdClass $queryExecStats + * @param Optional|Document|Serializable|array|stdClass|string $latencyStats + * @param Optional|Document|Serializable|array|stdClass|string $storageStats + * @param Optional|Document|Serializable|array|stdClass|string $count + * @param Optional|Document|Serializable|array|stdClass|string $queryExecStats */ public function __construct( - Optional|Document|Serializable|stdClass|array $latencyStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $storageStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $queryExecStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $latencyStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $storageStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $queryExecStats = Optional::Undefined, ) { $this->latencyStats = $latencyStats; $this->storageStats = $storageStats; diff --git a/src/Builder/Stage/CurrentOpStage.php b/src/Builder/Stage/CurrentOpStage.php index 3d0d6abb2..201ff795b 100644 --- a/src/Builder/Stage/CurrentOpStage.php +++ b/src/Builder/Stage/CurrentOpStage.php @@ -32,34 +32,34 @@ final class CurrentOpStage implements StageInterface, OperatorInterface 'localOps' => 'localOps', ]; - /** @var Optional|bool $allUsers */ - public readonly Optional|bool $allUsers; + /** @var Optional|bool|string $allUsers */ + public readonly Optional|bool|string $allUsers; - /** @var Optional|bool $idleConnections */ - public readonly Optional|bool $idleConnections; + /** @var Optional|bool|string $idleConnections */ + public readonly Optional|bool|string $idleConnections; - /** @var Optional|bool $idleCursors */ - public readonly Optional|bool $idleCursors; + /** @var Optional|bool|string $idleCursors */ + public readonly Optional|bool|string $idleCursors; - /** @var Optional|bool $idleSessions */ - public readonly Optional|bool $idleSessions; + /** @var Optional|bool|string $idleSessions */ + public readonly Optional|bool|string $idleSessions; - /** @var Optional|bool $localOps */ - public readonly Optional|bool $localOps; + /** @var Optional|bool|string $localOps */ + public readonly Optional|bool|string $localOps; /** - * @param Optional|bool $allUsers - * @param Optional|bool $idleConnections - * @param Optional|bool $idleCursors - * @param Optional|bool $idleSessions - * @param Optional|bool $localOps + * @param Optional|bool|string $allUsers + * @param Optional|bool|string $idleConnections + * @param Optional|bool|string $idleCursors + * @param Optional|bool|string $idleSessions + * @param Optional|bool|string $localOps */ public function __construct( - Optional|bool $allUsers = Optional::Undefined, - Optional|bool $idleConnections = Optional::Undefined, - Optional|bool $idleCursors = Optional::Undefined, - Optional|bool $idleSessions = Optional::Undefined, - Optional|bool $localOps = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, + Optional|bool|string $idleConnections = Optional::Undefined, + Optional|bool|string $idleCursors = Optional::Undefined, + Optional|bool|string $idleSessions = Optional::Undefined, + Optional|bool|string $localOps = Optional::Undefined, ) { $this->allUsers = $allUsers; $this->idleConnections = $idleConnections; diff --git a/src/Builder/Stage/DensifyStage.php b/src/Builder/Stage/DensifyStage.php index 9ecff7bbc..8ff86f50a 100644 --- a/src/Builder/Stage/DensifyStage.php +++ b/src/Builder/Stage/DensifyStage.php @@ -41,23 +41,23 @@ final class DensifyStage implements StageInterface, OperatorInterface */ public readonly string $field; - /** @var Document|Serializable|array|stdClass $range Specification for range based densification. */ - public readonly Document|Serializable|stdClass|array $range; + /** @var Document|Serializable|array|stdClass|string $range Specification for range based densification. */ + public readonly Document|Serializable|stdClass|array|string $range; - /** @var Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. */ - public readonly Optional|PackedArray|BSONArray|array $partitionByFields; + /** @var Optional|BSONArray|PackedArray|array|string $partitionByFields The field(s) that will be used as the partition keys. */ + public readonly Optional|PackedArray|BSONArray|array|string $partitionByFields; /** * @param string $field The field to densify. The values of the specified field must either be all numeric values or all dates. * Documents that do not contain the specified field continue through the pipeline unmodified. * To specify a in an embedded document or in an array, use dot notation. - * @param Document|Serializable|array|stdClass $range Specification for range based densification. - * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + * @param Document|Serializable|array|stdClass|string $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields The field(s) that will be used as the partition keys. */ public function __construct( string $field, - Document|Serializable|stdClass|array $range, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Document|Serializable|stdClass|array|string $range, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, ) { $this->field = $field; $this->range = $range; diff --git a/src/Builder/Stage/DocumentsStage.php b/src/Builder/Stage/DocumentsStage.php index d49585ef7..a67dc2bec 100644 --- a/src/Builder/Stage/DocumentsStage.php +++ b/src/Builder/Stage/DocumentsStage.php @@ -32,22 +32,22 @@ final class DocumentsStage implements StageInterface, OperatorInterface public const PROPERTIES = ['documents' => 'documents']; /** - * @var BSONArray|PackedArray|ResolvesToArray|array $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * @var BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: * - system variables, such as $$NOW or $$SEARCH_META * - $let expressions * - variables in scope from $lookup expressions * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. */ - public readonly PackedArray|ResolvesToArray|BSONArray|array $documents; + public readonly PackedArray|ResolvesToArray|BSONArray|array|string $documents; /** - * @param BSONArray|PackedArray|ResolvesToArray|array $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: * - system variables, such as $$NOW or $$SEARCH_META * - $let expressions * - variables in scope from $lookup expressions * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. */ - public function __construct(PackedArray|ResolvesToArray|BSONArray|array $documents) + public function __construct(PackedArray|ResolvesToArray|BSONArray|array|string $documents) { if (is_array($documents) && ! array_is_list($documents)) { throw new InvalidArgumentException('Expected $documents argument to be a list, got an associative array.'); diff --git a/src/Builder/Stage/FactoryTrait.php b/src/Builder/Stage/FactoryTrait.php index 7ef8fb62b..400fcbf35 100644 --- a/src/Builder/Stage/FactoryTrait.php +++ b/src/Builder/Stage/FactoryTrait.php @@ -52,21 +52,21 @@ public static function addFields( * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. - * @param BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * @param BSONArray|PackedArray|array|string $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. * The default value can be of a different type than the entries in boundaries. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. */ public static function bucket( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, - PackedArray|BSONArray|array $boundaries, + PackedArray|BSONArray|array|string $boundaries, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, ): BucketStage { return new BucketStage($groupBy, $boundaries, $default, $output); } @@ -76,17 +76,17 @@ public static function bucket( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. - * @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param int|string $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. - * @param Optional|Document|Serializable|array|stdClass $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * @param Optional|Document|Serializable|array|stdClass|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. * Available only if the all groupBy values are numeric and none of them are NaN. */ public static function bucketAuto( Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, - int $buckets, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $granularity = Optional::Undefined, + int|string $buckets, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $granularity = Optional::Undefined, ): BucketAutoStage { return new BucketAutoStage($groupBy, $buckets, $output, $granularity); } @@ -95,23 +95,23 @@ public static function bucketAuto( * Returns a Change Stream cursor for the collection or database. This stage can only occur once in an aggregation pipeline and it must occur as the first stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/ - * @param Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + * @param Optional|bool|string $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. * @param Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. * @param Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. - * @param Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. - * @param Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * @param Optional|int|string $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + * @param Optional|bool|string $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. * New in MongoDB 6.0. - * @param Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. - * @param Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. + * @param Optional|Document|Serializable|array|stdClass|string $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + * @param Optional|Timestamp|int|string $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ public static function changeStream( - Optional|bool $allChangesForCluster = Optional::Undefined, + Optional|bool|string $allChangesForCluster = Optional::Undefined, Optional|string $fullDocument = Optional::Undefined, Optional|string $fullDocumentBeforeChange = Optional::Undefined, - Optional|int $resumeAfter = Optional::Undefined, - Optional|bool $showExpandedEvents = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $startAfter = Optional::Undefined, - Optional|Timestamp|int $startAtOperationTime = Optional::Undefined, + Optional|int|string $resumeAfter = Optional::Undefined, + Optional|bool|string $showExpandedEvents = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $startAfter = Optional::Undefined, + Optional|Timestamp|int|string $startAtOperationTime = Optional::Undefined, ): ChangeStreamStage { return new ChangeStreamStage($allChangesForCluster, $fullDocument, $fullDocumentBeforeChange, $resumeAfter, $showExpandedEvents, $startAfter, $startAtOperationTime); } @@ -131,16 +131,16 @@ public static function changeStreamSplitLargeEvent(): ChangeStreamSplitLargeEven * Returns statistics regarding a collection or view. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/ - * @param Optional|Document|Serializable|array|stdClass $latencyStats - * @param Optional|Document|Serializable|array|stdClass $storageStats - * @param Optional|Document|Serializable|array|stdClass $count - * @param Optional|Document|Serializable|array|stdClass $queryExecStats + * @param Optional|Document|Serializable|array|stdClass|string $latencyStats + * @param Optional|Document|Serializable|array|stdClass|string $storageStats + * @param Optional|Document|Serializable|array|stdClass|string $count + * @param Optional|Document|Serializable|array|stdClass|string $queryExecStats */ public static function collStats( - Optional|Document|Serializable|stdClass|array $latencyStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $storageStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $queryExecStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $latencyStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $storageStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $queryExecStats = Optional::Undefined, ): CollStatsStage { return new CollStatsStage($latencyStats, $storageStats, $count, $queryExecStats); } @@ -161,18 +161,18 @@ public static function count(string $field): CountStage * Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/ - * @param Optional|bool $allUsers - * @param Optional|bool $idleConnections - * @param Optional|bool $idleCursors - * @param Optional|bool $idleSessions - * @param Optional|bool $localOps + * @param Optional|bool|string $allUsers + * @param Optional|bool|string $idleConnections + * @param Optional|bool|string $idleCursors + * @param Optional|bool|string $idleSessions + * @param Optional|bool|string $localOps */ public static function currentOp( - Optional|bool $allUsers = Optional::Undefined, - Optional|bool $idleConnections = Optional::Undefined, - Optional|bool $idleCursors = Optional::Undefined, - Optional|bool $idleSessions = Optional::Undefined, - Optional|bool $localOps = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, + Optional|bool|string $idleConnections = Optional::Undefined, + Optional|bool|string $idleCursors = Optional::Undefined, + Optional|bool|string $idleSessions = Optional::Undefined, + Optional|bool|string $localOps = Optional::Undefined, ): CurrentOpStage { return new CurrentOpStage($allUsers, $idleConnections, $idleCursors, $idleSessions, $localOps); } @@ -184,13 +184,13 @@ public static function currentOp( * @param string $field The field to densify. The values of the specified field must either be all numeric values or all dates. * Documents that do not contain the specified field continue through the pipeline unmodified. * To specify a in an embedded document or in an array, use dot notation. - * @param Document|Serializable|array|stdClass $range Specification for range based densification. - * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + * @param Document|Serializable|array|stdClass|string $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields The field(s) that will be used as the partition keys. */ public static function densify( string $field, - Document|Serializable|stdClass|array $range, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Document|Serializable|stdClass|array|string $range, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, ): DensifyStage { return new DensifyStage($field, $range, $partitionByFields); } @@ -199,13 +199,13 @@ public static function densify( * Returns literal documents from input values. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/ - * @param BSONArray|PackedArray|ResolvesToArray|array $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: * - system variables, such as $$NOW or $$SEARCH_META * - $let expressions * - variables in scope from $lookup expressions * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. */ - public static function documents(PackedArray|ResolvesToArray|BSONArray|array $documents): DocumentsStage + public static function documents(PackedArray|ResolvesToArray|BSONArray|array|string $documents): DocumentsStage { return new DocumentsStage($documents); } @@ -225,21 +225,21 @@ public static function facet(PackedArray|Pipeline|BSONArray|array ...$facet): Fa * Populates null and missing field values within documents. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/ - * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * @param Document|Serializable|array|stdClass|string $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. * The object name is the name of the field to fill. The object value specifies how the field is filled. * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + * @param Optional|Document|Serializable|array|stdClass|string $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ public static function fill( - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $output, Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sortBy = Optional::Undefined, ): FillStage { return new FillStage($output, $partitionBy, $partitionByFields, $sortBy); } @@ -249,31 +249,31 @@ public static function fill( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/ * @param string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. - * @param Document|ResolvesToObject|Serializable|array|stdClass $near The point for which to find the closest documents. - * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|Decimal128|Int64|float|int|string $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. - * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. - * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. * You cannot specify a $near predicate in the query field of the $geoNear stage. - * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * @param Optional|bool|string $spherical Determines how MongoDB calculates the distance between two points: * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. * Default: false. */ public static function geoNear( string $distanceField, - Document|Serializable|ResolvesToObject|stdClass|array $near, - Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|Decimal128|Int64|float|int|string $distanceMultiplier = Optional::Undefined, Optional|string $includeLocs = Optional::Undefined, Optional|string $key = Optional::Undefined, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, Optional|QueryInterface|array $query = Optional::Undefined, - Optional|bool $spherical = Optional::Undefined, + Optional|bool|string $spherical = Optional::Undefined, ): GeoNearStage { return new GeoNearStage($distanceField, $near, $distanceMultiplier, $includeLocs, $key, $maxDistance, $minDistance, $query, $spherical); } @@ -288,7 +288,7 @@ public static function geoNear( * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. - * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|int|string $maxDepth Non-negative integral number specifying the maximum recursion depth. * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. */ @@ -298,7 +298,7 @@ public static function graphLookup( string $connectFromField, string $connectToField, string $as, - Optional|int $maxDepth = Optional::Undefined, + Optional|int|string $maxDepth = Optional::Undefined, Optional|string $depthField = Optional::Undefined, Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, ): GraphLookupStage { @@ -333,9 +333,9 @@ public static function indexStats(): IndexStatsStage * Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/ - * @param int $limit + * @param int|string $limit */ - public static function limit(int $limit): LimitStage + public static function limit(int|string $limit): LimitStage { return new LimitStage($limit); } @@ -344,12 +344,12 @@ public static function limit(int $limit): LimitStage * Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/ - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public static function listLocalSessions( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, ): ListLocalSessionsStage { return new ListLocalSessionsStage($users, $allUsers); } @@ -384,12 +384,12 @@ public static function listSearchIndexes( * Lists all sessions that have been active long enough to propagate to the system.sessions collection. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/ - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public static function listSessions( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, ): ListSessionsStage { return new ListSessionsStage($users, $allUsers); } @@ -404,7 +404,7 @@ public static function listSessions( * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. @@ -414,7 +414,7 @@ public static function lookup( Optional|string $from = Optional::Undefined, Optional|string $localField = Optional::Undefined, Optional|string $foreignField = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, ): LookupStage { return new LookupStage($as, $from, $localField, $foreignField, $let, $pipeline); @@ -438,14 +438,14 @@ public static function match(QueryInterface|array $query): MatchStage * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/ * @param Document|Serializable|array|stdClass|string $into The output collection. * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables for use in the whenMatched pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. */ public static function merge( Document|Serializable|stdClass|array|string $into, Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, Optional|string $whenNotMatched = Optional::Undefined, ): MergeStage { @@ -501,10 +501,10 @@ public static function redact( * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $newRoot + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot */ public static function replaceRoot( - Document|Serializable|ResolvesToObject|stdClass|array $newRoot, + Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot, ): ReplaceRootStage { return new ReplaceRootStage($newRoot); } @@ -514,10 +514,10 @@ public static function replaceRoot( * Alias for $replaceRoot. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $expression + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression */ public static function replaceWith( - Document|Serializable|ResolvesToObject|stdClass|array $expression, + Document|Serializable|ResolvesToObject|stdClass|array|string $expression, ): ReplaceWithStage { return new ReplaceWithStage($expression); } @@ -526,9 +526,9 @@ public static function replaceWith( * Randomly selects the specified number of documents from its input. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/ - * @param int $size The number of documents to randomly select. + * @param int|string $size The number of documents to randomly select. */ - public static function sample(int $size): SampleStage + public static function sample(int|string $size): SampleStage { return new SampleStage($size); } @@ -541,30 +541,30 @@ public static function sample(int $size): SampleStage * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". - * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. - * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * @param Optional|Document|Serializable|array|stdClass|string $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool|string $concurrent Parallelize search across segments on dedicated search nodes. * If you don't have separate search nodes on your cluster, * Atlas Search ignores this flag. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. - * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. - * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. - * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + * @param Optional|bool|string $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass|string $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool|string $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass|string $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ public static function search( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, - Optional|bool $concurrent = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $highlight = Optional::Undefined, + Optional|bool|string $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, Optional|string $searchAfter = Optional::Undefined, Optional|string $searchBefore = Optional::Undefined, - Optional|bool $scoreDetails = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, - Optional|bool $returnStoredSource = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + Optional|bool|string $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sort = Optional::Undefined, + Optional|bool|string $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $tracking = Optional::Undefined, ): SearchStage { return new SearchStage($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking); } @@ -577,12 +577,12 @@ public static function search( * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. */ public static function searchMeta( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, ): SearchMetaStage { return new SearchMetaStage($operator, $index, $count); } @@ -604,14 +604,14 @@ public static function set(Type|ExpressionInterface|stdClass|array|bool|float|in * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ - * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. - * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass|string $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. */ public static function setWindowFields( - Document|Serializable|stdClass|array $sortBy, - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $sortBy, + Document|Serializable|stdClass|array|string $output, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy = Optional::Undefined, ): SetWindowFieldsStage { return new SetWindowFieldsStage($sortBy, $output, $partitionBy); @@ -632,9 +632,9 @@ public static function shardedDataDistribution(): ShardedDataDistributionStage * Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/ - * @param int $skip + * @param int|string $skip */ - public static function skip(int $skip): SkipStage + public static function skip(int|string $skip): SkipStage { return new SkipStage($skip); } @@ -698,14 +698,14 @@ public static function unset(FieldPath|string ...$field): UnsetStage * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/ * @param ArrayFieldPath|string $path Field path to an array field. * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. - * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * @param Optional|bool|string $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. * If false, if path is null, missing, or an empty array, $unwind does not output a document. * The default value is false. */ public static function unwind( ArrayFieldPath|string $path, Optional|string $includeArrayIndex = Optional::Undefined, - Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + Optional|bool|string $preserveNullAndEmptyArrays = Optional::Undefined, ): UnwindStage { return new UnwindStage($path, $includeArrayIndex, $preserveNullAndEmptyArrays); } @@ -715,22 +715,22 @@ public static function unwind( * * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ * @param string $index Name of the Atlas Vector Search index to use. - * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param int|string $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. * @param array|string $path Indexed vector type field to search. - * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. - * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param BSONArray|PackedArray|array|string $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool|string $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. - * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * @param Optional|int|string $numCandidates This field is required if exact is false or omitted. * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). */ public static function vectorSearch( string $index, - int $limit, + int|string $limit, array|string $path, - PackedArray|BSONArray|array $queryVector, - Optional|bool $exact = Optional::Undefined, + PackedArray|BSONArray|array|string $queryVector, + Optional|bool|string $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, - Optional|int $numCandidates = Optional::Undefined, + Optional|int|string $numCandidates = Optional::Undefined, ): VectorSearchStage { return new VectorSearchStage($index, $limit, $path, $queryVector, $exact, $filter, $numCandidates); } diff --git a/src/Builder/Stage/FillStage.php b/src/Builder/Stage/FillStage.php index f7b3b35e2..90ca5265f 100644 --- a/src/Builder/Stage/FillStage.php +++ b/src/Builder/Stage/FillStage.php @@ -41,10 +41,10 @@ final class FillStage implements StageInterface, OperatorInterface ]; /** - * @var Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * @var Document|Serializable|array|stdClass|string $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. * The object name is the name of the field to fill. The object value specifies how the field is filled. */ - public readonly Document|Serializable|stdClass|array $output; + public readonly Document|Serializable|stdClass|array|string $output; /** * @var Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. @@ -54,31 +54,31 @@ final class FillStage implements StageInterface, OperatorInterface public readonly Optional|Document|Serializable|stdClass|array|string $partitionBy; /** - * @var Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * @var Optional|BSONArray|PackedArray|array|string $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. */ - public readonly Optional|PackedArray|BSONArray|array $partitionByFields; + public readonly Optional|PackedArray|BSONArray|array|string $partitionByFields; - /** @var Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ - public readonly Optional|Document|Serializable|stdClass|array $sortBy; + /** @var Optional|Document|Serializable|array|stdClass|string $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ + public readonly Optional|Document|Serializable|stdClass|array|string $sortBy; /** - * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * @param Document|Serializable|array|stdClass|string $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. * The object name is the name of the field to fill. The object value specifies how the field is filled. * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + * @param Optional|Document|Serializable|array|stdClass|string $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ public function __construct( - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $output, Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sortBy = Optional::Undefined, ) { $this->output = $output; $this->partitionBy = $partitionBy; diff --git a/src/Builder/Stage/FluentFactoryTrait.php b/src/Builder/Stage/FluentFactoryTrait.php index 803ca9905..d15e5460f 100644 --- a/src/Builder/Stage/FluentFactoryTrait.php +++ b/src/Builder/Stage/FluentFactoryTrait.php @@ -77,21 +77,21 @@ public function addFields( * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. * Unless $bucket includes a default specification, each input document must resolve the groupBy field path or expression to a value that falls within one of the ranges specified by the boundaries. - * @param BSONArray|PackedArray|array $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. + * @param BSONArray|PackedArray|array|string $boundaries An array of values based on the groupBy expression that specify the boundaries for each bucket. Each adjacent pair of values acts as the inclusive lower boundary and the exclusive upper boundary for the bucket. You must specify at least two boundaries. * The specified values must be in ascending order and all of the same type. The exception is if the values are of mixed numeric types, such as: * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $default A literal that specifies the _id of an additional bucket that contains all documents whose groupBy expression result does not fall into a bucket specified by boundaries. * If unspecified, each input document must resolve the groupBy expression to a value within one of the bucket ranges specified by boundaries or the operation throws an error. * The default value must be less than the lowest boundaries value, or greater than or equal to the highest boundaries value. * The default value can be of a different type than the entries in boundaries. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * If you do not specify an output document, the operation returns a count field containing the number of documents in each bucket. * If you specify an output document, only the fields specified in the document are returned; i.e. the count field is not returned unless it is explicitly included in the output document. */ public function bucket( Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $groupBy, - PackedArray|BSONArray|array $boundaries, + PackedArray|BSONArray|array|string $boundaries, Optional|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $default = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, ): static { $this->pipeline[] = Stage::bucket($groupBy, $boundaries, $default, $output); @@ -103,17 +103,17 @@ public function bucket( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/ * @param ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $groupBy An expression to group documents by. To specify a field path, prefix the field name with a dollar sign $ and enclose it in quotes. - * @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. - * @param Optional|Document|Serializable|array|stdClass $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. + * @param int|string $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. + * @param Optional|Document|Serializable|array|stdClass|string $output A document that specifies the fields to include in the output documents in addition to the _id field. To specify the field to include, you must use accumulator expressions. * The default count field is not included in the output document when output is specified. Explicitly specify the count expression as part of the output document to include it. - * @param Optional|Document|Serializable|array|stdClass $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. + * @param Optional|Document|Serializable|array|stdClass|string $granularity A string that specifies the preferred number series to use to ensure that the calculated boundary edges end on preferred round numbers or their powers of 10. * Available only if the all groupBy values are numeric and none of them are NaN. */ public function bucketAuto( Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $groupBy, - int $buckets, - Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $granularity = Optional::Undefined, + string|int $buckets, + Optional|Document|Serializable|stdClass|array|string $output = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $granularity = Optional::Undefined, ): static { $this->pipeline[] = Stage::bucketAuto($groupBy, $buckets, $output, $granularity); @@ -124,23 +124,23 @@ public function bucketAuto( * Returns a Change Stream cursor for the collection or database. This stage can only occur once in an aggregation pipeline and it must occur as the first stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/changeStream/ - * @param Optional|bool $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. + * @param Optional|bool|string $allChangesForCluster A flag indicating whether the stream should report all changes that occur on the deployment, aside from those on internal databases or collections. * @param Optional|string $fullDocument Specifies whether change notifications include a copy of the full document when modified by update operations. * @param Optional|string $fullDocumentBeforeChange Valid values are "off", "whenAvailable", or "required". If set to "off", the "fullDocumentBeforeChange" field of the output document is always omitted. If set to "whenAvailable", the "fullDocumentBeforeChange" field will be populated with the pre-image of the document modified by the current change event if such a pre-image is available, and will be omitted otherwise. If set to "required", then the "fullDocumentBeforeChange" field is always populated and an exception is thrown if the pre-image is not available. - * @param Optional|int $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. - * @param Optional|bool $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. + * @param Optional|int|string $resumeAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with startAfter or startAtOperationTime fields. + * @param Optional|bool|string $showExpandedEvents Specifies whether to include additional change events, such as such as DDL and index operations. * New in MongoDB 6.0. - * @param Optional|Document|Serializable|array|stdClass $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. - * @param Optional|Timestamp|int $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. + * @param Optional|Document|Serializable|array|stdClass|string $startAfter Specifies a resume token as the logical starting point for the change stream. Cannot be used with resumeAfter or startAtOperationTime fields. + * @param Optional|Timestamp|int|string $startAtOperationTime Specifies a time as the logical starting point for the change stream. Cannot be used with resumeAfter or startAfter fields. */ public function changeStream( - Optional|bool $allChangesForCluster = Optional::Undefined, + Optional|string|bool $allChangesForCluster = Optional::Undefined, Optional|string $fullDocument = Optional::Undefined, Optional|string $fullDocumentBeforeChange = Optional::Undefined, - Optional|int $resumeAfter = Optional::Undefined, - Optional|bool $showExpandedEvents = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $startAfter = Optional::Undefined, - Optional|Timestamp|int $startAtOperationTime = Optional::Undefined, + Optional|string|int $resumeAfter = Optional::Undefined, + Optional|string|bool $showExpandedEvents = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $startAfter = Optional::Undefined, + Optional|Timestamp|string|int $startAtOperationTime = Optional::Undefined, ): static { $this->pipeline[] = Stage::changeStream($allChangesForCluster, $fullDocument, $fullDocumentBeforeChange, $resumeAfter, $showExpandedEvents, $startAfter, $startAtOperationTime); @@ -164,16 +164,16 @@ public function changeStreamSplitLargeEvent(): static * Returns statistics regarding a collection or view. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/collStats/ - * @param Optional|Document|Serializable|array|stdClass $latencyStats - * @param Optional|Document|Serializable|array|stdClass $storageStats - * @param Optional|Document|Serializable|array|stdClass $count - * @param Optional|Document|Serializable|array|stdClass $queryExecStats + * @param Optional|Document|Serializable|array|stdClass|string $latencyStats + * @param Optional|Document|Serializable|array|stdClass|string $storageStats + * @param Optional|Document|Serializable|array|stdClass|string $count + * @param Optional|Document|Serializable|array|stdClass|string $queryExecStats */ public function collStats( - Optional|Document|Serializable|stdClass|array $latencyStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $storageStats = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $queryExecStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $latencyStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $storageStats = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $queryExecStats = Optional::Undefined, ): static { $this->pipeline[] = Stage::collStats($latencyStats, $storageStats, $count, $queryExecStats); @@ -198,18 +198,18 @@ public function count(string $field): static * Returns information on active and/or dormant operations for the MongoDB deployment. To run, use the db.aggregate() method. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/currentOp/ - * @param Optional|bool $allUsers - * @param Optional|bool $idleConnections - * @param Optional|bool $idleCursors - * @param Optional|bool $idleSessions - * @param Optional|bool $localOps + * @param Optional|bool|string $allUsers + * @param Optional|bool|string $idleConnections + * @param Optional|bool|string $idleCursors + * @param Optional|bool|string $idleSessions + * @param Optional|bool|string $localOps */ public function currentOp( - Optional|bool $allUsers = Optional::Undefined, - Optional|bool $idleConnections = Optional::Undefined, - Optional|bool $idleCursors = Optional::Undefined, - Optional|bool $idleSessions = Optional::Undefined, - Optional|bool $localOps = Optional::Undefined, + Optional|string|bool $allUsers = Optional::Undefined, + Optional|string|bool $idleConnections = Optional::Undefined, + Optional|string|bool $idleCursors = Optional::Undefined, + Optional|string|bool $idleSessions = Optional::Undefined, + Optional|string|bool $localOps = Optional::Undefined, ): static { $this->pipeline[] = Stage::currentOp($allUsers, $idleConnections, $idleCursors, $idleSessions, $localOps); @@ -223,13 +223,13 @@ public function currentOp( * @param string $field The field to densify. The values of the specified field must either be all numeric values or all dates. * Documents that do not contain the specified field continue through the pipeline unmodified. * To specify a in an embedded document or in an array, use dot notation. - * @param Document|Serializable|array|stdClass $range Specification for range based densification. - * @param Optional|BSONArray|PackedArray|array $partitionByFields The field(s) that will be used as the partition keys. + * @param Document|Serializable|array|stdClass|string $range Specification for range based densification. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields The field(s) that will be used as the partition keys. */ public function densify( string $field, - Document|Serializable|stdClass|array $range, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, + Document|Serializable|stdClass|array|string $range, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, ): static { $this->pipeline[] = Stage::densify($field, $range, $partitionByFields); @@ -240,13 +240,13 @@ public function densify( * Returns literal documents from input values. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/documents/ - * @param BSONArray|PackedArray|ResolvesToArray|array $documents $documents accepts any valid expression that resolves to an array of objects. This includes: + * @param BSONArray|PackedArray|ResolvesToArray|array|string $documents $documents accepts any valid expression that resolves to an array of objects. This includes: * - system variables, such as $$NOW or $$SEARCH_META * - $let expressions * - variables in scope from $lookup expressions * Expressions that do not resolve to a current document, like $myField or $$ROOT, will result in an error. */ - public function documents(PackedArray|ResolvesToArray|BSONArray|array $documents): static + public function documents(PackedArray|ResolvesToArray|BSONArray|array|string $documents): static { $this->pipeline[] = Stage::documents($documents); @@ -270,21 +270,21 @@ public function facet(PackedArray|Pipeline|BSONArray|array ...$facet): static * Populates null and missing field values within documents. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/fill/ - * @param Document|Serializable|array|stdClass $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. + * @param Document|Serializable|array|stdClass|string $output Specifies an object containing each field for which to fill missing values. You can specify multiple fields in the output object. * The object name is the name of the field to fill. The object value specifies how the field is filled. * @param Optional|Document|Serializable|array|stdClass|string $partitionBy Specifies an expression to group the documents. In the $fill stage, a group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|BSONArray|PackedArray|array $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. + * @param Optional|BSONArray|PackedArray|array|string $partitionByFields Specifies an array of fields as the compound key to group the documents. In the $fill stage, each group of documents is known as a partition. * If you omit partitionBy and partitionByFields, $fill uses one partition for the entire collection. * partitionBy and partitionByFields are mutually exclusive. - * @param Optional|Document|Serializable|array|stdClass $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. + * @param Optional|Document|Serializable|array|stdClass|string $sortBy Specifies the field or fields to sort the documents within each partition. Uses the same syntax as the $sort stage. */ public function fill( - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $output, Optional|Document|Serializable|stdClass|array|string $partitionBy = Optional::Undefined, - Optional|PackedArray|BSONArray|array $partitionByFields = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sortBy = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $partitionByFields = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sortBy = Optional::Undefined, ): static { $this->pipeline[] = Stage::fill($output, $partitionBy, $partitionByFields, $sortBy); @@ -296,31 +296,31 @@ public function fill( * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/ * @param string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. - * @param Document|ResolvesToObject|Serializable|array|stdClass $near The point for which to find the closest documents. - * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|Decimal128|Int64|float|int|string $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. - * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. - * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. * You cannot specify a $near predicate in the query field of the $geoNear stage. - * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * @param Optional|bool|string $spherical Determines how MongoDB calculates the distance between two points: * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. * Default: false. */ public function geoNear( string $distanceField, - Document|Serializable|ResolvesToObject|stdClass|array $near, - Optional|Decimal128|Int64|int|float $distanceMultiplier = Optional::Undefined, + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|Decimal128|Int64|string|int|float $distanceMultiplier = Optional::Undefined, Optional|string $includeLocs = Optional::Undefined, Optional|string $key = Optional::Undefined, - Optional|Decimal128|Int64|int|float $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|int|float $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|string|int|float $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|string|int|float $minDistance = Optional::Undefined, Optional|QueryInterface|array $query = Optional::Undefined, - Optional|bool $spherical = Optional::Undefined, + Optional|string|bool $spherical = Optional::Undefined, ): static { $this->pipeline[] = Stage::geoNear($distanceField, $near, $distanceMultiplier, $includeLocs, $key, $maxDistance, $minDistance, $query, $spherical); @@ -337,7 +337,7 @@ public function geoNear( * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. - * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|int|string $maxDepth Non-negative integral number specifying the maximum recursion depth. * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. */ @@ -347,7 +347,7 @@ public function graphLookup( string $connectFromField, string $connectToField, string $as, - Optional|int $maxDepth = Optional::Undefined, + Optional|string|int $maxDepth = Optional::Undefined, Optional|string $depthField = Optional::Undefined, Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, ): static { @@ -388,9 +388,9 @@ public function indexStats(): static * Passes the first n documents unmodified to the pipeline where n is the specified limit. For each input document, outputs either one document (for the first n documents) or zero documents (after the first n documents). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/limit/ - * @param int $limit + * @param int|string $limit */ - public function limit(int $limit): static + public function limit(string|int $limit): static { $this->pipeline[] = Stage::limit($limit); @@ -401,12 +401,12 @@ public function limit(int $limit): static * Lists all active sessions recently in use on the currently connected mongos or mongod instance. These sessions may have not yet propagated to the system.sessions collection. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listLocalSessions/ - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public function listLocalSessions( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|string|bool $allUsers = Optional::Undefined, ): static { $this->pipeline[] = Stage::listLocalSessions($users, $allUsers); @@ -446,12 +446,12 @@ public function listSearchIndexes( * Lists all sessions that have been active long enough to propagate to the system.sessions collection. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/listSessions/ - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public function listSessions( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|string|bool $allUsers = Optional::Undefined, ): static { $this->pipeline[] = Stage::listSessions($users, $allUsers); @@ -468,7 +468,7 @@ public function listSessions( * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. @@ -478,7 +478,7 @@ public function lookup( Optional|string $from = Optional::Undefined, Optional|string $localField = Optional::Undefined, Optional|string $foreignField = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, ): static { $this->pipeline[] = Stage::lookup($as, $from, $localField, $foreignField, $let, $pipeline); @@ -493,14 +493,14 @@ public function lookup( * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/ * @param Document|Serializable|array|stdClass|string $into The output collection. * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables for use in the whenMatched pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. */ public function merge( Document|Serializable|stdClass|array|string $into, Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, Optional|string $whenNotMatched = Optional::Undefined, ): static { @@ -565,9 +565,9 @@ public function redact(Type|ExpressionInterface|stdClass|array|string|int|float| * Replaces a document with the specified embedded document. The operation replaces all existing fields in the input document, including the _id field. Specify a document embedded in the input document to promote the embedded document to the top level. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceRoot/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $newRoot + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot */ - public function replaceRoot(Document|Serializable|ResolvesToObject|stdClass|array $newRoot): static + public function replaceRoot(Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot): static { $this->pipeline[] = Stage::replaceRoot($newRoot); @@ -579,9 +579,9 @@ public function replaceRoot(Document|Serializable|ResolvesToObject|stdClass|arra * Alias for $replaceRoot. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/replaceWith/ - * @param Document|ResolvesToObject|Serializable|array|stdClass $expression + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression */ - public function replaceWith(Document|Serializable|ResolvesToObject|stdClass|array $expression): static + public function replaceWith(Document|Serializable|ResolvesToObject|stdClass|array|string $expression): static { $this->pipeline[] = Stage::replaceWith($expression); @@ -592,9 +592,9 @@ public function replaceWith(Document|Serializable|ResolvesToObject|stdClass|arra * Randomly selects the specified number of documents from its input. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sample/ - * @param int $size The number of documents to randomly select. + * @param int|string $size The number of documents to randomly select. */ - public function sample(int $size): static + public function sample(string|int $size): static { $this->pipeline[] = Stage::sample($size); @@ -609,30 +609,30 @@ public function sample(int $size): static * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". - * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. - * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * @param Optional|Document|Serializable|array|stdClass|string $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool|string $concurrent Parallelize search across segments on dedicated search nodes. * If you don't have separate search nodes on your cluster, * Atlas Search ignores this flag. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. - * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. - * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. - * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + * @param Optional|bool|string $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass|string $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool|string $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass|string $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ public function search( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, - Optional|bool $concurrent = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $highlight = Optional::Undefined, + Optional|string|bool $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, Optional|string $searchAfter = Optional::Undefined, Optional|string $searchBefore = Optional::Undefined, - Optional|bool $scoreDetails = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, - Optional|bool $returnStoredSource = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + Optional|string|bool $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sort = Optional::Undefined, + Optional|string|bool $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $tracking = Optional::Undefined, ): static { $this->pipeline[] = Stage::search($operator, $index, $highlight, $concurrent, $count, $searchAfter, $searchBefore, $scoreDetails, $sort, $returnStoredSource, $tracking); @@ -647,12 +647,12 @@ public function search( * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. */ public function searchMeta( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, ): static { $this->pipeline[] = Stage::searchMeta($operator, $index, $count); @@ -678,14 +678,14 @@ public function set(Type|ExpressionInterface|stdClass|array|string|int|float|boo * New in MongoDB 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ - * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. - * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass|string $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. */ public function setWindowFields( - Document|Serializable|stdClass|array $sortBy, - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $sortBy, + Document|Serializable|stdClass|array|string $output, Optional|Type|ExpressionInterface|stdClass|array|string|int|float|bool|null $partitionBy = Optional::Undefined, ): static { $this->pipeline[] = Stage::setWindowFields($sortBy, $output, $partitionBy); @@ -710,9 +710,9 @@ public function shardedDataDistribution(): static * Skips the first n documents where n is the specified skip number and passes the remaining documents unmodified to the pipeline. For each input document, outputs either zero documents (for the first n documents) or one document (if after the first n documents). * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/skip/ - * @param int $skip + * @param int|string $skip */ - public function skip(int $skip): static + public function skip(string|int $skip): static { $this->pipeline[] = Stage::skip($skip); @@ -785,14 +785,14 @@ public function unset(FieldPath|string ...$field): static * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/unwind/ * @param ArrayFieldPath|string $path Field path to an array field. * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. - * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * @param Optional|bool|string $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. * If false, if path is null, missing, or an empty array, $unwind does not output a document. * The default value is false. */ public function unwind( ArrayFieldPath|string $path, Optional|string $includeArrayIndex = Optional::Undefined, - Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + Optional|string|bool $preserveNullAndEmptyArrays = Optional::Undefined, ): static { $this->pipeline[] = Stage::unwind($path, $includeArrayIndex, $preserveNullAndEmptyArrays); @@ -804,22 +804,22 @@ public function unwind( * * @see https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-stage/ * @param string $index Name of the Atlas Vector Search index to use. - * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param int|string $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. * @param array|string $path Indexed vector type field to search. - * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. - * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param BSONArray|PackedArray|array|string $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool|string $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. - * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * @param Optional|int|string $numCandidates This field is required if exact is false or omitted. * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). */ public function vectorSearch( string $index, - int $limit, + string|int $limit, array|string $path, - PackedArray|BSONArray|array $queryVector, - Optional|bool $exact = Optional::Undefined, + PackedArray|BSONArray|array|string $queryVector, + Optional|string|bool $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, - Optional|int $numCandidates = Optional::Undefined, + Optional|string|int $numCandidates = Optional::Undefined, ): static { $this->pipeline[] = Stage::vectorSearch($index, $limit, $path, $queryVector, $exact, $filter, $numCandidates); diff --git a/src/Builder/Stage/GeoNearStage.php b/src/Builder/Stage/GeoNearStage.php index b2aa6588e..53af4826c 100644 --- a/src/Builder/Stage/GeoNearStage.php +++ b/src/Builder/Stage/GeoNearStage.php @@ -49,11 +49,11 @@ final class GeoNearStage implements StageInterface, OperatorInterface /** @var string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. */ public readonly string $distanceField; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $near The point for which to find the closest documents. */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $near; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $near; - /** @var Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. */ - public readonly Optional|Decimal128|Int64|float|int $distanceMultiplier; + /** @var Optional|Decimal128|Int64|float|int|string $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. */ + public readonly Optional|Decimal128|Int64|float|int|string $distanceMultiplier; /** @var Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. */ public readonly Optional|string $includeLocs; @@ -62,16 +62,16 @@ final class GeoNearStage implements StageInterface, OperatorInterface public readonly Optional|string $key; /** - * @var Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * @var Optional|Decimal128|Int64|float|int|string $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. */ - public readonly Optional|Decimal128|Int64|float|int $maxDistance; + public readonly Optional|Decimal128|Int64|float|int|string $maxDistance; /** - * @var Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * @var Optional|Decimal128|Int64|float|int|string $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. */ - public readonly Optional|Decimal128|Int64|float|int $minDistance; + public readonly Optional|Decimal128|Int64|float|int|string $minDistance; /** * @var Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. @@ -80,40 +80,40 @@ final class GeoNearStage implements StageInterface, OperatorInterface public readonly Optional|QueryInterface|array $query; /** - * @var Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * @var Optional|bool|string $spherical Determines how MongoDB calculates the distance between two points: * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. * Default: false. */ - public readonly Optional|bool $spherical; + public readonly Optional|bool|string $spherical; /** * @param string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. - * @param Document|ResolvesToObject|Serializable|array|stdClass $near The point for which to find the closest documents. - * @param Optional|Decimal128|Int64|float|int $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $near The point for which to find the closest documents. + * @param Optional|Decimal128|Int64|float|int|string $distanceMultiplier The factor to multiply all distances returned by the query. For example, use the distanceMultiplier to convert radians, as returned by a spherical query, to kilometers by multiplying by the radius of the Earth. * @param Optional|string $includeLocs This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field contains multiple locations. To specify a field within an embedded document, use dot notation. * @param Optional|string $key Specify the geospatial indexed field to use when calculating the distance. - * @param Optional|Decimal128|Int64|float|int $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $maxDistance The maximum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall within the specified distance from the center point. * Specify the distance in meters if the specified point is GeoJSON and in radians if the specified point is legacy coordinate pairs. - * @param Optional|Decimal128|Int64|float|int $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. + * @param Optional|Decimal128|Int64|float|int|string $minDistance The minimum distance from the center point that the documents can be. MongoDB limits the results to those documents that fall outside the specified distance from the center point. * Specify the distance in meters for GeoJSON data and in radians for legacy coordinate pairs. * @param Optional|QueryInterface|array $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. * You cannot specify a $near predicate in the query field of the $geoNear stage. - * @param Optional|bool $spherical Determines how MongoDB calculates the distance between two points: + * @param Optional|bool|string $spherical Determines how MongoDB calculates the distance between two points: * - When true, MongoDB uses $nearSphere semantics and calculates distances using spherical geometry. * - When false, MongoDB uses $near semantics: spherical geometry for 2dsphere indexes and planar geometry for 2d indexes. * Default: false. */ public function __construct( string $distanceField, - Document|Serializable|ResolvesToObject|stdClass|array $near, - Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, + Document|Serializable|ResolvesToObject|stdClass|array|string $near, + Optional|Decimal128|Int64|float|int|string $distanceMultiplier = Optional::Undefined, Optional|string $includeLocs = Optional::Undefined, Optional|string $key = Optional::Undefined, - Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int|string $minDistance = Optional::Undefined, Optional|QueryInterface|array $query = Optional::Undefined, - Optional|bool $spherical = Optional::Undefined, + Optional|bool|string $spherical = Optional::Undefined, ) { $this->distanceField = $distanceField; $this->near = $near; diff --git a/src/Builder/Stage/GraphLookupStage.php b/src/Builder/Stage/GraphLookupStage.php index 936b59861..b4257f795 100644 --- a/src/Builder/Stage/GraphLookupStage.php +++ b/src/Builder/Stage/GraphLookupStage.php @@ -64,8 +64,8 @@ final class GraphLookupStage implements StageInterface, OperatorInterface /** @var string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. */ public readonly string $as; - /** @var Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. */ - public readonly Optional|int $maxDepth; + /** @var Optional|int|string $maxDepth Non-negative integral number specifying the maximum recursion depth. */ + public readonly Optional|int|string $maxDepth; /** @var Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. */ public readonly Optional|string $depthField; @@ -80,7 +80,7 @@ final class GraphLookupStage implements StageInterface, OperatorInterface * @param string $connectFromField Field name whose value $graphLookup uses to recursively match against the connectToField of other documents in the collection. If the value is an array, each element is individually followed through the traversal process. * @param string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. * @param string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. - * @param Optional|int $maxDepth Non-negative integral number specifying the maximum recursion depth. + * @param Optional|int|string $maxDepth Non-negative integral number specifying the maximum recursion depth. * @param Optional|string $depthField Name of the field to add to each traversed document in the search path. The value of this field is the recursion depth for the document, represented as a NumberLong. Recursion depth value starts at zero, so the first lookup corresponds to zero depth. * @param Optional|QueryInterface|array $restrictSearchWithMatch A document specifying additional conditions for the recursive search. The syntax is identical to query filter syntax. */ @@ -90,7 +90,7 @@ public function __construct( string $connectFromField, string $connectToField, string $as, - Optional|int $maxDepth = Optional::Undefined, + Optional|int|string $maxDepth = Optional::Undefined, Optional|string $depthField = Optional::Undefined, Optional|QueryInterface|array $restrictSearchWithMatch = Optional::Undefined, ) { diff --git a/src/Builder/Stage/LimitStage.php b/src/Builder/Stage/LimitStage.php index ec765fa8a..edd09a475 100644 --- a/src/Builder/Stage/LimitStage.php +++ b/src/Builder/Stage/LimitStage.php @@ -24,13 +24,13 @@ final class LimitStage implements StageInterface, OperatorInterface public const NAME = '$limit'; public const PROPERTIES = ['limit' => 'limit']; - /** @var int $limit */ - public readonly int $limit; + /** @var int|string $limit */ + public readonly int|string $limit; /** - * @param int $limit + * @param int|string $limit */ - public function __construct(int $limit) + public function __construct(int|string $limit) { $this->limit = $limit; } diff --git a/src/Builder/Stage/ListLocalSessionsStage.php b/src/Builder/Stage/ListLocalSessionsStage.php index f438b0148..31701f75d 100644 --- a/src/Builder/Stage/ListLocalSessionsStage.php +++ b/src/Builder/Stage/ListLocalSessionsStage.php @@ -31,19 +31,19 @@ final class ListLocalSessionsStage implements StageInterface, OperatorInterface public const NAME = '$listLocalSessions'; public const PROPERTIES = ['users' => 'users', 'allUsers' => 'allUsers']; - /** @var Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ - public readonly Optional|PackedArray|BSONArray|array $users; + /** @var Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ + public readonly Optional|PackedArray|BSONArray|array|string $users; - /** @var Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ - public readonly Optional|bool $allUsers; + /** @var Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ + public readonly Optional|bool|string $allUsers; /** - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public function __construct( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, ) { if (is_array($users) && ! array_is_list($users)) { throw new InvalidArgumentException('Expected $users argument to be a list, got an associative array.'); diff --git a/src/Builder/Stage/ListSessionsStage.php b/src/Builder/Stage/ListSessionsStage.php index 687425ce1..66919c075 100644 --- a/src/Builder/Stage/ListSessionsStage.php +++ b/src/Builder/Stage/ListSessionsStage.php @@ -31,19 +31,19 @@ final class ListSessionsStage implements StageInterface, OperatorInterface public const NAME = '$listSessions'; public const PROPERTIES = ['users' => 'users', 'allUsers' => 'allUsers']; - /** @var Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ - public readonly Optional|PackedArray|BSONArray|array $users; + /** @var Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. */ + public readonly Optional|PackedArray|BSONArray|array|string $users; - /** @var Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ - public readonly Optional|bool $allUsers; + /** @var Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ + public readonly Optional|bool|string $allUsers; /** - * @param Optional|BSONArray|PackedArray|array $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. - * @param Optional|bool $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. + * @param Optional|BSONArray|PackedArray|array|string $users Returns all sessions for the specified users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster to list sessions for other users. + * @param Optional|bool|string $allUsers Returns all sessions for all users. If running with access control, the authenticated user must have privileges with listSessions action on the cluster. */ public function __construct( - Optional|PackedArray|BSONArray|array $users = Optional::Undefined, - Optional|bool $allUsers = Optional::Undefined, + Optional|PackedArray|BSONArray|array|string $users = Optional::Undefined, + Optional|bool|string $allUsers = Optional::Undefined, ) { if (is_array($users) && ! array_is_list($users)) { throw new InvalidArgumentException('Expected $users argument to be a list, got an associative array.'); diff --git a/src/Builder/Stage/LookupStage.php b/src/Builder/Stage/LookupStage.php index a9bf0d7ee..a473de6e7 100644 --- a/src/Builder/Stage/LookupStage.php +++ b/src/Builder/Stage/LookupStage.php @@ -59,8 +59,8 @@ final class LookupStage implements StageInterface, OperatorInterface /** @var Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. */ public readonly Optional|string $foreignField; - /** @var Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. */ - public readonly Optional|Document|Serializable|stdClass|array $let; + /** @var Optional|Document|Serializable|array|stdClass|string $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. */ + public readonly Optional|Document|Serializable|stdClass|array|string $let; /** * @var Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. @@ -76,7 +76,7 @@ final class LookupStage implements StageInterface, OperatorInterface * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. * @param Optional|string $localField Specifies the field from the documents input to the $lookup stage. $lookup performs an equality match on the localField to the foreignField from the documents of the from collection. If an input document does not contain the localField, the $lookup treats the field as having a value of null for matching purposes. * @param Optional|string $foreignField Specifies the field from the documents in the from collection. $lookup performs an equality match on the foreignField to the localField from the input documents. If a document in the from collection does not contain the foreignField, the $lookup treats the value as null for matching purposes. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables to use in the pipeline stages. Use the variable expressions to access the fields from the joined collection's documents that are input to the pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array $pipeline Specifies the pipeline to run on the joined collection. The pipeline determines the resulting documents from the joined collection. To return all documents, specify an empty pipeline []. * The pipeline cannot include the $out stage or the $merge stage. Starting in v6.0, the pipeline can contain the Atlas Search $search stage as the first stage inside the pipeline. * The pipeline cannot directly access the joined document fields. Instead, define variables for the joined document fields using the let option and then reference the variables in the pipeline stages. @@ -86,7 +86,7 @@ public function __construct( Optional|string $from = Optional::Undefined, Optional|string $localField = Optional::Undefined, Optional|string $foreignField = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array $pipeline = Optional::Undefined, ) { $this->as = $as; diff --git a/src/Builder/Stage/MergeStage.php b/src/Builder/Stage/MergeStage.php index 2fc3e94da..0d63e40c0 100644 --- a/src/Builder/Stage/MergeStage.php +++ b/src/Builder/Stage/MergeStage.php @@ -49,8 +49,8 @@ final class MergeStage implements StageInterface, OperatorInterface /** @var Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. */ public readonly Optional|PackedArray|BSONArray|array|string $on; - /** @var Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. */ - public readonly Optional|Document|Serializable|stdClass|array $let; + /** @var Optional|Document|Serializable|array|stdClass|string $let Specifies variables for use in the whenMatched pipeline. */ + public readonly Optional|Document|Serializable|stdClass|array|string $let; /** @var Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). */ public readonly Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched; @@ -61,14 +61,14 @@ final class MergeStage implements StageInterface, OperatorInterface /** * @param Document|Serializable|array|stdClass|string $into The output collection. * @param Optional|BSONArray|PackedArray|array|string $on Field or fields that act as a unique identifier for a document. The identifier determines if a results document matches an existing document in the output collection. - * @param Optional|Document|Serializable|array|stdClass $let Specifies variables for use in the whenMatched pipeline. + * @param Optional|Document|Serializable|array|stdClass|string $let Specifies variables for use in the whenMatched pipeline. * @param Optional|BSONArray|PackedArray|Pipeline|array|string $whenMatched The behavior of $merge if a result document and an existing document in the collection have the same value for the specified on field(s). * @param Optional|string $whenNotMatched The behavior of $merge if a result document does not match an existing document in the out collection. */ public function __construct( Document|Serializable|stdClass|array|string $into, Optional|PackedArray|BSONArray|array|string $on = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $let = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $let = Optional::Undefined, Optional|PackedArray|Pipeline|BSONArray|array|string $whenMatched = Optional::Undefined, Optional|string $whenNotMatched = Optional::Undefined, ) { diff --git a/src/Builder/Stage/ReplaceRootStage.php b/src/Builder/Stage/ReplaceRootStage.php index f88bf07b2..c4d636a2d 100644 --- a/src/Builder/Stage/ReplaceRootStage.php +++ b/src/Builder/Stage/ReplaceRootStage.php @@ -28,13 +28,13 @@ final class ReplaceRootStage implements StageInterface, OperatorInterface public const NAME = '$replaceRoot'; public const PROPERTIES = ['newRoot' => 'newRoot']; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $newRoot */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $newRoot; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot; /** - * @param Document|ResolvesToObject|Serializable|array|stdClass $newRoot + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $newRoot */ - public function __construct(Document|Serializable|ResolvesToObject|stdClass|array $newRoot) + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $newRoot) { $this->newRoot = $newRoot; } diff --git a/src/Builder/Stage/ReplaceWithStage.php b/src/Builder/Stage/ReplaceWithStage.php index 84d6ffda4..4db813e6a 100644 --- a/src/Builder/Stage/ReplaceWithStage.php +++ b/src/Builder/Stage/ReplaceWithStage.php @@ -29,13 +29,13 @@ final class ReplaceWithStage implements StageInterface, OperatorInterface public const NAME = '$replaceWith'; public const PROPERTIES = ['expression' => 'expression']; - /** @var Document|ResolvesToObject|Serializable|array|stdClass $expression */ - public readonly Document|Serializable|ResolvesToObject|stdClass|array $expression; + /** @var Document|ResolvesToObject|Serializable|array|stdClass|string $expression */ + public readonly Document|Serializable|ResolvesToObject|stdClass|array|string $expression; /** - * @param Document|ResolvesToObject|Serializable|array|stdClass $expression + * @param Document|ResolvesToObject|Serializable|array|stdClass|string $expression */ - public function __construct(Document|Serializable|ResolvesToObject|stdClass|array $expression) + public function __construct(Document|Serializable|ResolvesToObject|stdClass|array|string $expression) { $this->expression = $expression; } diff --git a/src/Builder/Stage/SampleStage.php b/src/Builder/Stage/SampleStage.php index c00b2bb26..dc19083ae 100644 --- a/src/Builder/Stage/SampleStage.php +++ b/src/Builder/Stage/SampleStage.php @@ -24,13 +24,13 @@ final class SampleStage implements StageInterface, OperatorInterface public const NAME = '$sample'; public const PROPERTIES = ['size' => 'size']; - /** @var int $size The number of documents to randomly select. */ - public readonly int $size; + /** @var int|string $size The number of documents to randomly select. */ + public readonly int|string $size; /** - * @param int $size The number of documents to randomly select. + * @param int|string $size The number of documents to randomly select. */ - public function __construct(int $size) + public function __construct(int|string $size) { $this->size = $size; } diff --git a/src/Builder/Stage/SearchMetaStage.php b/src/Builder/Stage/SearchMetaStage.php index 14687161b..e90d75619 100644 --- a/src/Builder/Stage/SearchMetaStage.php +++ b/src/Builder/Stage/SearchMetaStage.php @@ -39,19 +39,19 @@ final class SearchMetaStage implements StageInterface, OperatorInterface /** @var Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. */ public readonly Optional|string $index; - /** @var Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. */ - public readonly Optional|Document|Serializable|stdClass|array $count; + /** @var Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. */ + public readonly Optional|Document|Serializable|stdClass|array|string $count; /** * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to default. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. */ public function __construct( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, ) { $this->operator = $operator; $this->index = $index; diff --git a/src/Builder/Stage/SearchStage.php b/src/Builder/Stage/SearchStage.php index 1aac4a423..03f3419e4 100644 --- a/src/Builder/Stage/SearchStage.php +++ b/src/Builder/Stage/SearchStage.php @@ -52,18 +52,18 @@ final class SearchStage implements StageInterface, OperatorInterface /** @var Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". */ public readonly Optional|string $index; - /** @var Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. */ - public readonly Optional|Document|Serializable|stdClass|array $highlight; + /** @var Optional|Document|Serializable|array|stdClass|string $highlight Specifies the highlighting options for displaying search terms in their original context. */ + public readonly Optional|Document|Serializable|stdClass|array|string $highlight; /** - * @var Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * @var Optional|bool|string $concurrent Parallelize search across segments on dedicated search nodes. * If you don't have separate search nodes on your cluster, * Atlas Search ignores this flag. If omitted, defaults to false. */ - public readonly Optional|bool $concurrent; + public readonly Optional|bool|string $concurrent; - /** @var Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. */ - public readonly Optional|Document|Serializable|stdClass|array $count; + /** @var Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. */ + public readonly Optional|Document|Serializable|stdClass|array|string $count; /** @var Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. */ public readonly Optional|string $searchAfter; @@ -71,46 +71,46 @@ final class SearchStage implements StageInterface, OperatorInterface /** @var Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. */ public readonly Optional|string $searchBefore; - /** @var Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. */ - public readonly Optional|bool $scoreDetails; + /** @var Optional|bool|string $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. */ + public readonly Optional|bool|string $scoreDetails; - /** @var Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. */ - public readonly Optional|Document|Serializable|stdClass|array $sort; + /** @var Optional|Document|Serializable|array|stdClass|string $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. */ + public readonly Optional|Document|Serializable|stdClass|array|string $sort; - /** @var Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. */ - public readonly Optional|bool $returnStoredSource; + /** @var Optional|bool|string $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. */ + public readonly Optional|bool|string $returnStoredSource; - /** @var Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ - public readonly Optional|Document|Serializable|stdClass|array $tracking; + /** @var Optional|Document|Serializable|array|stdClass|string $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ + public readonly Optional|Document|Serializable|stdClass|array|string $tracking; /** * @param Document|SearchOperatorInterface|Serializable|array|stdClass $operator Operator to search with. You can provide a specific operator or use * the compound operator to run a compound query with multiple operators. * @param Optional|string $index Name of the Atlas Search index to use. If omitted, defaults to "default". - * @param Optional|Document|Serializable|array|stdClass $highlight Specifies the highlighting options for displaying search terms in their original context. - * @param Optional|bool $concurrent Parallelize search across segments on dedicated search nodes. + * @param Optional|Document|Serializable|array|stdClass|string $highlight Specifies the highlighting options for displaying search terms in their original context. + * @param Optional|bool|string $concurrent Parallelize search across segments on dedicated search nodes. * If you don't have separate search nodes on your cluster, * Atlas Search ignores this flag. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $count Document that specifies the count options for retrieving a count of the results. + * @param Optional|Document|Serializable|array|stdClass|string $count Document that specifies the count options for retrieving a count of the results. * @param Optional|string $searchAfter Reference point for retrieving results. searchAfter returns documents starting immediately following the specified reference point. * @param Optional|string $searchBefore Reference point for retrieving results. searchBefore returns documents starting immediately before the specified reference point. - * @param Optional|bool $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. - * @param Optional|Document|Serializable|array|stdClass $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. - * @param Optional|bool $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. - * @param Optional|Document|Serializable|array|stdClass $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. + * @param Optional|bool|string $scoreDetails Flag that specifies whether to retrieve a detailed breakdown of the score for the documents in the results. If omitted, defaults to false. + * @param Optional|Document|Serializable|array|stdClass|string $sort Document that specifies the fields to sort the Atlas Search results by in ascending or descending order. + * @param Optional|bool|string $returnStoredSource Flag that specifies whether to perform a full document lookup on the backend database or return only stored source fields directly from Atlas Search. + * @param Optional|Document|Serializable|array|stdClass|string $tracking Document that specifies the tracking option to retrieve analytics information on the search terms. */ public function __construct( Document|Serializable|SearchOperatorInterface|stdClass|array $operator, Optional|string $index = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $highlight = Optional::Undefined, - Optional|bool $concurrent = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $count = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $highlight = Optional::Undefined, + Optional|bool|string $concurrent = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $count = Optional::Undefined, Optional|string $searchAfter = Optional::Undefined, Optional|string $searchBefore = Optional::Undefined, - Optional|bool $scoreDetails = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $sort = Optional::Undefined, - Optional|bool $returnStoredSource = Optional::Undefined, - Optional|Document|Serializable|stdClass|array $tracking = Optional::Undefined, + Optional|bool|string $scoreDetails = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $sort = Optional::Undefined, + Optional|bool|string $returnStoredSource = Optional::Undefined, + Optional|Document|Serializable|stdClass|array|string $tracking = Optional::Undefined, ) { $this->operator = $operator; $this->index = $index; diff --git a/src/Builder/Stage/SetWindowFieldsStage.php b/src/Builder/Stage/SetWindowFieldsStage.php index ba8d63edf..4632532a2 100644 --- a/src/Builder/Stage/SetWindowFieldsStage.php +++ b/src/Builder/Stage/SetWindowFieldsStage.php @@ -31,27 +31,27 @@ final class SetWindowFieldsStage implements StageInterface, OperatorInterface public const NAME = '$setWindowFields'; public const PROPERTIES = ['sortBy' => 'sortBy', 'output' => 'output', 'partitionBy' => 'partitionBy']; - /** @var Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. */ - public readonly Document|Serializable|stdClass|array $sortBy; + /** @var Document|Serializable|array|stdClass|string $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. */ + public readonly Document|Serializable|stdClass|array|string $sortBy; /** - * @var Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * @var Document|Serializable|array|stdClass|string $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. */ - public readonly Document|Serializable|stdClass|array $output; + public readonly Document|Serializable|stdClass|array|string $output; /** @var Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. */ public readonly Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy; /** - * @param Document|Serializable|array|stdClass $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. - * @param Document|Serializable|array|stdClass $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. + * @param Document|Serializable|array|stdClass|string $sortBy Specifies the field(s) to sort the documents by in the partition. Uses the same syntax as the $sort stage. Default is no sorting. + * @param Document|Serializable|array|stdClass|string $output Specifies the field(s) to append to the documents in the output returned by the $setWindowFields stage. Each field is set to the result returned by the window operator. * A field can contain dots to specify embedded document fields and array fields. The semantics for the embedded document dotted notation in the $setWindowFields stage are the same as the $addFields and $set stages. * @param Optional|ExpressionInterface|Type|array|bool|float|int|null|stdClass|string $partitionBy Specifies an expression to group the documents. In the $setWindowFields stage, the group of documents is known as a partition. Default is one partition for the entire collection. */ public function __construct( - Document|Serializable|stdClass|array $sortBy, - Document|Serializable|stdClass|array $output, + Document|Serializable|stdClass|array|string $sortBy, + Document|Serializable|stdClass|array|string $output, Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy = Optional::Undefined, ) { $this->sortBy = $sortBy; diff --git a/src/Builder/Stage/SkipStage.php b/src/Builder/Stage/SkipStage.php index aab0242d8..807075bd4 100644 --- a/src/Builder/Stage/SkipStage.php +++ b/src/Builder/Stage/SkipStage.php @@ -24,13 +24,13 @@ final class SkipStage implements StageInterface, OperatorInterface public const NAME = '$skip'; public const PROPERTIES = ['skip' => 'skip']; - /** @var int $skip */ - public readonly int $skip; + /** @var int|string $skip */ + public readonly int|string $skip; /** - * @param int $skip + * @param int|string $skip */ - public function __construct(int $skip) + public function __construct(int|string $skip) { $this->skip = $skip; } diff --git a/src/Builder/Stage/UnwindStage.php b/src/Builder/Stage/UnwindStage.php index 9959f462b..653c6cc86 100644 --- a/src/Builder/Stage/UnwindStage.php +++ b/src/Builder/Stage/UnwindStage.php @@ -38,23 +38,23 @@ final class UnwindStage implements StageInterface, OperatorInterface public readonly Optional|string $includeArrayIndex; /** - * @var Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * @var Optional|bool|string $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. * If false, if path is null, missing, or an empty array, $unwind does not output a document. * The default value is false. */ - public readonly Optional|bool $preserveNullAndEmptyArrays; + public readonly Optional|bool|string $preserveNullAndEmptyArrays; /** * @param ArrayFieldPath|string $path Field path to an array field. * @param Optional|string $includeArrayIndex The name of a new field to hold the array index of the element. The name cannot start with a dollar sign $. - * @param Optional|bool $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. + * @param Optional|bool|string $preserveNullAndEmptyArrays If true, if the path is null, missing, or an empty array, $unwind outputs the document. * If false, if path is null, missing, or an empty array, $unwind does not output a document. * The default value is false. */ public function __construct( ArrayFieldPath|string $path, Optional|string $includeArrayIndex = Optional::Undefined, - Optional|bool $preserveNullAndEmptyArrays = Optional::Undefined, + Optional|bool|string $preserveNullAndEmptyArrays = Optional::Undefined, ) { $this->path = $path; $this->includeArrayIndex = $includeArrayIndex; diff --git a/src/Builder/Stage/VectorSearchStage.php b/src/Builder/Stage/VectorSearchStage.php index e8f7738cc..1ca5809ff 100644 --- a/src/Builder/Stage/VectorSearchStage.php +++ b/src/Builder/Stage/VectorSearchStage.php @@ -45,45 +45,45 @@ final class VectorSearchStage implements StageInterface, OperatorInterface /** @var string $index Name of the Atlas Vector Search index to use. */ public readonly string $index; - /** @var int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. */ - public readonly int $limit; + /** @var int|string $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. */ + public readonly int|string $limit; /** @var array|string $path Indexed vector type field to search. */ public readonly array|string $path; - /** @var BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. */ - public readonly PackedArray|BSONArray|array $queryVector; + /** @var BSONArray|PackedArray|array|string $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. */ + public readonly PackedArray|BSONArray|array|string $queryVector; - /** @var Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. */ - public readonly Optional|bool $exact; + /** @var Optional|bool|string $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. */ + public readonly Optional|bool|string $exact; /** @var Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. */ public readonly Optional|QueryInterface|array $filter; /** - * @var Optional|int $numCandidates This field is required if exact is false or omitted. + * @var Optional|int|string $numCandidates This field is required if exact is false or omitted. * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). */ - public readonly Optional|int $numCandidates; + public readonly Optional|int|string $numCandidates; /** * @param string $index Name of the Atlas Vector Search index to use. - * @param int $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. + * @param int|string $limit Number of documents to return in the results. This value can't exceed the value of numCandidates if you specify numCandidates. * @param array|string $path Indexed vector type field to search. - * @param BSONArray|PackedArray|array $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. - * @param Optional|bool $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. + * @param BSONArray|PackedArray|array|string $queryVector Array of numbers that represent the query vector. The number type must match the indexed field value type. + * @param Optional|bool|string $exact This is required if numCandidates is omitted. false to run ANN search. true to run ENN search. * @param Optional|QueryInterface|array $filter Any match query that compares an indexed field with a boolean, date, objectId, number (not decimals), string, or UUID to use as a pre-filter. - * @param Optional|int $numCandidates This field is required if exact is false or omitted. + * @param Optional|int|string $numCandidates This field is required if exact is false or omitted. * Number of nearest neighbors to use during the search. Value must be less than or equal to (<=) 10000. You can't specify a number less than the number of documents to return (limit). */ public function __construct( string $index, - int $limit, + int|string $limit, array|string $path, - PackedArray|BSONArray|array $queryVector, - Optional|bool $exact = Optional::Undefined, + PackedArray|BSONArray|array|string $queryVector, + Optional|bool|string $exact = Optional::Undefined, Optional|QueryInterface|array $filter = Optional::Undefined, - Optional|int $numCandidates = Optional::Undefined, + Optional|int|string $numCandidates = Optional::Undefined, ) { $this->index = $index; $this->limit = $limit;