From ad48be431bc2e88453552d0ac8290caee1634868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Tamarelle?= Date: Mon, 16 Oct 2023 09:56:21 +0200 Subject: [PATCH] Use BSON\Type and BSON\Javascript classes, remove duplicate resolveToInt --- generator/config/expressions.php | 11 +- generator/src/ExpressionClassGenerator.php | 12 +- src/Builder/Accumulator.php | 6 + .../Accumulator/AddToSetAccumulator.php | 24 +- src/Builder/Accumulator/AvgAccumulator.php | 9 +- src/Builder/Accumulator/BottomAccumulator.php | 19 +- .../Accumulator/BottomNAccumulator.php | 18 +- .../Accumulator/CovariancePopAccumulator.php | 17 +- .../Accumulator/CovarianceSampAccumulator.php | 17 +- .../Accumulator/DerivativeAccumulator.php | 9 +- .../Accumulator/ExpMovingAvgAccumulator.php | 9 +- src/Builder/Accumulator/FactoryTrait.php | 105 ++--- src/Builder/Accumulator/FirstAccumulator.php | 24 +- src/Builder/Accumulator/LastAccumulator.php | 24 +- src/Builder/Accumulator/MaxAccumulator.php | 24 +- src/Builder/Accumulator/MedianAccumulator.php | 9 +- src/Builder/Accumulator/MinAccumulator.php | 24 +- .../Accumulator/PercentileAccumulator.php | 9 +- src/Builder/Accumulator/PushAccumulator.php | 24 +- src/Builder/Accumulator/ShiftAccumulator.php | 29 +- .../Accumulator/StdDevPopAccumulator.php | 9 +- .../Accumulator/StdDevSampAccumulator.php | 9 +- src/Builder/Accumulator/SumAccumulator.php | 9 +- src/Builder/Accumulator/TopAccumulator.php | 19 +- src/Builder/Accumulator/TopNAccumulator.php | 18 +- src/Builder/Expression/AbsOperator.php | 8 +- src/Builder/Expression/AcosOperator.php | 8 +- src/Builder/Expression/AcoshOperator.php | 8 +- src/Builder/Expression/AddOperator.php | 9 +- src/Builder/Expression/AndOperator.php | 16 +- 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/CeilOperator.php | 8 +- src/Builder/Expression/CmpOperator.php | 28 +- src/Builder/Expression/CondOperator.php | 28 +- src/Builder/Expression/ConvertOperator.php | 36 +- src/Builder/Expression/CosOperator.php | 8 +- src/Builder/Expression/CoshOperator.php | 8 +- .../Expression/DateFromPartsOperator.php | 80 ++-- .../Expression/DateFromStringOperator.php | 28 +- .../Expression/DateToStringOperator.php | 17 +- src/Builder/Expression/DateTruncOperator.php | 8 +- .../Expression/DegreesToRadiansOperator.php | 8 +- src/Builder/Expression/DivideOperator.php | 16 +- src/Builder/Expression/EqOperator.php | 28 +- src/Builder/Expression/ExpOperator.php | 8 +- src/Builder/Expression/FactoryTrait.php | 434 +++++++++--------- src/Builder/Expression/FloorOperator.php | 8 +- src/Builder/Expression/FullDocument.php | 15 + src/Builder/Expression/GetFieldOperator.php | 20 +- src/Builder/Expression/GtOperator.php | 28 +- src/Builder/Expression/GteOperator.php | 28 +- src/Builder/Expression/IfNullOperator.php | 21 +- src/Builder/Expression/InOperator.php | 18 +- .../Expression/IndexOfArrayOperator.php | 20 +- src/Builder/Expression/IntegralOperator.php | 8 +- src/Builder/Expression/IsArrayOperator.php | 21 +- src/Builder/Expression/IsNumberOperator.php | 21 +- src/Builder/Expression/LetOperator.php | 18 +- src/Builder/Expression/LinearFillOperator.php | 8 +- src/Builder/Expression/LiteralOperator.php | 23 +- src/Builder/Expression/LnOperator.php | 8 +- src/Builder/Expression/LocfOperator.php | 23 +- src/Builder/Expression/Log10Operator.php | 8 +- src/Builder/Expression/LogOperator.php | 16 +- src/Builder/Expression/LtOperator.php | 28 +- src/Builder/Expression/LteOperator.php | 28 +- src/Builder/Expression/MapOperator.php | 18 +- src/Builder/Expression/MaxOperator.php | 21 +- src/Builder/Expression/MedianOperator.php | 8 +- src/Builder/Expression/MinOperator.php | 21 +- src/Builder/Expression/ModOperator.php | 16 +- src/Builder/Expression/MultiplyOperator.php | 6 +- src/Builder/Expression/NeOperator.php | 28 +- src/Builder/Expression/NotOperator.php | 20 +- src/Builder/Expression/OrOperator.php | 18 +- src/Builder/Expression/PercentileOperator.php | 8 +- src/Builder/Expression/PowOperator.php | 16 +- .../Expression/RadiansToDegreesOperator.php | 8 +- src/Builder/Expression/ReduceOperator.php | 26 +- src/Builder/Expression/SetFieldOperator.php | 18 +- src/Builder/Expression/SinOperator.php | 8 +- src/Builder/Expression/SinhOperator.php | 8 +- src/Builder/Expression/SqrtOperator.php | 8 +- src/Builder/Expression/StdDevPopOperator.php | 6 +- src/Builder/Expression/StdDevSampOperator.php | 6 +- src/Builder/Expression/SubtractOperator.php | 16 +- src/Builder/Expression/SumOperator.php | 6 +- src/Builder/Expression/SwitchOperator.php | 18 +- src/Builder/Expression/TanOperator.php | 8 +- src/Builder/Expression/TanhOperator.php | 8 +- src/Builder/Expression/ToBoolOperator.php | 23 +- src/Builder/Expression/ToDateOperator.php | 23 +- src/Builder/Expression/ToDecimalOperator.php | 23 +- src/Builder/Expression/ToDoubleOperator.php | 23 +- src/Builder/Expression/ToIntOperator.php | 23 +- src/Builder/Expression/ToLongOperator.php | 23 +- src/Builder/Expression/ToObjectIdOperator.php | 23 +- src/Builder/Expression/ToStringOperator.php | 23 +- src/Builder/Expression/TruncOperator.php | 8 +- src/Builder/Expression/TypeOperator.php | 23 +- src/Builder/Query/AllOperator.php | 22 +- src/Builder/Query/EqOperator.php | 24 +- src/Builder/Query/ExprOperator.php | 24 +- src/Builder/Query/FactoryTrait.php | 55 +-- src/Builder/Query/GtOperator.php | 24 +- src/Builder/Query/GteOperator.php | 24 +- src/Builder/Query/LtOperator.php | 24 +- src/Builder/Query/LteOperator.php | 24 +- src/Builder/Query/MaxDistanceOperator.php | 9 +- src/Builder/Query/NeOperator.php | 24 +- src/Builder/Stage/AddFieldsStage.php | 22 +- src/Builder/Stage/BucketAutoStage.php | 19 +- src/Builder/Stage/BucketStage.php | 25 +- src/Builder/Stage/FactoryTrait.php | 60 ++- src/Builder/Stage/GeoNearStage.php | 25 +- src/Builder/Stage/GraphLookupStage.php | 23 +- src/Builder/Stage/GroupStage.php | 19 +- src/Builder/Stage/RedactStage.php | 24 +- src/Builder/Stage/SetStage.php | 22 +- src/Builder/Stage/SetWindowFieldsStage.php | 19 +- src/Builder/Stage/SortByCountStage.php | 24 +- src/Builder/Type/OutputWindow.php | 2 +- tests/Builder/BuilderEncoderTest.php | 40 ++ 128 files changed, 1077 insertions(+), 1741 deletions(-) create mode 100644 src/Builder/Expression/FullDocument.php diff --git a/generator/config/expressions.php b/generator/config/expressions.php index 2dd0ca7db..95483b94b 100644 --- a/generator/config/expressions.php +++ b/generator/config/expressions.php @@ -11,9 +11,6 @@ use MongoDB\Model\BSONArray; use stdClass; -use function array_merge; -use function array_unique; -use function array_values; use function ucfirst; $bsonTypes = [ @@ -30,18 +27,18 @@ 'date' => [BSON\UTCDateTime::class], 'null' => ['null'], 'regex' => [BSON\Regex::class], - 'javascript' => ['string'], + 'javascript' => ['string', BSON\Javascript::class], 'int' => ['int'], 'timestamp' => ['int', BSON\Timestamp::class], - 'long' => ['int', BSON\Int64::class, ResolvesToInt::class], + 'long' => ['int', BSON\Int64::class], 'decimal' => ['int', BSON\Int64::class, 'float', BSON\Decimal128::class], ]; // "any" accepts all the BSON types. No generic "object" or "mixed" -$bsonTypes['any'] = array_unique(array_merge(...array_values($bsonTypes))); +$bsonTypes['any'] = ['bool', 'int', 'float', 'string', 'array', 'null', stdClass::class, BSON\Type::class]; // "number" accepts all the numeric types -$bsonTypes['number'] = array_unique(array_merge($bsonTypes['int'], $bsonTypes['double'], $bsonTypes['long'], $bsonTypes['decimal'])); +$bsonTypes['number'] = ['int', 'float', BSON\Int64::class, BSON\Decimal128::class]; $expressions = []; $resolvesToInterfaces = []; diff --git a/generator/src/ExpressionClassGenerator.php b/generator/src/ExpressionClassGenerator.php index 2f5960287..d9fb41653 100644 --- a/generator/src/ExpressionClassGenerator.php +++ b/generator/src/ExpressionClassGenerator.php @@ -12,6 +12,7 @@ use Throwable; use function array_map; +use function ucfirst; use function var_export; /** @@ -64,8 +65,15 @@ public function createClassOrInterface(ExpressionDefinition $definition): PhpNam $constructor->addParameter('name')->setType($propertyType); $constructor->addBody('$this->name = $name;'); } elseif ($definition->generate === PhpObject::PhpInterface) { - $class = $namespace->addInterface($className); - $class->setExtends($definition->implements); + $interface = $namespace->addInterface($className); + $interface->setExtends($definition->implements); + } elseif ($definition->generate === PhpObject::PhpEnum) { + $enum = $namespace->addEnum($className); + $enum->setType('string'); + array_map( + fn (string $case) => $enum->addCase(ucfirst($case), $case), + $definition->values, + ); } else { throw new LogicException('Unknown generate type: ' . var_export($definition->generate, true)); } diff --git a/src/Builder/Accumulator.php b/src/Builder/Accumulator.php index 2bde297ce..033ad1be5 100644 --- a/src/Builder/Accumulator.php +++ b/src/Builder/Accumulator.php @@ -9,6 +9,12 @@ use MongoDB\Builder\Type\WindowInterface; use stdClass; +/** + * Factories for Aggregation Pipeline Accumulator and Window Operators + * + * @see https://www.mongodb.com/docs/v3.4/reference/operator/aggregation-group/ + * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ + */ enum Accumulator { use Accumulator\FactoryTrait; diff --git a/src/Builder/Accumulator/AddToSetAccumulator.php b/src/Builder/Accumulator/AddToSetAccumulator.php index 8afdfad4c..4f91a8689 100644 --- a/src/Builder/Accumulator/AddToSetAccumulator.php +++ b/src/Builder/Accumulator/AddToSetAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$addToSet'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/AvgAccumulator.php b/src/Builder/Accumulator/AvgAccumulator.php index 96a54f569..7ea9aa61c 100644 --- a/src/Builder/Accumulator/AvgAccumulator.php +++ b/src/Builder/Accumulator/AvgAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -25,13 +24,13 @@ public const NAME = '$avg'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/BottomAccumulator.php b/src/Builder/Accumulator/BottomAccumulator.php index 2ee5962cb..11b6b1814 100644 --- a/src/Builder/Accumulator/BottomAccumulator.php +++ b/src/Builder/Accumulator/BottomAccumulator.php @@ -6,22 +6,13 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -38,16 +29,16 @@ /** @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ public Document|Serializable|stdClass|array $sortBy; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ + public 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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ public function __construct( Document|Serializable|stdClass|array $sortBy, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->sortBy = $sortBy; $this->output = $output; diff --git a/src/Builder/Accumulator/BottomNAccumulator.php b/src/Builder/Accumulator/BottomNAccumulator.php index cd498231f..57bf8d1f8 100644 --- a/src/Builder/Accumulator/BottomNAccumulator.php +++ b/src/Builder/Accumulator/BottomNAccumulator.php @@ -6,22 +6,14 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -42,18 +34,18 @@ /** @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ public Document|Serializable|stdClass|array $sortBy; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ + public 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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->n = $n; $this->sortBy = $sortBy; diff --git a/src/Builder/Accumulator/CovariancePopAccumulator.php b/src/Builder/Accumulator/CovariancePopAccumulator.php index fcf19b4f1..7d6beeb47 100644 --- a/src/Builder/Accumulator/CovariancePopAccumulator.php +++ b/src/Builder/Accumulator/CovariancePopAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\WindowInterface; @@ -24,19 +23,19 @@ public const NAME = '$covariancePop'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression1; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression2; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|ResolvesToNumber|float|int $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Accumulator/CovarianceSampAccumulator.php b/src/Builder/Accumulator/CovarianceSampAccumulator.php index cf71604d0..548bc9ce7 100644 --- a/src/Builder/Accumulator/CovarianceSampAccumulator.php +++ b/src/Builder/Accumulator/CovarianceSampAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\WindowInterface; @@ -24,19 +23,19 @@ public const NAME = '$covarianceSamp'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression1; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression2; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|ResolvesToNumber|float|int $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Accumulator/DerivativeAccumulator.php b/src/Builder/Accumulator/DerivativeAccumulator.php index a2c783536..b995ad094 100644 --- a/src/Builder/Accumulator/DerivativeAccumulator.php +++ b/src/Builder/Accumulator/DerivativeAccumulator.php @@ -10,7 +10,6 @@ use MongoDB\BSON\Int64; use MongoDB\BSON\UTCDateTime; use MongoDB\Builder\Expression\ResolvesToDate; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\Optional; @@ -27,8 +26,8 @@ public const NAME = '$derivative'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input */ - public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input */ + public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input; /** * @param Optional|non-empty-string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". @@ -37,12 +36,12 @@ public Optional|string $unit; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input * @param Optional|non-empty-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|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, Optional|string $unit = Optional::Undefined, ) { $this->input = $input; diff --git a/src/Builder/Accumulator/ExpMovingAvgAccumulator.php b/src/Builder/Accumulator/ExpMovingAvgAccumulator.php index 28c5f4f76..7ea7cdcae 100644 --- a/src/Builder/Accumulator/ExpMovingAvgAccumulator.php +++ b/src/Builder/Accumulator/ExpMovingAvgAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\Optional; @@ -25,8 +24,8 @@ public const NAME = '$expMovingAvg'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $input */ + public 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. @@ -42,7 +41,7 @@ public Optional|Int64|float|int $alpha; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input + * @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. * 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: @@ -50,7 +49,7 @@ * You must specify either N or alpha. You cannot specify both. */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, Optional|int $N = Optional::Undefined, Optional|Int64|float|int $alpha = Optional::Undefined, ) { diff --git a/src/Builder/Accumulator/FactoryTrait.php b/src/Builder/Accumulator/FactoryTrait.php index 919164b97..624389e57 100644 --- a/src/Builder/Accumulator/FactoryTrait.php +++ b/src/Builder/Accumulator/FactoryTrait.php @@ -6,15 +6,12 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; +use MongoDB\BSON\Type; use MongoDB\BSON\UTCDateTime; use MongoDB\Builder\Expression\ResolvesToArray; use MongoDB\Builder\Expression\ResolvesToDate; @@ -62,10 +59,10 @@ public static function accumulator( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/addToSet/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function addToSet( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): AddToSetAccumulator { return new AddToSetAccumulator($expression); @@ -76,9 +73,9 @@ public static function addToSet( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function avg(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression): AvgAccumulator + public static function avg(Decimal128|Int64|ResolvesToNumber|float|int $expression): AvgAccumulator { return new AvgAccumulator($expression); } @@ -89,11 +86,11 @@ public static function avg(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * * @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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ public static function bottom( Document|Serializable|stdClass|array $sortBy, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): BottomAccumulator { return new BottomAccumulator($sortBy, $output); @@ -107,12 +104,12 @@ public static function bottom( * @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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): BottomNAccumulator { return new BottomNAccumulator($n, $sortBy, $output); @@ -135,12 +132,12 @@ public static function count(): CountAccumulator * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covariancePop/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ public static function covariancePop( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|ResolvesToNumber|float|int $expression2, ): CovariancePopAccumulator { return new CovariancePopAccumulator($expression1, $expression2); @@ -151,12 +148,12 @@ public static function covariancePop( * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/covarianceSamp/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1 - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression1 + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression2 */ public static function covarianceSamp( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|ResolvesToNumber|float|int $expression2, ): CovarianceSampAccumulator { return new CovarianceSampAccumulator($expression1, $expression2); @@ -178,12 +175,12 @@ public static function denseRank(): DenseRankAccumulator * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/derivative/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input * @param Optional|non-empty-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|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, Optional|string $unit = Optional::Undefined, ): DerivativeAccumulator { @@ -206,7 +203,7 @@ public static function documentNumber(): DocumentNumberAccumulator * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/expMovingAvg/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input + * @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. * 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: @@ -214,7 +211,7 @@ public static function documentNumber(): DocumentNumberAccumulator * You must specify either N or alpha. You cannot specify both. */ public static function expMovingAvg( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, Optional|int $N = Optional::Undefined, Optional|Int64|float|int $alpha = Optional::Undefined, ): ExpMovingAvgAccumulator @@ -227,10 +224,10 @@ public static function expMovingAvg( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/first/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function first( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): FirstAccumulator { return new FirstAccumulator($expression); @@ -256,10 +253,10 @@ public static function firstN( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/last/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function last( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): LastAccumulator { return new LastAccumulator($expression); @@ -285,10 +282,10 @@ public static function lastN( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function max( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): MaxAccumulator { return new MaxAccumulator($expression); @@ -318,11 +315,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|ResolvesToInt|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 $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 non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public static function median( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, string $method, ): MedianAccumulator { @@ -347,10 +344,10 @@ public static function mergeObjects( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function min( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): MinAccumulator { return new MinAccumulator($expression); @@ -383,13 +380,13 @@ 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|ResolvesToInt|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 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. * $percentile returns results in the same order as the elements in p. * @param non-empty-string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public static function percentile( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, PackedArray|ResolvesToArray|BSONArray|array $p, string $method, ): PercentileAccumulator @@ -402,10 +399,10 @@ public static function percentile( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/push/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function push( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): PushAccumulator { return new PushAccumulator($expression); @@ -416,20 +413,20 @@ public static function push( * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/shift/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Specifies an expression to evaluate and return in the output. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * The default expression must evaluate to a constant value. * If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. */ public static function shift( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, int $by, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default, ): ShiftAccumulator { return new ShiftAccumulator($output, $by, $default); @@ -441,11 +438,9 @@ public static function shift( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function stdDevPop( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression, - ): StdDevPopAccumulator + public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int $expression): StdDevPopAccumulator { return new StdDevPopAccumulator($expression); } @@ -456,11 +451,9 @@ public static function stdDevPop( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function stdDevSamp( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression, - ): StdDevSampAccumulator + public static function stdDevSamp(Decimal128|Int64|ResolvesToNumber|float|int $expression): StdDevSampAccumulator { return new StdDevSampAccumulator($expression); } @@ -470,9 +463,9 @@ public static function stdDevSamp( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function sum(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression): SumAccumulator + public static function sum(Decimal128|Int64|ResolvesToNumber|float|int $expression): SumAccumulator { return new SumAccumulator($expression); } @@ -485,11 +478,11 @@ public static function sum(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * * @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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ public static function top( Document|Serializable|stdClass|array $sortBy, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): TopAccumulator { return new TopAccumulator($sortBy, $output); @@ -504,12 +497,12 @@ public static function top( * @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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ): TopNAccumulator { return new TopNAccumulator($n, $sortBy, $output); diff --git a/src/Builder/Accumulator/FirstAccumulator.php b/src/Builder/Accumulator/FirstAccumulator.php index 2a333ddde..3950a464d 100644 --- a/src/Builder/Accumulator/FirstAccumulator.php +++ b/src/Builder/Accumulator/FirstAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$first'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/LastAccumulator.php b/src/Builder/Accumulator/LastAccumulator.php index 59462e7ac..5126c3b64 100644 --- a/src/Builder/Accumulator/LastAccumulator.php +++ b/src/Builder/Accumulator/LastAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$last'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/MaxAccumulator.php b/src/Builder/Accumulator/MaxAccumulator.php index 8e77c969d..9f6bb56e6 100644 --- a/src/Builder/Accumulator/MaxAccumulator.php +++ b/src/Builder/Accumulator/MaxAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$max'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/MedianAccumulator.php b/src/Builder/Accumulator/MedianAccumulator.php index 7080fb6c1..13594239a 100644 --- a/src/Builder/Accumulator/MedianAccumulator.php +++ b/src/Builder/Accumulator/MedianAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -29,17 +28,17 @@ public const NAME = '$median'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $input; /** @param non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public string $method; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, string $method) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $input, string $method) { $this->input = $input; $this->method = $method; diff --git a/src/Builder/Accumulator/MinAccumulator.php b/src/Builder/Accumulator/MinAccumulator.php index bc590c29d..897bc6db9 100644 --- a/src/Builder/Accumulator/MinAccumulator.php +++ b/src/Builder/Accumulator/MinAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$min'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/PercentileAccumulator.php b/src/Builder/Accumulator/PercentileAccumulator.php index 9ca2f619c..b0ce299dc 100644 --- a/src/Builder/Accumulator/PercentileAccumulator.php +++ b/src/Builder/Accumulator/PercentileAccumulator.php @@ -10,7 +10,6 @@ use MongoDB\BSON\Int64; use MongoDB\BSON\PackedArray; use MongoDB\Builder\Expression\ResolvesToArray; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -39,8 +38,8 @@ public const NAME = '$percentile'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $input; /** * @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. @@ -52,13 +51,13 @@ public string $method; /** - * @param Decimal128|Int64|ResolvesToInt|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 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. * $percentile returns results in the same order as the elements in p. * @param non-empty-string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, PackedArray|ResolvesToArray|BSONArray|array $p, string $method, ) { diff --git a/src/Builder/Accumulator/PushAccumulator.php b/src/Builder/Accumulator/PushAccumulator.php index 56b32193c..efc2811c3 100644 --- a/src/Builder/Accumulator/PushAccumulator.php +++ b/src/Builder/Accumulator/PushAccumulator.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,15 +24,14 @@ public const NAME = '$push'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Accumulator/ShiftAccumulator.php b/src/Builder/Accumulator/ShiftAccumulator.php index 925db83e7..5c8a6ba4e 100644 --- a/src/Builder/Accumulator/ShiftAccumulator.php +++ b/src/Builder/Accumulator/ShiftAccumulator.php @@ -6,21 +6,10 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\WindowInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -34,8 +23,8 @@ public const NAME = '$shift'; public const ENCODE = Encode::Object; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Specifies an expression to evaluate and return in the output. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Specifies an expression to evaluate and return in the output. */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output; /** * @param int $by Specifies an integer with a numeric document position relative to the current document in the output. @@ -47,27 +36,27 @@ public int $by; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * The default expression must evaluate to a constant value. * If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default; + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Specifies an expression to evaluate and return in the output. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * The default expression must evaluate to a constant value. * If you do not specify a default expression, $shift returns null for documents whose positions are outside of the implicit $setWindowFields stage window. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, int $by, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default, ) { $this->output = $output; $this->by = $by; diff --git a/src/Builder/Accumulator/StdDevPopAccumulator.php b/src/Builder/Accumulator/StdDevPopAccumulator.php index 1cf46fe43..be80f63c5 100644 --- a/src/Builder/Accumulator/StdDevPopAccumulator.php +++ b/src/Builder/Accumulator/StdDevPopAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -25,13 +24,13 @@ public const NAME = '$stdDevPop'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/StdDevSampAccumulator.php b/src/Builder/Accumulator/StdDevSampAccumulator.php index 8a101b4c5..94f113100 100644 --- a/src/Builder/Accumulator/StdDevSampAccumulator.php +++ b/src/Builder/Accumulator/StdDevSampAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -25,13 +24,13 @@ public const NAME = '$stdDevSamp'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/SumAccumulator.php b/src/Builder/Accumulator/SumAccumulator.php index dd9ead632..3dab7231f 100644 --- a/src/Builder/Accumulator/SumAccumulator.php +++ b/src/Builder/Accumulator/SumAccumulator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToNumber; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; @@ -25,13 +24,13 @@ public const NAME = '$sum'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Accumulator/TopAccumulator.php b/src/Builder/Accumulator/TopAccumulator.php index 97db282f2..68df722e2 100644 --- a/src/Builder/Accumulator/TopAccumulator.php +++ b/src/Builder/Accumulator/TopAccumulator.php @@ -6,21 +6,12 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -39,16 +30,16 @@ /** @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ public Document|Serializable|stdClass|array $sortBy; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ + public 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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ public function __construct( Document|Serializable|stdClass|array $sortBy, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->sortBy = $sortBy; $this->output = $output; diff --git a/src/Builder/Accumulator/TopNAccumulator.php b/src/Builder/Accumulator/TopNAccumulator.php index 24b79e3ae..97ab95c13 100644 --- a/src/Builder/Accumulator/TopNAccumulator.php +++ b/src/Builder/Accumulator/TopNAccumulator.php @@ -6,21 +6,13 @@ namespace MongoDB\Builder\Accumulator; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -42,18 +34,18 @@ /** @param Document|Serializable|array|stdClass $sortBy Specifies the order of results, with syntax similar to $sort. */ public Document|Serializable|stdClass|array $sortBy; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. */ + public 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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $output Represents the output for each element in the group and can be any expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $output, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $output, ) { $this->n = $n; $this->sortBy = $sortBy; diff --git a/src/Builder/Expression/AbsOperator.php b/src/Builder/Expression/AbsOperator.php index 3a94e804e..0372c70c6 100644 --- a/src/Builder/Expression/AbsOperator.php +++ b/src/Builder/Expression/AbsOperator.php @@ -20,13 +20,13 @@ public const NAME = '$abs'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $value */ + public Decimal128|Int64|ResolvesToNumber|float|int $value; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value + * @param Decimal128|Int64|ResolvesToNumber|float|int $value */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $value) { $this->value = $value; } diff --git a/src/Builder/Expression/AcosOperator.php b/src/Builder/Expression/AcosOperator.php index d210a959b..b87811cf2 100644 --- a/src/Builder/Expression/AcosOperator.php +++ b/src/Builder/Expression/AcosOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AcoshOperator.php b/src/Builder/Expression/AcoshOperator.php index eb37f7837..9bf8cc4ed 100644 --- a/src/Builder/Expression/AcoshOperator.php +++ b/src/Builder/Expression/AcoshOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AddOperator.php b/src/Builder/Expression/AddOperator.php index a036b6c52..50d56a996 100644 --- a/src/Builder/Expression/AddOperator.php +++ b/src/Builder/Expression/AddOperator.php @@ -24,16 +24,15 @@ public const NAME = '$add'; public const ENCODE = Encode::Array; - /** @param list ...$expression The arguments can be any valid expression as long as they resolve to either all numbers or to numbers and a date. */ + /** @param 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 array $expression; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|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 ...$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|ResolvesToInt|ResolvesToNumber|float|int ...$expression, - ) { + public function __construct(Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int ...$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/AndOperator.php b/src/Builder/Expression/AndOperator.php index edea6e8f4..2064a0cf5 100644 --- a/src/Builder/Expression/AndOperator.php +++ b/src/Builder/Expression/AndOperator.php @@ -6,20 +6,12 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -34,15 +26,15 @@ public const NAME = '$and'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|ResolvesToNull|ResolvesToNumber|ResolvesToString|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param Decimal128|ExpressionInterface|Int64|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Decimal128|Int64|Type|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|stdClass|array|bool|float|int|null|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/AsinOperator.php b/src/Builder/Expression/AsinOperator.php index 48a516b1a..1296561b8 100644 --- a/src/Builder/Expression/AsinOperator.php +++ b/src/Builder/Expression/AsinOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AsinhOperator.php b/src/Builder/Expression/AsinhOperator.php index 3ab9f8bcc..9a5be89d8 100644 --- a/src/Builder/Expression/AsinhOperator.php +++ b/src/Builder/Expression/AsinhOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/Atan2Operator.php b/src/Builder/Expression/Atan2Operator.php index faff34777..5b36dbb28 100644 --- a/src/Builder/Expression/Atan2Operator.php +++ b/src/Builder/Expression/Atan2Operator.php @@ -21,24 +21,24 @@ public const ENCODE = Encode::Array; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $y; + public Decimal128|Int64|ResolvesToNumber|float|int $y; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $x */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $x; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $x */ + public Decimal128|Int64|ResolvesToNumber|float|int $x; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $x + * @param Decimal128|Int64|ResolvesToNumber|float|int $x */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $y, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $x, + Decimal128|Int64|ResolvesToNumber|float|int $y, + Decimal128|Int64|ResolvesToNumber|float|int $x, ) { $this->y = $y; $this->x = $x; diff --git a/src/Builder/Expression/AtanOperator.php b/src/Builder/Expression/AtanOperator.php index 04dc0886e..81d818dbb 100644 --- a/src/Builder/Expression/AtanOperator.php +++ b/src/Builder/Expression/AtanOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AtanhOperator.php b/src/Builder/Expression/AtanhOperator.php index 02257cf7d..034c4408a 100644 --- a/src/Builder/Expression/AtanhOperator.php +++ b/src/Builder/Expression/AtanhOperator.php @@ -21,18 +21,18 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/AvgOperator.php b/src/Builder/Expression/AvgOperator.php index f4ba4851f..9a889c100 100644 --- a/src/Builder/Expression/AvgOperator.php +++ b/src/Builder/Expression/AvgOperator.php @@ -24,14 +24,14 @@ public const NAME = '$avg'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$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/CeilOperator.php b/src/Builder/Expression/CeilOperator.php index 62b905b9b..e4c7ddfcf 100644 --- a/src/Builder/Expression/CeilOperator.php +++ b/src/Builder/Expression/CeilOperator.php @@ -20,13 +20,13 @@ public const NAME = '$ceil'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/CmpOperator.php b/src/Builder/Expression/CmpOperator.php index ee869ebaa..01b8303ac 100644 --- a/src/Builder/Expression/CmpOperator.php +++ b/src/Builder/Expression/CmpOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$cmp'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/CondOperator.php b/src/Builder/Expression/CondOperator.php index bf5bd504f..372f8d538 100644 --- a/src/Builder/Expression/CondOperator.php +++ b/src/Builder/Expression/CondOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -34,21 +24,21 @@ /** @param ResolvesToBool|bool $if */ public ResolvesToBool|bool $if; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $then */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $then; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $then */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $else */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $else; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $else */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else; /** * @param ResolvesToBool|bool $if - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $then - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $else + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $then + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $else */ public function __construct( ResolvesToBool|bool $if, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $then, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $else, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else, ) { $this->if = $if; $this->then = $then; diff --git a/src/Builder/Expression/ConvertOperator.php b/src/Builder/Expression/ConvertOperator.php index 73bbbff67..b8ea1743d 100644 --- a/src/Builder/Expression/ConvertOperator.php +++ b/src/Builder/Expression/ConvertOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -33,37 +23,37 @@ public const NAME = '$convert'; public const ENCODE = Encode::Object; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $input */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $input; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $input */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input; /** @param ResolvesToInt|ResolvesToString|int|non-empty-string $to */ public ResolvesToInt|ResolvesToString|int|string $to; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. * If unspecified, the operation throws an error upon encountering an error and stops. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError; + public Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. * If unspecified, $convert returns null if the input is null or missing. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull; + public Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $input + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $input * @param ResolvesToInt|ResolvesToString|int|non-empty-string $to - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. * If unspecified, the operation throws an error upon encountering an error and stops. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. * If unspecified, $convert returns null if the input is null or missing. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $input, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, ResolvesToInt|ResolvesToString|int|string $to, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ) { $this->input = $input; $this->to = $to; diff --git a/src/Builder/Expression/CosOperator.php b/src/Builder/Expression/CosOperator.php index 4b241ae8d..d1622aec0 100644 --- a/src/Builder/Expression/CosOperator.php +++ b/src/Builder/Expression/CosOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/CoshOperator.php b/src/Builder/Expression/CoshOperator.php index 64781be49..704bcf61a 100644 --- a/src/Builder/Expression/CoshOperator.php +++ b/src/Builder/Expression/CoshOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/DateFromPartsOperator.php b/src/Builder/Expression/DateFromPartsOperator.php index 063fa3513..3a05305dd 100644 --- a/src/Builder/Expression/DateFromPartsOperator.php +++ b/src/Builder/Expression/DateFromPartsOperator.php @@ -21,63 +21,63 @@ public const NAME = '$dateFromParts'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. */ + public Decimal128|Int64|ResolvesToNumber|float|int $year; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. */ + public Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month Month. Defaults to 1. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $month Month. Defaults to 1. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $month; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoWeek; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day Day of month. Defaults to 1. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $day Day of month. Defaults to 1. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $day; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $isoDayOfWeek; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour Hour. Defaults to 0. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour Hour. Defaults to 0. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $hour; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute Minute. Defaults to 0. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute Minute. Defaults to 0. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $minute; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second Second. Defaults to 0. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $second Second. Defaults to 0. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $second; - /** @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. */ - public Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond; + /** @param Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. */ + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $millisecond; /** @param Optional|ResolvesToString|non-empty-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 Optional|ResolvesToString|string $timezone; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month Month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day Day of month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour Hour. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute Minute. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second Second. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. + * @param Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. + * @param 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|ResolvesToString|non-empty-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( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int $year, + Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear, + 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|ResolvesToString|string $timezone = Optional::Undefined, ) { $this->year = $year; diff --git a/src/Builder/Expression/DateFromStringOperator.php b/src/Builder/Expression/DateFromStringOperator.php index 722a29c6c..f335d65b8 100644 --- a/src/Builder/Expression/DateFromStringOperator.php +++ b/src/Builder/Expression/DateFromStringOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -45,33 +35,33 @@ public Optional|ResolvesToString|string $timezone; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError; + public Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull; + public Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull; /** * @param ResolvesToString|non-empty-string $dateString The date/time string to convert to a date object. * @param Optional|ResolvesToString|non-empty-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|non-empty-string $timezone The time zone to use to format the date. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. */ public function __construct( ResolvesToString|string $dateString, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ) { $this->dateString = $dateString; $this->format = $format; diff --git a/src/Builder/Expression/DateToStringOperator.php b/src/Builder/Expression/DateToStringOperator.php index e0154d739..034e76ff5 100644 --- a/src/Builder/Expression/DateToStringOperator.php +++ b/src/Builder/Expression/DateToStringOperator.php @@ -6,20 +6,13 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; use MongoDB\BSON\Timestamp; +use MongoDB\BSON\Type; use MongoDB\BSON\UTCDateTime; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -45,24 +38,24 @@ public Optional|ResolvesToString|string $timezone; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. * If unspecified, $dateToString returns null if the date is null or missing. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull; + public 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 Optional|ResolvesToString|non-empty-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|non-empty-string $timezone The time zone to use to format the date. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. * If unspecified, $dateToString returns null if the date is null or missing. */ public function __construct( ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ) { $this->date = $date; $this->format = $format; diff --git a/src/Builder/Expression/DateTruncOperator.php b/src/Builder/Expression/DateTruncOperator.php index 8bd840407..e6b1ba404 100644 --- a/src/Builder/Expression/DateTruncOperator.php +++ b/src/Builder/Expression/DateTruncOperator.php @@ -34,10 +34,10 @@ public ResolvesToString|string $unit; /** - * @param Optional|Decimal128|Int64|ResolvesToInt|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 $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 Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $binSize; + public Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize; /** @param Optional|ResolvesToString|non-empty-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 Optional|ResolvesToString|string $timezone; @@ -52,7 +52,7 @@ * @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 ResolvesToString|non-empty-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|ResolvesToInt|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 $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|non-empty-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|non-empty-string $startOfWeek The start of the week. Used when @@ -61,7 +61,7 @@ public function __construct( ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, ResolvesToString|string $unit, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $binSize = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|string $startOfWeek = Optional::Undefined, ) { diff --git a/src/Builder/Expression/DegreesToRadiansOperator.php b/src/Builder/Expression/DegreesToRadiansOperator.php index 6c76805d1..30224e854 100644 --- a/src/Builder/Expression/DegreesToRadiansOperator.php +++ b/src/Builder/Expression/DegreesToRadiansOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/DivideOperator.php b/src/Builder/Expression/DivideOperator.php index e4148eb76..352688139 100644 --- a/src/Builder/Expression/DivideOperator.php +++ b/src/Builder/Expression/DivideOperator.php @@ -20,19 +20,19 @@ public const NAME = '$divide'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $dividend; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $divisor */ + public Decimal128|Int64|ResolvesToNumber|float|int $divisor; /** - * @param Decimal128|Int64|ResolvesToInt|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|ResolvesToInt|ResolvesToNumber|float|int $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 */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int $dividend, + Decimal128|Int64|ResolvesToNumber|float|int $divisor, ) { $this->dividend = $dividend; $this->divisor = $divisor; diff --git a/src/Builder/Expression/EqOperator.php b/src/Builder/Expression/EqOperator.php index c88e72a30..e13071881 100644 --- a/src/Builder/Expression/EqOperator.php +++ b/src/Builder/Expression/EqOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$eq'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/ExpOperator.php b/src/Builder/Expression/ExpOperator.php index b6818ba0b..a7bb2d39e 100644 --- a/src/Builder/Expression/ExpOperator.php +++ b/src/Builder/Expression/ExpOperator.php @@ -20,13 +20,13 @@ public const NAME = '$exp'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ + public Decimal128|Int64|ResolvesToNumber|float|int $exponent; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $exponent) { $this->exponent = $exponent; } diff --git a/src/Builder/Expression/FactoryTrait.php b/src/Builder/Expression/FactoryTrait.php index 4484c711e..56d26e781 100644 --- a/src/Builder/Expression/FactoryTrait.php +++ b/src/Builder/Expression/FactoryTrait.php @@ -15,6 +15,7 @@ use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; use MongoDB\BSON\Timestamp; +use MongoDB\BSON\Type; use MongoDB\BSON\UTCDateTime; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; @@ -30,9 +31,9 @@ trait FactoryTrait * Returns the absolute value of a number. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/abs/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value + * @param Decimal128|Int64|ResolvesToNumber|float|int $value */ - public static function abs(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $value): AbsOperator + public static function abs(Decimal128|Int64|ResolvesToNumber|float|int $value): AbsOperator { return new AbsOperator($value); } @@ -41,11 +42,11 @@ public static function abs(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AcosOperator + public static function acos(Decimal128|Int64|ResolvesToNumber|float|int $expression): AcosOperator { return new AcosOperator($expression); } @@ -54,11 +55,11 @@ public static function acos(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AcoshOperator + public static function acosh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AcoshOperator { return new AcoshOperator($expression); } @@ -67,10 +68,10 @@ public static function acosh(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|flo * Adds numbers to return the sum, or adds numbers and a date to return a new date. If adding numbers and a date, treats the numbers as milliseconds. Accepts any number of argument expressions, but at most, one expression can resolve to a date. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/add/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|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 ...$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|ResolvesToInt|ResolvesToNumber|float|int ...$expression, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int ...$expression, ): AddOperator { return new AddOperator(...$expression); @@ -93,10 +94,10 @@ public static function allElementsTrue( * Returns true only when all its expressions evaluate to true. Accepts any number of argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/and/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|ResolvesToNull|ResolvesToNumber|ResolvesToString|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param Decimal128|ExpressionInterface|Int64|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function and( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Decimal128|Int64|Type|ResolvesToBool|ResolvesToNull|ResolvesToNumber|ResolvesToString|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): AndOperator { return new AndOperator(...$expression); @@ -145,11 +146,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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AsinOperator + public static function asin(Decimal128|Int64|ResolvesToNumber|float|int $expression): AsinOperator { return new AsinOperator($expression); } @@ -158,11 +159,11 @@ public static function asin(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * 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|ResolvesToInt|ResolvesToNumber|float|int $expression $asinh takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AsinhOperator + public static function asinh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AsinhOperator { return new AsinhOperator($expression); } @@ -171,11 +172,11 @@ public static function asinh(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|flo * 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|ResolvesToInt|ResolvesToNumber|float|int $expression $atan takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AtanOperator + public static function atan(Decimal128|Int64|ResolvesToNumber|float|int $expression): AtanOperator { return new AtanOperator($expression); } @@ -184,14 +185,14 @@ public static function atan(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * 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|ResolvesToInt|ResolvesToNumber|float|int $y $atan2 takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $x + * @param Decimal128|Int64|ResolvesToNumber|float|int $x */ public static function atan2( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $y, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $x, + Decimal128|Int64|ResolvesToNumber|float|int $y, + Decimal128|Int64|ResolvesToNumber|float|int $x, ): Atan2Operator { return new Atan2Operator($y, $x); @@ -201,11 +202,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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): AtanhOperator + public static function atanh(Decimal128|Int64|ResolvesToNumber|float|int $expression): AtanhOperator { return new AtanhOperator($expression); } @@ -215,9 +216,9 @@ public static function atanh(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|flo * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/avg/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression */ - public static function avg(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression): AvgOperator + public static function avg(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): AvgOperator { return new AvgOperator(...$expression); } @@ -300,9 +301,9 @@ public static function bsonSize( * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): CeilOperator + public static function ceil(Decimal128|Int64|ResolvesToNumber|float|int $expression): CeilOperator { return new CeilOperator($expression); } @@ -311,12 +312,12 @@ public static function ceil(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * Returns 0 if the two values are equivalent, 1 if the first value is greater than the second, and -1 if the first value is less than the second. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cmp/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function cmp( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): CmpOperator { return new CmpOperator($expression1, $expression2); @@ -349,13 +350,13 @@ public static function concatArrays(PackedArray|ResolvesToArray|BSONArray|array * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/cond/ * @param ResolvesToBool|bool $if - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $then - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $else + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $then + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $else */ public static function cond( ResolvesToBool|bool $if, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $then, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $else, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $then, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $else, ): CondOperator { return new CondOperator($if, $then, $else); @@ -366,18 +367,18 @@ public static function cond( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/convert/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $input + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $input * @param ResolvesToInt|ResolvesToString|int|non-empty-string $to - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError The value to return on encountering an error during conversion, including unsupported type conversions. The arguments can be any valid expression. * If unspecified, the operation throws an error upon encountering an error and stops. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the input is null or missing. The arguments can be any valid expression. * If unspecified, $convert returns null if the input is null or missing. */ public static function convert( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $input, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input, ResolvesToInt|ResolvesToString|int|string $to, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ): ConvertOperator { return new ConvertOperator($input, $to, $onError, $onNull); @@ -387,10 +388,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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): CosOperator + public static function cos(Decimal128|Int64|ResolvesToNumber|float|int $expression): CosOperator { return new CosOperator($expression); } @@ -399,10 +400,10 @@ public static function cos(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): CoshOperator + public static function cosh(Decimal128|Int64|ResolvesToNumber|float|int $expression): CoshOperator { return new CoshOperator($expression); } @@ -451,29 +452,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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear ISO Week Date Year. Can be any expression that evaluates to a number. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month Month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek Week of year. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day Day of month. Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek Day of week (Monday 1 - Sunday 7). Defaults to 1. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour Hour. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute Minute. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second Second. Defaults to 0. - * @param Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond Millisecond. Defaults to 0. + * @param Decimal128|Int64|ResolvesToNumber|float|int $year Calendar year. Can be any expression that evaluates to a number. + * @param 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|ResolvesToString|non-empty-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( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $year, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeekYear, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $month = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $day = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $isoDayOfWeek = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $hour = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $minute = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $second = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $millisecond = Optional::Undefined, + Decimal128|Int64|ResolvesToNumber|float|int $year, + Decimal128|Int64|ResolvesToNumber|float|int $isoWeekYear, + 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|ResolvesToString|string $timezone = Optional::Undefined, ): DateFromPartsOperator { @@ -488,17 +489,17 @@ public static function dateFromParts( * @param Optional|ResolvesToString|non-empty-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|non-empty-string $timezone The time zone to use to format the date. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onError If $dateFromString encounters an error while parsing the given dateString, it outputs the result value of the provided onError expression. This result value can be of any type. * If you do not specify onError, $dateFromString throws an error if it cannot parse dateString. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull If the dateString provided to $dateFromString is null or missing, it outputs the result value of the provided onNull expression. This result value can be of any type. * If you do not specify onNull and dateString is null or missing, then $dateFromString outputs null. */ public static function dateFromString( ResolvesToString|string $dateString, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onError = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ): DateFromStringOperator { return new DateFromStringOperator($dateString, $format, $timezone, $onError, $onNull); @@ -548,14 +549,14 @@ public static function dateToParts( * @param Optional|ResolvesToString|non-empty-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|non-empty-string $timezone The time zone to use to format the date. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $onNull The value to return if the date is null or missing. * If unspecified, $dateToString returns null if the date is null or missing. */ public static function dateToString( ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, Optional|ResolvesToString|string $format = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $onNull = Optional::Undefined, ): DateToStringOperator { return new DateToStringOperator($date, $format, $timezone, $onNull); @@ -568,7 +569,7 @@ public static function dateToString( * @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 ResolvesToString|non-empty-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|ResolvesToInt|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 $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|non-empty-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|non-empty-string $startOfWeek The start of the week. Used when @@ -577,7 +578,7 @@ public static function dateToString( public static function dateTrunc( ObjectId|Timestamp|UTCDateTime|ResolvesToDate|ResolvesToObjectId|ResolvesToTimestamp|int $date, ResolvesToString|string $unit, - Optional|Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $binSize = Optional::Undefined, + Optional|Decimal128|Int64|ResolvesToNumber|float|int $binSize = Optional::Undefined, Optional|ResolvesToString|string $timezone = Optional::Undefined, Optional|string $startOfWeek = Optional::Undefined, ): DateTruncOperator @@ -634,11 +635,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|ResolvesToInt|ResolvesToNumber|float|int $expression $degreesToRadians takes any valid expression that resolves to a number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $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|ResolvesToInt|ResolvesToNumber|float|int $expression, + Decimal128|Int64|ResolvesToNumber|float|int $expression, ): DegreesToRadiansOperator { return new DegreesToRadiansOperator($expression); @@ -648,12 +649,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|ResolvesToInt|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|ResolvesToInt|ResolvesToNumber|float|int $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 */ public static function divide( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int $dividend, + Decimal128|Int64|ResolvesToNumber|float|int $divisor, ): DivideOperator { return new DivideOperator($dividend, $divisor); @@ -663,12 +664,12 @@ public static function divide( * Returns true if the values are equivalent. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/eq/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function eq( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): EqOperator { return new EqOperator($expression1, $expression2); @@ -678,9 +679,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|ResolvesToInt|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ - public static function exp(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent): ExpOperator + public static function exp(Decimal128|Int64|ResolvesToNumber|float|int $exponent): ExpOperator { return new ExpOperator($exponent); } @@ -709,9 +710,9 @@ public static function filter( * 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|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function floor(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression): FloorOperator + public static function floor(Decimal128|Int64|ResolvesToNumber|float|int $expression): FloorOperator { return new FloorOperator($expression); } @@ -737,12 +738,12 @@ public static function function(string $body, PackedArray|BSONArray|array $args, * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/getField/ * @param non-empty-string $field Field in the input object for which you want to return a value. field can be any valid expression that resolves to a string constant. * If field begins with a dollar sign ($), place the field name inside of a $literal expression to return its value. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $input Default: $$CURRENT + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $input Default: $$CURRENT * A valid expression that contains the field for which you want to return a value. input must resolve to an object, missing, null, or undefined. If omitted, defaults to the document currently being processed in the pipeline ($$CURRENT). */ public static function getField( string $field, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $input = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $input = Optional::Undefined, ): GetFieldOperator { return new GetFieldOperator($field, $input); @@ -752,12 +753,12 @@ public static function getField( * Returns true if the first value is greater than the second. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/gt/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function gt( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): GtOperator { return new GtOperator($expression1, $expression2); @@ -767,12 +768,12 @@ public static function gt( * Returns true if the first value is greater than or equal to the second. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/gte/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function gte( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): GteOperator { return new GteOperator($expression1, $expression2); @@ -797,10 +798,10 @@ public static function hour( * Returns either the non-null result of the first expression or the result of the second expression if the first expression results in a null result. Null result encompasses instances of undefined values or missing fields. Accepts two expressions as arguments. The result of the second expression can be null. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ifNull/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function ifNull( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): IfNullOperator { return new IfNullOperator(...$expression); @@ -810,11 +811,11 @@ public static function ifNull( * Returns a boolean indicating whether a specified value is in an array. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/in/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. * @param BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. */ public static function in( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, PackedArray|ResolvesToArray|BSONArray|array $array, ): InOperator { @@ -828,7 +829,7 @@ public static function in( * @param ResolvesToString|non-empty-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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $search + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. @@ -836,7 +837,7 @@ public static function in( */ public static function indexOfArray( ResolvesToString|string $array, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $search, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, Optional|ResolvesToInt|int $start = Optional::Undefined, Optional|ResolvesToInt|int $end = Optional::Undefined, ): IndexOfArrayOperator @@ -895,12 +896,12 @@ public static function indexOfCP( * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/integral/ - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input * @param Optional|ResolvesToString|non-empty-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|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, Optional|ResolvesToString|string $unit = Optional::Undefined, ): IntegralOperator { @@ -911,10 +912,10 @@ public static function integral( * Determines if the operand is an array. Returns a boolean. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isArray/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function isArray( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): IsArrayOperator { return new IsArrayOperator(...$expression); @@ -926,10 +927,10 @@ public static function isArray( * New in version 4.4. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/isNumber/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function isNumber( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): IsNumberOperator { return new IsNumberOperator(...$expression); @@ -987,11 +988,11 @@ public static function isoWeekYear( * @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. * The variable assignments have no meaning outside the in expression, not even within the vars block itself. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. */ public static function let( Document|Serializable|stdClass|array $vars, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ): LetOperator { return new LetOperator($vars, $in); @@ -1003,11 +1004,9 @@ public static function let( * New in version 5.3. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/linearFill/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public static function linearFill( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression, - ): LinearFillOperator + public static function linearFill(Decimal128|Int64|ResolvesToNumber|float|int $expression): LinearFillOperator { return new LinearFillOperator($expression); } @@ -1016,11 +1015,9 @@ public static function linearFill( * Return a value without parsing. Use for values that the aggregation pipeline may interpret as an expression. For example, use a $literal expression to a string that starts with a dollar sign ($) to avoid parsing as a field path. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/literal/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. */ - public static function literal( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): LiteralOperator + public static function literal(Type|stdClass|array|bool|float|int|null|string $value): LiteralOperator { return new LiteralOperator($value); } @@ -1030,9 +1027,9 @@ public static function literal( * $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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $number): LnOperator + public static function ln(Decimal128|Int64|ResolvesToNumber|float|int $number): LnOperator { return new LnOperator($number); } @@ -1043,10 +1040,10 @@ public static function ln(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float| * New in version 5.2. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/locf/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function locf( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): LocfOperator { return new LocfOperator($expression); @@ -1056,12 +1053,12 @@ public static function locf( * Calculates the log of a number in the specified base. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/log/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. - * @param Decimal128|Int64|ResolvesToInt|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 $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. */ public static function log( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $base, + Decimal128|Int64|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $base, ): LogOperator { return new LogOperator($number, $base); @@ -1071,9 +1068,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|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public static function log10(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number): Log10Operator + public static function log10(Decimal128|Int64|ResolvesToNumber|float|int $number): Log10Operator { return new Log10Operator($number); } @@ -1082,12 +1079,12 @@ public static function log10(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|flo * Returns true if the first value is less than the second. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lt/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function lt( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): LtOperator { return new LtOperator($expression1, $expression2); @@ -1097,12 +1094,12 @@ public static function lt( * Returns true if the first value is less than or equal to the second. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/lte/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function lte( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): LteOperator { return new LteOperator($expression1, $expression2); @@ -1131,12 +1128,12 @@ public static function ltrim( * * @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|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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|non-empty-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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, Optional|ResolvesToString|string $as = Optional::Undefined, ): MapOperator { @@ -1148,10 +1145,10 @@ public static function map( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/max/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function max( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): MaxOperator { return new MaxOperator(...$expression); @@ -1181,13 +1178,10 @@ 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|ResolvesToInt|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 $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 non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ - public static function median( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, - string $method, - ): MedianOperator + public static function median(Decimal128|Int64|ResolvesToNumber|float|int $input, string $method): MedianOperator { return new MedianOperator($input, $method); } @@ -1223,10 +1217,10 @@ public static function millisecond( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/min/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function min( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): MinOperator { return new MinOperator(...$expression); @@ -1266,12 +1260,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|ResolvesToInt|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|ResolvesToInt|ResolvesToNumber|float|int $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 */ public static function mod( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int $dividend, + Decimal128|Int64|ResolvesToNumber|float|int $divisor, ): ModOperator { return new ModOperator($dividend, $divisor); @@ -1296,12 +1290,10 @@ public static function month( * Multiplies numbers to return the product. Accepts any number of argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/multiply/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$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|ResolvesToInt|ResolvesToNumber|float|int ...$expression, - ): MultiplyOperator + public static function multiply(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): MultiplyOperator { return new MultiplyOperator(...$expression); } @@ -1310,12 +1302,12 @@ public static function multiply( * Returns true if the values are not equivalent. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/ne/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public static function ne( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ): NeOperator { return new NeOperator($expression1, $expression2); @@ -1325,10 +1317,10 @@ public static function ne( * Returns the boolean value that is the opposite of its argument expression. Accepts a single argument expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/not/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function not( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): NotOperator { return new NotOperator($expression); @@ -1351,10 +1343,10 @@ public static function objectToArray( * Returns true when any of its expressions evaluates to true. Accepts any number of argument expressions. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/or/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression */ public static function or( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): OrOperator { return new OrOperator(...$expression); @@ -1372,13 +1364,13 @@ public static function or( * It is also available as an aggregation expression. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/percentile/ - * @param Decimal128|Int64|ResolvesToInt|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 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. * $percentile returns results in the same order as the elements in p. * @param non-empty-string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public static function percentile( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, PackedArray|ResolvesToArray|BSONArray|array $p, string $method, ): PercentileOperator @@ -1390,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|ResolvesToInt|ResolvesToNumber|float|int $number - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int $number + * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ public static function pow( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent, + Decimal128|Int64|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $exponent, ): PowOperator { return new PowOperator($number, $exponent); @@ -1405,10 +1397,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|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ public static function radiansToDegrees( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression, + Decimal128|Int64|ResolvesToNumber|float|int $expression, ): RadiansToDegreesOperator { return new RadiansToDegreesOperator($expression); @@ -1459,16 +1451,16 @@ public static function rank(): RankOperator * @param BSONArray|PackedArray|ResolvesToArray|array $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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. * During evaluation of the in expression, two variables will be available: * - value is the variable that represents the cumulative value of the expression. * - this is the variable that refers to the element being processed. */ public static function reduce( PackedArray|ResolvesToArray|BSONArray|array $input, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $initialValue, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ): ReduceOperator { return new ReduceOperator($input, $initialValue, $in); @@ -1669,13 +1661,13 @@ public static function setEquals(PackedArray|ResolvesToArray|BSONArray|array ... * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setField/ * @param ResolvesToString|non-empty-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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value The value that you want to assign to field. value can be any valid expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $value, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, ): SetFieldOperator { return new SetFieldOperator($field, $input, $value); @@ -1724,10 +1716,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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): SinOperator + public static function sin(Decimal128|Int64|ResolvesToNumber|float|int $expression): SinOperator { return new SinOperator($expression); } @@ -1736,10 +1728,10 @@ public static function sin(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): SinhOperator + public static function sinh(Decimal128|Int64|ResolvesToNumber|float|int $expression): SinhOperator { return new SinhOperator($expression); } @@ -1809,9 +1801,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|ResolvesToInt|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 $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public static function sqrt(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number): SqrtOperator + public static function sqrt(Decimal128|Int64|ResolvesToNumber|float|int $number): SqrtOperator { return new SqrtOperator($number); } @@ -1822,11 +1814,9 @@ public static function sqrt(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevPop/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression */ - public static function stdDevPop( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression, - ): StdDevPopOperator + public static function stdDevPop(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): StdDevPopOperator { return new StdDevPopOperator(...$expression); } @@ -1836,11 +1826,9 @@ public static function stdDevPop( * If the values represent the entire population of data or you do not wish to generalize about a larger population, use $stdDevPop instead. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/stdDevSamp/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression */ - public static function stdDevSamp( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression, - ): StdDevSampOperator + public static function stdDevSamp(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): StdDevSampOperator { return new StdDevSampOperator(...$expression); } @@ -1937,12 +1925,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|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression1 - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression2 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 */ public static function subtract( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2, ): SubtractOperator { return new SubtractOperator($expression1, $expression2); @@ -1953,9 +1941,9 @@ public static function subtract( * Changed in version 5.0: Available in the $setWindowFields stage. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sum/ - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression */ - public static function sum(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression): SumOperator + public static function sum(Decimal128|Int64|ResolvesToNumber|float|int ...$expression): SumOperator { return new SumOperator(...$expression); } @@ -1968,12 +1956,12 @@ public static function sum(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * - 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. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. * 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, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, ): SwitchOperator { return new SwitchOperator($branches, $default); @@ -1983,10 +1971,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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): TanOperator + public static function tan(Decimal128|Int64|ResolvesToNumber|float|int $expression): TanOperator { return new TanOperator($expression); } @@ -1995,10 +1983,10 @@ public static function tan(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float * 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|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression): TanhOperator + public static function tanh(Decimal128|Int64|ResolvesToNumber|float|int $expression): TanhOperator { return new TanhOperator($expression); } @@ -2008,10 +1996,10 @@ public static function tanh(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|floa * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toBool/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toBool( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToBoolOperator { return new ToBoolOperator($expression); @@ -2022,10 +2010,10 @@ public static function toBool( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDate/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toDate( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToDateOperator { return new ToDateOperator($expression); @@ -2036,10 +2024,10 @@ public static function toDate( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDecimal/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toDecimal( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToDecimalOperator { return new ToDecimalOperator($expression); @@ -2050,10 +2038,10 @@ public static function toDecimal( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toDouble/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toDouble( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToDoubleOperator { return new ToDoubleOperator($expression); @@ -2064,10 +2052,10 @@ public static function toDouble( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toInt/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toInt( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToIntOperator { return new ToIntOperator($expression); @@ -2078,10 +2066,10 @@ public static function toInt( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toLong/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toLong( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToLongOperator { return new ToLongOperator($expression); @@ -2103,10 +2091,10 @@ public static function toLower(ResolvesToString|string $expression): ToLowerOper * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toObjectId/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toObjectId( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToObjectIdOperator { return new ToObjectIdOperator($expression); @@ -2117,10 +2105,10 @@ public static function toObjectId( * New in version 4.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/toString/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function toString( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ToStringOperator { return new ToStringOperator($expression); @@ -2159,12 +2147,12 @@ 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|ResolvesToInt|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 $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. */ public static function trunc( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $number, Optional|ResolvesToInt|int $place = Optional::Undefined, ): TruncOperator { @@ -2199,10 +2187,10 @@ public static function tsSecond(Timestamp|ResolvesToTimestamp|int $expression): * Return the BSON data type of the field. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/type/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function type( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): TypeOperator { return new TypeOperator($expression); diff --git a/src/Builder/Expression/FloorOperator.php b/src/Builder/Expression/FloorOperator.php index b59075b02..670e22eb4 100644 --- a/src/Builder/Expression/FloorOperator.php +++ b/src/Builder/Expression/FloorOperator.php @@ -20,13 +20,13 @@ public const NAME = '$floor'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/FullDocument.php b/src/Builder/Expression/FullDocument.php new file mode 100644 index 000000000..1dcf033ca --- /dev/null +++ b/src/Builder/Expression/FullDocument.php @@ -0,0 +1,15 @@ +field = $field; $this->input = $input; diff --git a/src/Builder/Expression/GtOperator.php b/src/Builder/Expression/GtOperator.php index bfaa52235..cb1f501fa 100644 --- a/src/Builder/Expression/GtOperator.php +++ b/src/Builder/Expression/GtOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$gt'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/GteOperator.php b/src/Builder/Expression/GteOperator.php index ff616a3c4..e0d917a8f 100644 --- a/src/Builder/Expression/GteOperator.php +++ b/src/Builder/Expression/GteOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$gte'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/IfNullOperator.php b/src/Builder/Expression/IfNullOperator.php index b6faaf36e..2ed100821 100644 --- a/src/Builder/Expression/IfNullOperator.php +++ b/src/Builder/Expression/IfNullOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -34,16 +24,15 @@ public const NAME = '$ifNull'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/InOperator.php b/src/Builder/Expression/InOperator.php index e801a2a15..f0c96bc65 100644 --- a/src/Builder/Expression/InOperator.php +++ b/src/Builder/Expression/InOperator.php @@ -6,16 +6,8 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; @@ -35,18 +27,18 @@ public const NAME = '$in'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** @param BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. */ public PackedArray|ResolvesToArray|BSONArray|array $array; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression Any valid expression expression. * @param BSONArray|PackedArray|ResolvesToArray|array $array Any valid expression that resolves to an array. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, PackedArray|ResolvesToArray|BSONArray|array $array, ) { $this->expression = $expression; diff --git a/src/Builder/Expression/IndexOfArrayOperator.php b/src/Builder/Expression/IndexOfArrayOperator.php index 0398d2683..7b6793314 100644 --- a/src/Builder/Expression/IndexOfArrayOperator.php +++ b/src/Builder/Expression/IndexOfArrayOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -39,8 +29,8 @@ */ public ResolvesToString|string $array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $search */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $search; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $search */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|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. @@ -58,7 +48,7 @@ * @param ResolvesToString|non-empty-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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $search + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. @@ -66,7 +56,7 @@ */ public function __construct( ResolvesToString|string $array, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $search, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $search, Optional|ResolvesToInt|int $start = Optional::Undefined, Optional|ResolvesToInt|int $end = Optional::Undefined, ) { diff --git a/src/Builder/Expression/IntegralOperator.php b/src/Builder/Expression/IntegralOperator.php index 1671656d9..259b489fa 100644 --- a/src/Builder/Expression/IntegralOperator.php +++ b/src/Builder/Expression/IntegralOperator.php @@ -23,8 +23,8 @@ public const NAME = '$integral'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input */ - public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input */ + public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input; /** * @param Optional|ResolvesToString|non-empty-string $unit A string that specifies the time unit. Use one of these strings: "week", "day","hour", "minute", "second", "millisecond". @@ -33,12 +33,12 @@ public Optional|ResolvesToString|string $unit; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $input + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $input * @param Optional|ResolvesToString|non-empty-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|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $input, Optional|ResolvesToString|string $unit = Optional::Undefined, ) { $this->input = $input; diff --git a/src/Builder/Expression/IsArrayOperator.php b/src/Builder/Expression/IsArrayOperator.php index b7a6f77f1..790f55345 100644 --- a/src/Builder/Expression/IsArrayOperator.php +++ b/src/Builder/Expression/IsArrayOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -34,16 +24,15 @@ public const NAME = '$isArray'; public const ENCODE = Encode::Array; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/IsNumberOperator.php b/src/Builder/Expression/IsNumberOperator.php index 5b7200879..6020eeb9a 100644 --- a/src/Builder/Expression/IsNumberOperator.php +++ b/src/Builder/Expression/IsNumberOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -36,16 +26,15 @@ public const NAME = '$isNumber'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/LetOperator.php b/src/Builder/Expression/LetOperator.php index 19a277594..587011cf4 100644 --- a/src/Builder/Expression/LetOperator.php +++ b/src/Builder/Expression/LetOperator.php @@ -6,19 +6,11 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -38,17 +30,17 @@ */ public Document|Serializable|stdClass|array $vars; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. */ + public 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. * The variable assignments have no meaning outside the in expression, not even within the vars block itself. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in The expression to evaluate. */ public function __construct( Document|Serializable|stdClass|array $vars, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ) { $this->vars = $vars; $this->in = $in; diff --git a/src/Builder/Expression/LinearFillOperator.php b/src/Builder/Expression/LinearFillOperator.php index 25a170918..d10407412 100644 --- a/src/Builder/Expression/LinearFillOperator.php +++ b/src/Builder/Expression/LinearFillOperator.php @@ -22,13 +22,13 @@ public const NAME = '$linearFill'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/LiteralOperator.php b/src/Builder/Expression/LiteralOperator.php index a2e7fe35c..78cce28c2 100644 --- a/src/Builder/Expression/LiteralOperator.php +++ b/src/Builder/Expression/LiteralOperator.php @@ -6,18 +6,8 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -30,15 +20,14 @@ public const NAME = '$literal'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value If the value is an expression, $literal does not evaluate the expression but instead returns the unparsed expression. */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Expression/LnOperator.php b/src/Builder/Expression/LnOperator.php index cbc897550..648cf4bf5 100644 --- a/src/Builder/Expression/LnOperator.php +++ b/src/Builder/Expression/LnOperator.php @@ -21,13 +21,13 @@ public const NAME = '$ln'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $number; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) { $this->number = $number; } diff --git a/src/Builder/Expression/LocfOperator.php b/src/Builder/Expression/LocfOperator.php index b84f6962a..8e1078a8c 100644 --- a/src/Builder/Expression/LocfOperator.php +++ b/src/Builder/Expression/LocfOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -33,15 +23,14 @@ public const NAME = '$locf'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/Log10Operator.php b/src/Builder/Expression/Log10Operator.php index 0e4ba52a3..f8e2d427e 100644 --- a/src/Builder/Expression/Log10Operator.php +++ b/src/Builder/Expression/Log10Operator.php @@ -20,13 +20,13 @@ public const NAME = '$log10'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ + public Decimal128|Int64|ResolvesToNumber|float|int $number; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. + * @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) { $this->number = $number; } diff --git a/src/Builder/Expression/LogOperator.php b/src/Builder/Expression/LogOperator.php index 2e1f58153..7e8c98bab 100644 --- a/src/Builder/Expression/LogOperator.php +++ b/src/Builder/Expression/LogOperator.php @@ -20,19 +20,19 @@ public const NAME = '$log'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. */ + public Decimal128|Int64|ResolvesToNumber|float|int $number; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $base Any valid expression as long as it resolves to a positive number greater than 1. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $base; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $base Any valid expression as long as it resolves to a positive number greater than 1. */ + public Decimal128|Int64|ResolvesToNumber|float|int $base; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number Any valid expression as long as it resolves to a non-negative number. - * @param Decimal128|Int64|ResolvesToInt|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 $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. */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $base, + Decimal128|Int64|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $base, ) { $this->number = $number; $this->base = $base; diff --git a/src/Builder/Expression/LtOperator.php b/src/Builder/Expression/LtOperator.php index 0f547a684..1dc510cd0 100644 --- a/src/Builder/Expression/LtOperator.php +++ b/src/Builder/Expression/LtOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$lt'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/LteOperator.php b/src/Builder/Expression/LteOperator.php index 3c75457e9..d568a894c 100644 --- a/src/Builder/Expression/LteOperator.php +++ b/src/Builder/Expression/LteOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$lte'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/MapOperator.php b/src/Builder/Expression/MapOperator.php index ca54d53d7..ed6db35b5 100644 --- a/src/Builder/Expression/MapOperator.php +++ b/src/Builder/Expression/MapOperator.php @@ -6,16 +6,8 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; @@ -39,20 +31,20 @@ /** @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to an array. */ public PackedArray|ResolvesToArray|BSONArray|array $input; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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 Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in; /** @param Optional|ResolvesToString|non-empty-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 Optional|ResolvesToString|string $as; /** * @param BSONArray|PackedArray|ResolvesToArray|array $input An expression that resolves to an array. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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|non-empty-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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, Optional|ResolvesToString|string $as = Optional::Undefined, ) { if (is_array($input) && ! array_is_list($input)) { diff --git a/src/Builder/Expression/MaxOperator.php b/src/Builder/Expression/MaxOperator.php index 4041d958e..b0dcd988e 100644 --- a/src/Builder/Expression/MaxOperator.php +++ b/src/Builder/Expression/MaxOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -35,16 +25,15 @@ public const NAME = '$max'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/MedianOperator.php b/src/Builder/Expression/MedianOperator.php index 1e3dd5ce8..c6713305e 100644 --- a/src/Builder/Expression/MedianOperator.php +++ b/src/Builder/Expression/MedianOperator.php @@ -25,17 +25,17 @@ public const NAME = '$median'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $input; /** @param non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ public string $method; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 non-empty-string $method The method that mongod uses to calculate the 50th percentile value. The method must be 'approximate'. */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, string $method) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $input, string $method) { $this->input = $input; $this->method = $method; diff --git a/src/Builder/Expression/MinOperator.php b/src/Builder/Expression/MinOperator.php index 83638c329..f883a86af 100644 --- a/src/Builder/Expression/MinOperator.php +++ b/src/Builder/Expression/MinOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -35,16 +25,15 @@ public const NAME = '$min'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/ModOperator.php b/src/Builder/Expression/ModOperator.php index 006b4cdf5..807f520cf 100644 --- a/src/Builder/Expression/ModOperator.php +++ b/src/Builder/Expression/ModOperator.php @@ -20,19 +20,19 @@ public const NAME = '$mod'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $dividend; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $divisor */ + public Decimal128|Int64|ResolvesToNumber|float|int $divisor; /** - * @param Decimal128|Int64|ResolvesToInt|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|ResolvesToInt|ResolvesToNumber|float|int $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 */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $dividend, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $divisor, + Decimal128|Int64|ResolvesToNumber|float|int $dividend, + Decimal128|Int64|ResolvesToNumber|float|int $divisor, ) { $this->dividend = $dividend; $this->divisor = $divisor; diff --git a/src/Builder/Expression/MultiplyOperator.php b/src/Builder/Expression/MultiplyOperator.php index 2c462c7b3..ab4626566 100644 --- a/src/Builder/Expression/MultiplyOperator.php +++ b/src/Builder/Expression/MultiplyOperator.php @@ -24,17 +24,17 @@ public const ENCODE = Encode::Single; /** - * @param list ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * @param 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 array $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression The arguments can be any valid expression as long as they resolve to numbers. + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$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|ResolvesToInt|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$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/NeOperator.php b/src/Builder/Expression/NeOperator.php index abcfd4975..e85b24085 100644 --- a/src/Builder/Expression/NeOperator.php +++ b/src/Builder/Expression/NeOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,19 +21,19 @@ public const NAME = '$ne'; public const ENCODE = Encode::Array; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression1 - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression2 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression1 + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression2 */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression1, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression2, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression1, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/NotOperator.php b/src/Builder/Expression/NotOperator.php index 2cdce0fa2..7444f6e76 100644 --- a/src/Builder/Expression/NotOperator.php +++ b/src/Builder/Expression/NotOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,14 +21,14 @@ public const NAME = '$not'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ) { $this->expression = $expression; } diff --git a/src/Builder/Expression/OrOperator.php b/src/Builder/Expression/OrOperator.php index 1edbcb72c..0f6d0ac03 100644 --- a/src/Builder/Expression/OrOperator.php +++ b/src/Builder/Expression/OrOperator.php @@ -6,20 +6,10 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -34,15 +24,15 @@ public const NAME = '$or'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToBool|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression + * @param ExpressionInterface|ResolvesToBool|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression * @no-named-arguments */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToBool|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ResolvesToBool|ExpressionInterface|stdClass|array|bool|float|int|null|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/PercentileOperator.php b/src/Builder/Expression/PercentileOperator.php index 513df51e3..070ff8f1e 100644 --- a/src/Builder/Expression/PercentileOperator.php +++ b/src/Builder/Expression/PercentileOperator.php @@ -34,8 +34,8 @@ public const NAME = '$percentile'; public const ENCODE = Encode::Object; - /** @param Decimal128|Int64|ResolvesToInt|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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input; + /** @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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $input; /** * @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. @@ -47,13 +47,13 @@ public string $method; /** - * @param Decimal128|Int64|ResolvesToInt|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 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. * $percentile returns results in the same order as the elements in p. * @param non-empty-string $method The method that mongod uses to calculate the percentile value. The method must be 'approximate'. */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $input, + Decimal128|Int64|ResolvesToNumber|float|int $input, PackedArray|ResolvesToArray|BSONArray|array $p, string $method, ) { diff --git a/src/Builder/Expression/PowOperator.php b/src/Builder/Expression/PowOperator.php index ae4daf35a..a4fb1266b 100644 --- a/src/Builder/Expression/PowOperator.php +++ b/src/Builder/Expression/PowOperator.php @@ -20,19 +20,19 @@ public const NAME = '$pow'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $number */ + public Decimal128|Int64|ResolvesToNumber|float|int $number; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ + public Decimal128|Int64|ResolvesToNumber|float|int $exponent; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent + * @param Decimal128|Int64|ResolvesToNumber|float|int $number + * @param Decimal128|Int64|ResolvesToNumber|float|int $exponent */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $exponent, + Decimal128|Int64|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $exponent, ) { $this->number = $number; $this->exponent = $exponent; diff --git a/src/Builder/Expression/RadiansToDegreesOperator.php b/src/Builder/Expression/RadiansToDegreesOperator.php index d40e6029e..d709fd913 100644 --- a/src/Builder/Expression/RadiansToDegreesOperator.php +++ b/src/Builder/Expression/RadiansToDegreesOperator.php @@ -20,13 +20,13 @@ public const NAME = '$radiansToDegrees'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + /** @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression + * @param Decimal128|Int64|ResolvesToNumber|float|int $expression */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/ReduceOperator.php b/src/Builder/Expression/ReduceOperator.php index dfa6a0932..3dd9030f7 100644 --- a/src/Builder/Expression/ReduceOperator.php +++ b/src/Builder/Expression/ReduceOperator.php @@ -6,16 +6,8 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Exception\InvalidArgumentException; @@ -42,31 +34,31 @@ */ public PackedArray|ResolvesToArray|BSONArray|array $input; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $initialValue; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. * During evaluation of the in expression, two variables will be available: * - value is the variable that represents the cumulative value of the expression. * - this is the variable that refers to the element being processed. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in; + public 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. * 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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $initialValue The initial cumulative value set before in is applied to the first element of the input array. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $in A valid expression that $reduce applies to each element in the input array in left-to-right order. Wrap the input value with $reverseArray to yield the equivalent of applying the combining expression from right-to-left. * During evaluation of the in expression, two variables will be available: * - value is the variable that represents the cumulative value of the expression. * - this is the variable that refers to the element being processed. */ public function __construct( PackedArray|ResolvesToArray|BSONArray|array $input, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $initialValue, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $in, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $initialValue, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $in, ) { 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/SetFieldOperator.php b/src/Builder/Expression/SetFieldOperator.php index 092898bc1..68b4e53ff 100644 --- a/src/Builder/Expression/SetFieldOperator.php +++ b/src/Builder/Expression/SetFieldOperator.php @@ -6,19 +6,11 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -39,21 +31,21 @@ public Document|Serializable|ResolvesToObject|stdClass|array $input; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value The value that you want to assign to field. value can be any valid expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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 Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $value; + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value; /** * @param ResolvesToString|non-empty-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 BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value The value that you want to assign to field. value can be any valid expression. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $value, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $value, ) { $this->field = $field; $this->input = $input; diff --git a/src/Builder/Expression/SinOperator.php b/src/Builder/Expression/SinOperator.php index b025199fc..4148ae77e 100644 --- a/src/Builder/Expression/SinOperator.php +++ b/src/Builder/Expression/SinOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/SinhOperator.php b/src/Builder/Expression/SinhOperator.php index a5d97519f..ce01b3a6d 100644 --- a/src/Builder/Expression/SinhOperator.php +++ b/src/Builder/Expression/SinhOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/SqrtOperator.php b/src/Builder/Expression/SqrtOperator.php index 83b2fead7..409df2550 100644 --- a/src/Builder/Expression/SqrtOperator.php +++ b/src/Builder/Expression/SqrtOperator.php @@ -20,13 +20,13 @@ public const NAME = '$sqrt'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $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. */ + public Decimal128|Int64|ResolvesToNumber|float|int $number; /** - * @param Decimal128|Int64|ResolvesToInt|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 $number The argument can be any valid expression as long as it resolves to a non-negative number. */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $number) { $this->number = $number; } diff --git a/src/Builder/Expression/StdDevPopOperator.php b/src/Builder/Expression/StdDevPopOperator.php index a72eee16a..4913b425d 100644 --- a/src/Builder/Expression/StdDevPopOperator.php +++ b/src/Builder/Expression/StdDevPopOperator.php @@ -25,14 +25,14 @@ public const NAME = '$stdDevPop'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$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 f3c159184..355c333e5 100644 --- a/src/Builder/Expression/StdDevSampOperator.php +++ b/src/Builder/Expression/StdDevSampOperator.php @@ -24,14 +24,14 @@ public const NAME = '$stdDevSamp'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$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/SubtractOperator.php b/src/Builder/Expression/SubtractOperator.php index 442cfcb0e..3e8374a06 100644 --- a/src/Builder/Expression/SubtractOperator.php +++ b/src/Builder/Expression/SubtractOperator.php @@ -21,19 +21,19 @@ public const NAME = '$subtract'; public const ENCODE = Encode::Array; - /** @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression1 */ - public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression1; + /** @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 */ + public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1; - /** @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression2 */ - public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression2; + /** @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 */ + public Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2; /** - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression1 - * @param Decimal128|Int64|ResolvesToDate|ResolvesToInt|ResolvesToNumber|UTCDateTime|float|int $expression2 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression1 + * @param Decimal128|Int64|ResolvesToDate|ResolvesToNumber|UTCDateTime|float|int $expression2 */ public function __construct( - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression1, - Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToInt|ResolvesToNumber|float|int $expression2, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression1, + Decimal128|Int64|UTCDateTime|ResolvesToDate|ResolvesToNumber|float|int $expression2, ) { $this->expression1 = $expression1; $this->expression2 = $expression2; diff --git a/src/Builder/Expression/SumOperator.php b/src/Builder/Expression/SumOperator.php index a3705df3f..b4520a580 100644 --- a/src/Builder/Expression/SumOperator.php +++ b/src/Builder/Expression/SumOperator.php @@ -24,14 +24,14 @@ public const NAME = '$sum'; public const ENCODE = Encode::Single; - /** @param list ...$expression */ + /** @param list ...$expression */ public array $expression; /** - * @param Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression + * @param Decimal128|Int64|ResolvesToNumber|float|int ...$expression * @no-named-arguments */ - public function __construct(Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int ...$expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int ...$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 c9dbe4959..8505eac00 100644 --- a/src/Builder/Expression/SwitchOperator.php +++ b/src/Builder/Expression/SwitchOperator.php @@ -6,16 +6,8 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; @@ -45,22 +37,22 @@ public PackedArray|BSONArray|array $branches; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default; + public 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: * - 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. - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $default The path to take if no branch case expression evaluates to true. * Although optional, if default is unspecified and no branch case evaluates to true, $switch returns an error. */ public function __construct( PackedArray|BSONArray|array $branches, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, ) { if (is_array($branches) && ! array_is_list($branches)) { throw new InvalidArgumentException('Expected $branches argument to be a list, got an associative array.'); diff --git a/src/Builder/Expression/TanOperator.php b/src/Builder/Expression/TanOperator.php index 49727baad..125b3de59 100644 --- a/src/Builder/Expression/TanOperator.php +++ b/src/Builder/Expression/TanOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/TanhOperator.php b/src/Builder/Expression/TanhOperator.php index cc0c607ef..e337d6569 100644 --- a/src/Builder/Expression/TanhOperator.php +++ b/src/Builder/Expression/TanhOperator.php @@ -21,16 +21,16 @@ public const ENCODE = Encode::Single; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $expression; + public Decimal128|Int64|ResolvesToNumber|float|int $expression; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|ResolvesToNumber|float|int $expression) + public function __construct(Decimal128|Int64|ResolvesToNumber|float|int $expression) { $this->expression = $expression; } diff --git a/src/Builder/Expression/ToBoolOperator.php b/src/Builder/Expression/ToBoolOperator.php index 97f5c1ad3..fdd9d0125 100644 --- a/src/Builder/Expression/ToBoolOperator.php +++ b/src/Builder/Expression/ToBoolOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toBool'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToDateOperator.php b/src/Builder/Expression/ToDateOperator.php index c6dc1de9a..f13cbc80a 100644 --- a/src/Builder/Expression/ToDateOperator.php +++ b/src/Builder/Expression/ToDateOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toDate'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToDecimalOperator.php b/src/Builder/Expression/ToDecimalOperator.php index 6d4187e9f..00c125194 100644 --- a/src/Builder/Expression/ToDecimalOperator.php +++ b/src/Builder/Expression/ToDecimalOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toDecimal'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToDoubleOperator.php b/src/Builder/Expression/ToDoubleOperator.php index bf2924d49..f68bf0504 100644 --- a/src/Builder/Expression/ToDoubleOperator.php +++ b/src/Builder/Expression/ToDoubleOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toDouble'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToIntOperator.php b/src/Builder/Expression/ToIntOperator.php index 6c0e1ce38..c0390a408 100644 --- a/src/Builder/Expression/ToIntOperator.php +++ b/src/Builder/Expression/ToIntOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toInt'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToLongOperator.php b/src/Builder/Expression/ToLongOperator.php index 4708b9859..6edccc124 100644 --- a/src/Builder/Expression/ToLongOperator.php +++ b/src/Builder/Expression/ToLongOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toLong'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToObjectIdOperator.php b/src/Builder/Expression/ToObjectIdOperator.php index e45b5150c..331ea8c32 100644 --- a/src/Builder/Expression/ToObjectIdOperator.php +++ b/src/Builder/Expression/ToObjectIdOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toObjectId'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/ToStringOperator.php b/src/Builder/Expression/ToStringOperator.php index 8576cbf52..74c11b08c 100644 --- a/src/Builder/Expression/ToStringOperator.php +++ b/src/Builder/Expression/ToStringOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +22,14 @@ public const NAME = '$toString'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Expression/TruncOperator.php b/src/Builder/Expression/TruncOperator.php index 2522419de..46bdcd71e 100644 --- a/src/Builder/Expression/TruncOperator.php +++ b/src/Builder/Expression/TruncOperator.php @@ -22,21 +22,21 @@ public const ENCODE = Encode::Array; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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 Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number; + public Decimal128|Int64|ResolvesToNumber|float|int $number; /** @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. */ public Optional|ResolvesToInt|int $place; /** - * @param Decimal128|Int64|ResolvesToInt|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 $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. */ public function __construct( - Decimal128|Int64|ResolvesToInt|ResolvesToNumber|float|int $number, + Decimal128|Int64|ResolvesToNumber|float|int $number, Optional|ResolvesToInt|int $place = Optional::Undefined, ) { $this->number = $number; diff --git a/src/Builder/Expression/TypeOperator.php b/src/Builder/Expression/TypeOperator.php index 721877cdc..a28c708c0 100644 --- a/src/Builder/Expression/TypeOperator.php +++ b/src/Builder/Expression/TypeOperator.php @@ -6,19 +6,9 @@ namespace MongoDB\Builder\Expression; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -31,15 +21,14 @@ public const NAME = '$type'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Query/AllOperator.php b/src/Builder/Query/AllOperator.php index 6b95dea1d..c3c0ea7ac 100644 --- a/src/Builder/Query/AllOperator.php +++ b/src/Builder/Query/AllOperator.php @@ -6,21 +6,10 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function array_is_list; @@ -35,16 +24,15 @@ public const NAME = '$all'; public const ENCODE = Encode::Single; - /** @param list ...$value */ + /** @param list ...$value */ public array $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass ...$value * @no-named-arguments */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string ...$value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string ...$value) + { if (\count($value) < 1) { throw new \InvalidArgumentException(\sprintf('Expected at least %d values for $value, got %d.', 1, \count($value))); } diff --git a/src/Builder/Query/EqOperator.php b/src/Builder/Query/EqOperator.php index 86f3943bc..7dc490f2a 100644 --- a/src/Builder/Query/EqOperator.php +++ b/src/Builder/Query/EqOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$eq'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Query/ExprOperator.php b/src/Builder/Query/ExprOperator.php index b8048e2f5..47dfaafa6 100644 --- a/src/Builder/Query/ExprOperator.php +++ b/src/Builder/Query/ExprOperator.php @@ -6,21 +6,10 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -33,15 +22,14 @@ public const NAME = '$expr'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Query/FactoryTrait.php b/src/Builder/Query/FactoryTrait.php index 5e6bcdbe8..e5e85fdde 100644 --- a/src/Builder/Query/FactoryTrait.php +++ b/src/Builder/Query/FactoryTrait.php @@ -10,13 +10,10 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\GeometryInterface; use MongoDB\Builder\Type\Optional; @@ -33,11 +30,9 @@ trait FactoryTrait * Matches arrays that contain all elements specified in the query. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/all/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass ...$value */ - public static function all( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string ...$value, - ): AllOperator + public static function all(Type|stdClass|array|bool|float|int|null|string ...$value): AllOperator { return new AllOperator(...$value); } @@ -156,11 +151,9 @@ public static function elemMatch(Document|Serializable|QueryInterface|stdClass|a * Matches values that are equal to a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/eq/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function eq( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): EqOperator + public static function eq(Type|stdClass|array|bool|float|int|null|string $value): EqOperator { return new EqOperator($value); } @@ -180,10 +173,10 @@ public static function exists(bool $exists): ExistsOperator * Allows use of aggregation expressions within the query language. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/expr/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function expr( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): ExprOperator { return new ExprOperator($expression); @@ -236,11 +229,9 @@ public static function geoWithin( * Matches values that are greater than a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/gt/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function gt( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): GtOperator + public static function gt(Type|stdClass|array|bool|float|int|null|string $value): GtOperator { return new GtOperator($value); } @@ -249,11 +240,9 @@ public static function gt( * Matches values that are greater than or equal to a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/gte/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function gte( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): GteOperator + public static function gte(Type|stdClass|array|bool|float|int|null|string $value): GteOperator { return new GteOperator($value); } @@ -284,11 +273,9 @@ public static function jsonSchema(Document|Serializable|stdClass|array $schema): * Matches values that are less than a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/lt/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function lt( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): LtOperator + public static function lt(Type|stdClass|array|bool|float|int|null|string $value): LtOperator { return new LtOperator($value); } @@ -297,11 +284,9 @@ public static function lt( * Matches values that are less than or equal to a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/lte/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function lte( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): LteOperator + public static function lte(Type|stdClass|array|bool|float|int|null|string $value): LteOperator { return new LteOperator($value); } @@ -310,9 +295,9 @@ public static function lte( * 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|ResolvesToInt|float|int $value + * @param Decimal128|Int64|float|int $value */ - public static function maxDistance(Decimal128|Int64|ResolvesToInt|float|int $value): MaxDistanceOperator + public static function maxDistance(Decimal128|Int64|float|int $value): MaxDistanceOperator { return new MaxDistanceOperator($value); } @@ -354,11 +339,9 @@ public static function natural(): NaturalOperator * Matches all values that are not equal to a specified value. * * @see https://www.mongodb.com/docs/manual/reference/operator/query/ne/ - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public static function ne( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ): NeOperator + public static function ne(Type|stdClass|array|bool|float|int|null|string $value): NeOperator { return new NeOperator($value); } diff --git a/src/Builder/Query/GtOperator.php b/src/Builder/Query/GtOperator.php index bb607c01d..7e1016f02 100644 --- a/src/Builder/Query/GtOperator.php +++ b/src/Builder/Query/GtOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$gt'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Query/GteOperator.php b/src/Builder/Query/GteOperator.php index f5b51b8e2..ae0d4fc63 100644 --- a/src/Builder/Query/GteOperator.php +++ b/src/Builder/Query/GteOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$gte'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Query/LtOperator.php b/src/Builder/Query/LtOperator.php index 8c5bd6f4b..a2fa54fbe 100644 --- a/src/Builder/Query/LtOperator.php +++ b/src/Builder/Query/LtOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$lt'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Query/LteOperator.php b/src/Builder/Query/LteOperator.php index 9ce11dd72..f74f35a8a 100644 --- a/src/Builder/Query/LteOperator.php +++ b/src/Builder/Query/LteOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$lte'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Query/MaxDistanceOperator.php b/src/Builder/Query/MaxDistanceOperator.php index ec12ed14e..1590c3859 100644 --- a/src/Builder/Query/MaxDistanceOperator.php +++ b/src/Builder/Query/MaxDistanceOperator.php @@ -8,7 +8,6 @@ use MongoDB\BSON\Decimal128; use MongoDB\BSON\Int64; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; @@ -22,13 +21,13 @@ public const NAME = '$maxDistance'; public const ENCODE = Encode::Single; - /** @param Decimal128|Int64|ResolvesToInt|float|int $value */ - public Decimal128|Int64|ResolvesToInt|float|int $value; + /** @param Decimal128|Int64|float|int $value */ + public Decimal128|Int64|float|int $value; /** - * @param Decimal128|Int64|ResolvesToInt|float|int $value + * @param Decimal128|Int64|float|int $value */ - public function __construct(Decimal128|Int64|ResolvesToInt|float|int $value) + public function __construct(Decimal128|Int64|float|int $value) { $this->value = $value; } diff --git a/src/Builder/Query/NeOperator.php b/src/Builder/Query/NeOperator.php index 177a0388e..f48dfac7a 100644 --- a/src/Builder/Query/NeOperator.php +++ b/src/Builder/Query/NeOperator.php @@ -6,20 +6,9 @@ namespace MongoDB\Builder\Query; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\FieldQueryInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -32,15 +21,14 @@ public const NAME = '$ne'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value; + /** @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ + public Type|stdClass|array|bool|float|int|null|string $value; /** - * @param BSONArray|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $value + * @param Type|array|bool|float|int|non-empty-string|null|stdClass $value */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|BSONArray|stdClass|array|bool|float|int|null|string $value, - ) { + public function __construct(Type|stdClass|array|bool|float|int|null|string $value) + { $this->value = $value; } } diff --git a/src/Builder/Stage/AddFieldsStage.php b/src/Builder/Stage/AddFieldsStage.php index 725c1b6ad..bea97bfbf 100644 --- a/src/Builder/Stage/AddFieldsStage.php +++ b/src/Builder/Stage/AddFieldsStage.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\StageInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function is_string; @@ -36,15 +25,14 @@ public const NAME = '$addFields'; public const ENCODE = Encode::Single; - /** @param stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. */ + /** @param stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. */ public stdClass $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|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/Stage/BucketAutoStage.php b/src/Builder/Stage/BucketAutoStage.php index 5a24d424d..c4177fd09 100644 --- a/src/Builder/Stage/BucketAutoStage.php +++ b/src/Builder/Stage/BucketAutoStage.php @@ -6,22 +6,13 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; use MongoDB\Builder\Type\StageInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -34,8 +25,8 @@ public const NAME = '$bucketAuto'; public const ENCODE = Encode::Object; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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 Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; /** @param int $buckets A positive 32-bit integer that specifies the number of buckets into which input documents are grouped. */ public int $buckets; @@ -53,7 +44,7 @@ public Optional|Document|Serializable|stdClass|array $granularity; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. @@ -61,7 +52,7 @@ * Available only if the all groupBy values are numeric and none of them are NaN. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy, + 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, diff --git a/src/Builder/Stage/BucketStage.php b/src/Builder/Stage/BucketStage.php index 77509ee2c..507a47d94 100644 --- a/src/Builder/Stage/BucketStage.php +++ b/src/Builder/Stage/BucketStage.php @@ -6,17 +6,10 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; @@ -39,10 +32,10 @@ public const ENCODE = Encode::Object; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy; + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy; /** * @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. @@ -51,12 +44,12 @@ public PackedArray|BSONArray|array $boundaries; /** - * @param Optional|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. */ - public Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default; + public Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default; /** * @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. @@ -66,11 +59,11 @@ public Optional|Document|Serializable|stdClass|array $output; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. @@ -79,9 +72,9 @@ * 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( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, PackedArray|BSONArray|array $boundaries, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, ) { $this->groupBy = $groupBy; diff --git a/src/Builder/Stage/FactoryTrait.php b/src/Builder/Stage/FactoryTrait.php index e3003f52b..07fc515aa 100644 --- a/src/Builder/Stage/FactoryTrait.php +++ b/src/Builder/Stage/FactoryTrait.php @@ -6,21 +6,17 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; +use MongoDB\BSON\Type; use MongoDB\Builder\Expression\ArrayFieldPath; use MongoDB\Builder\Expression\FieldPath; use MongoDB\Builder\Expression\ResolvesToArray; use MongoDB\Builder\Expression\ResolvesToBool; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Expression\ResolvesToObject; use MongoDB\Builder\Pipeline; use MongoDB\Builder\Type\AccumulatorInterface; @@ -40,10 +36,10 @@ trait FactoryTrait * Adds new fields to documents. Outputs documents that contain all existing fields from the input documents and newly added fields. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$expression Specify the name of each field to add and set its value to an aggregation expression or an empty object. */ public static function addFields( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$expression, ): AddFieldsStage { return new AddFieldsStage(...$expression); @@ -53,11 +49,11 @@ public static function addFields( * Categorizes incoming documents into groups, called buckets, based on a specified expression and bucket boundaries. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucket/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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|BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param Optional|ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. @@ -66,9 +62,9 @@ public static function addFields( * 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( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $groupBy, PackedArray|BSONArray|array $boundaries, - Optional|Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, + Optional|Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $default = Optional::Undefined, Optional|Document|Serializable|stdClass|array $output = Optional::Undefined, ): BucketStage { @@ -79,7 +75,7 @@ public static function bucket( * Categorizes incoming documents into a specific number of groups, called buckets, based on a specified expression. Bucket boundaries are automatically determined in an attempt to evenly distribute the documents into the specified number of buckets. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/bucketAuto/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * 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. @@ -87,7 +83,7 @@ public static function bucket( * Available only if the all groupBy values are numeric and none of them are NaN. */ public static function bucketAuto( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $groupBy, + 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, @@ -241,12 +237,12 @@ public static function fill( * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/geoNear/ * @param non-empty-string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. * @param Document|Serializable|array|stdClass $near The point for which to find the closest documents. - * @param Optional|Decimal128|Int64|ResolvesToInt|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 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 Optional|non-empty-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|non-empty-string $key Specify the geospatial indexed field to use when calculating the distance. - * @param Optional|Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|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 $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|Document|QueryInterface|Serializable|array|stdClass $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. @@ -258,11 +254,11 @@ public static function fill( public static function geoNear( string $distanceField, Document|Serializable|stdClass|array $near, - Optional|Decimal128|Int64|ResolvesToInt|float|int $distanceMultiplier = Optional::Undefined, + Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, Optional|string $includeLocs = Optional::Undefined, Optional|string $key = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, Optional|Document|Serializable|QueryInterface|stdClass|array $query = Optional::Undefined, Optional|bool $spherical = Optional::Undefined, ): GeoNearStage @@ -276,7 +272,7 @@ public static function geoNear( * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/ * @param non-empty-string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + * @param BSONArray|ExpressionInterface|PackedArray|Type|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. * @param non-empty-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 non-empty-string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. * @param non-empty-string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. @@ -286,7 +282,7 @@ public static function geoNear( */ public static function graphLookup( string $from, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, + PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, string $connectFromField, string $connectToField, string $as, @@ -302,11 +298,11 @@ public static function graphLookup( * Groups input documents by a specified identifier expression and applies the accumulator expression(s), if specified, to each group. Consumes all input documents and outputs one document per each distinct group. The output documents only contain the identifier field and, if specified, accumulated fields. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/group/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. * @param AccumulatorInterface|Document|Serializable|array|stdClass ...$field Computed using the accumulator operators. */ public static function group( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $_id, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id, Document|Serializable|AccumulatorInterface|stdClass|array ...$field, ): GroupStage { @@ -496,10 +492,10 @@ public static function project( * Reshapes each document in the stream by restricting the content for each document based on information stored in the documents themselves. Incorporates the functionality of $project and $match. Can be used to implement field level redaction. For each input document, outputs either one or zero documents. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function redact( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): RedactStage { return new RedactStage($expression); @@ -572,11 +568,9 @@ public static function searchMeta(Document|Serializable|stdClass|array $meta): S * Alias for $addFields. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$field + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$field */ - public static function set( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$field, - ): SetStage + public static function set(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$field): SetStage { return new SetStage(...$field); } @@ -586,14 +580,14 @@ public static function set( * New in version 5.0. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/setWindowFields/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * @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. * 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|Document|Serializable|array|stdClass $window Specifies the window boundaries and parameters. Window boundaries are inclusive. Default is an unbounded window, which includes all documents in the partition. */ public static function setWindowFields( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $partitionBy, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy, Document|Serializable|stdClass|array $sortBy, Document|Serializable|stdClass|array $output, Optional|Document|Serializable|stdClass|array $window = Optional::Undefined, @@ -639,10 +633,10 @@ public static function sort(Document|Serializable|stdClass|array $sort): SortSta * Groups incoming documents based on the value of a specified expression, then computes the count of documents in each distinct group. * * @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/sortByCount/ - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ public static function sortByCount( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression, ): SortByCountStage { return new SortByCountStage($expression); diff --git a/src/Builder/Stage/GeoNearStage.php b/src/Builder/Stage/GeoNearStage.php index 632251743..ef7ad610b 100644 --- a/src/Builder/Stage/GeoNearStage.php +++ b/src/Builder/Stage/GeoNearStage.php @@ -10,7 +10,6 @@ use MongoDB\BSON\Document; use MongoDB\BSON\Int64; use MongoDB\BSON\Serializable; -use MongoDB\Builder\Expression\ResolvesToInt; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\Optional; use MongoDB\Builder\Type\QueryInterface; @@ -37,8 +36,8 @@ /** @param Document|Serializable|array|stdClass $near The point for which to find the closest documents. */ public Document|Serializable|stdClass|array $near; - /** @param Optional|Decimal128|Int64|ResolvesToInt|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 Optional|Decimal128|Int64|ResolvesToInt|float|int $distanceMultiplier; + /** @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. */ + public Optional|Decimal128|Int64|float|int $distanceMultiplier; /** @param Optional|non-empty-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 Optional|string $includeLocs; @@ -47,16 +46,16 @@ public Optional|string $key; /** - * @param Optional|Decimal128|Int64|ResolvesToInt|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 $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 Optional|Decimal128|Int64|ResolvesToInt|float|int $maxDistance; + public Optional|Decimal128|Int64|float|int $maxDistance; /** - * @param Optional|Decimal128|Int64|ResolvesToInt|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 $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 Optional|Decimal128|Int64|ResolvesToInt|float|int $minDistance; + public Optional|Decimal128|Int64|float|int $minDistance; /** * @param Optional|Document|QueryInterface|Serializable|array|stdClass $query Limits the results to the documents that match the query. The query syntax is the usual MongoDB read operation query syntax. @@ -75,12 +74,12 @@ /** * @param non-empty-string $distanceField The output field that contains the calculated distance. To specify a field within an embedded document, use dot notation. * @param Document|Serializable|array|stdClass $near The point for which to find the closest documents. - * @param Optional|Decimal128|Int64|ResolvesToInt|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 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 Optional|non-empty-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|non-empty-string $key Specify the geospatial indexed field to use when calculating the distance. - * @param Optional|Decimal128|Int64|ResolvesToInt|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 $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|ResolvesToInt|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 $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|Document|QueryInterface|Serializable|array|stdClass $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. @@ -92,11 +91,11 @@ public function __construct( string $distanceField, Document|Serializable|stdClass|array $near, - Optional|Decimal128|Int64|ResolvesToInt|float|int $distanceMultiplier = Optional::Undefined, + Optional|Decimal128|Int64|float|int $distanceMultiplier = Optional::Undefined, Optional|string $includeLocs = Optional::Undefined, Optional|string $key = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|float|int $maxDistance = Optional::Undefined, - Optional|Decimal128|Int64|ResolvesToInt|float|int $minDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $maxDistance = Optional::Undefined, + Optional|Decimal128|Int64|float|int $minDistance = Optional::Undefined, Optional|Document|Serializable|QueryInterface|stdClass|array $query = Optional::Undefined, Optional|bool $spherical = Optional::Undefined, ) { diff --git a/src/Builder/Stage/GraphLookupStage.php b/src/Builder/Stage/GraphLookupStage.php index c7dc98335..8cd1d111c 100644 --- a/src/Builder/Stage/GraphLookupStage.php +++ b/src/Builder/Stage/GraphLookupStage.php @@ -6,26 +6,21 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; use MongoDB\Builder\Type\QueryInterface; use MongoDB\Builder\Type\QueryObject; use MongoDB\Builder\Type\StageInterface; +use MongoDB\Exception\InvalidArgumentException; use MongoDB\Model\BSONArray; use stdClass; +use function array_is_list; use function is_array; use function is_object; @@ -45,8 +40,8 @@ */ public string $from; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith; + /** @param BSONArray|ExpressionInterface|PackedArray|Type|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. */ + public PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith; /** @param non-empty-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. */ public string $connectFromField; @@ -69,7 +64,7 @@ /** * @param non-empty-string $from Target collection for the $graphLookup operation to search, recursively matching the connectFromField to the connectToField. The from collection must be in the same database as any other collections used in the operation. * Starting in MongoDB 5.1, the collection specified in the from parameter can be sharded. - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. + * @param BSONArray|ExpressionInterface|PackedArray|Type|array|bool|float|int|non-empty-string|null|stdClass $startWith Expression that specifies the value of the connectFromField with which to start the recursive search. Optionally, startWith may be array of values, each of which is individually followed through the traversal process. * @param non-empty-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 non-empty-string $connectToField Field name in other documents against which to match the value of the field specified by the connectFromField parameter. * @param non-empty-string $as Name of the array field added to each output document. Contains the documents traversed in the $graphLookup stage to reach the document. @@ -79,7 +74,7 @@ */ public function __construct( string $from, - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, + PackedArray|Type|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $startWith, string $connectFromField, string $connectToField, string $as, @@ -88,6 +83,10 @@ public function __construct( Optional|Document|Serializable|QueryInterface|stdClass|array $restrictSearchWithMatch = Optional::Undefined, ) { $this->from = $from; + if (is_array($startWith) && ! array_is_list($startWith)) { + throw new InvalidArgumentException('Expected $startWith argument to be a list, got an associative array.'); + } + $this->startWith = $startWith; $this->connectFromField = $connectFromField; $this->connectToField = $connectToField; diff --git a/src/Builder/Stage/GroupStage.php b/src/Builder/Stage/GroupStage.php index 35554346d..1839e1664 100644 --- a/src/Builder/Stage/GroupStage.php +++ b/src/Builder/Stage/GroupStage.php @@ -6,23 +6,14 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\AccumulatorInterface; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\StageInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function is_string; @@ -37,18 +28,18 @@ public const NAME = '$group'; public const ENCODE = Encode::Group; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $_id; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id; /** @param stdClass ...$field Computed using the accumulator operators. */ public stdClass $field; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $_id The _id expression specifies the group key. If you specify an _id value of null, or any other constant value, the $group stage returns a single document that aggregates values across all of the input documents. * @param AccumulatorInterface|Document|Serializable|array|stdClass ...$field Computed using the accumulator operators. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $_id, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $_id, Document|Serializable|AccumulatorInterface|stdClass|array ...$field, ) { $this->_id = $_id; diff --git a/src/Builder/Stage/RedactStage.php b/src/Builder/Stage/RedactStage.php index 3e1dbea95..7f259df5d 100644 --- a/src/Builder/Stage/RedactStage.php +++ b/src/Builder/Stage/RedactStage.php @@ -6,21 +6,10 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\StageInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -33,15 +22,14 @@ public const NAME = '$redact'; public const ENCODE = Encode::Single; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Stage/SetStage.php b/src/Builder/Stage/SetStage.php index d62702c2b..fd92eef96 100644 --- a/src/Builder/Stage/SetStage.php +++ b/src/Builder/Stage/SetStage.php @@ -6,22 +6,11 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\StageInterface; use MongoDB\Exception\InvalidArgumentException; -use MongoDB\Model\BSONArray; use stdClass; use function is_string; @@ -37,15 +26,14 @@ public const NAME = '$set'; public const ENCODE = Encode::Single; - /** @param stdClass ...$field */ + /** @param stdClass ...$field */ public stdClass $field; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass ...$field + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass ...$field */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string ...$field, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string ...$field) + { if (\count($field) < 1) { throw new \InvalidArgumentException(\sprintf('Expected at least %d values for $field, got %d.', 1, \count($field))); } diff --git a/src/Builder/Stage/SetWindowFieldsStage.php b/src/Builder/Stage/SetWindowFieldsStage.php index 53a35e190..e65ee51e4 100644 --- a/src/Builder/Stage/SetWindowFieldsStage.php +++ b/src/Builder/Stage/SetWindowFieldsStage.php @@ -6,22 +6,13 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\Optional; use MongoDB\Builder\Type\StageInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -35,8 +26,8 @@ public const NAME = '$setWindowFields'; public const ENCODE = Encode::Object; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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 Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $partitionBy; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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 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. */ public Document|Serializable|stdClass|array $sortBy; @@ -51,14 +42,14 @@ public Optional|Document|Serializable|stdClass|array $window; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $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. + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $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. * @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. * 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|Document|Serializable|array|stdClass $window Specifies the window boundaries and parameters. Window boundaries are inclusive. Default is an unbounded window, which includes all documents in the partition. */ public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $partitionBy, + Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $partitionBy, Document|Serializable|stdClass|array $sortBy, Document|Serializable|stdClass|array $output, Optional|Document|Serializable|stdClass|array $window = Optional::Undefined, diff --git a/src/Builder/Stage/SortByCountStage.php b/src/Builder/Stage/SortByCountStage.php index 938148079..cc8e02fea 100644 --- a/src/Builder/Stage/SortByCountStage.php +++ b/src/Builder/Stage/SortByCountStage.php @@ -6,21 +6,10 @@ namespace MongoDB\Builder\Stage; -use MongoDB\BSON\Binary; -use MongoDB\BSON\Decimal128; -use MongoDB\BSON\Document; -use MongoDB\BSON\Int64; -use MongoDB\BSON\ObjectId; -use MongoDB\BSON\PackedArray; -use MongoDB\BSON\Regex; -use MongoDB\BSON\Serializable; -use MongoDB\BSON\Timestamp; -use MongoDB\BSON\UTCDateTime; -use MongoDB\Builder\Expression\ResolvesToInt; +use MongoDB\BSON\Type; use MongoDB\Builder\Type\Encode; use MongoDB\Builder\Type\ExpressionInterface; use MongoDB\Builder\Type\StageInterface; -use MongoDB\Model\BSONArray; use stdClass; /** @@ -33,15 +22,14 @@ public const NAME = '$sortByCount'; public const ENCODE = Encode::Object; - /** @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression; + /** @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ + public Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression; /** - * @param BSONArray|Binary|Decimal128|Document|ExpressionInterface|Int64|ObjectId|PackedArray|Regex|ResolvesToInt|Serializable|Timestamp|UTCDateTime|array|bool|float|int|non-empty-string|null|stdClass $expression + * @param ExpressionInterface|Type|array|bool|float|int|non-empty-string|null|stdClass $expression */ - public function __construct( - Binary|Decimal128|Document|Int64|ObjectId|PackedArray|Regex|Serializable|Timestamp|UTCDateTime|ResolvesToInt|ExpressionInterface|BSONArray|stdClass|array|bool|float|int|null|string $expression, - ) { + public function __construct(Type|ExpressionInterface|stdClass|array|bool|float|int|null|string $expression) + { $this->expression = $expression; } } diff --git a/src/Builder/Type/OutputWindow.php b/src/Builder/Type/OutputWindow.php index 1e2e4e2d3..cea809b46 100644 --- a/src/Builder/Type/OutputWindow.php +++ b/src/Builder/Type/OutputWindow.php @@ -51,7 +51,7 @@ public function __construct( if ($range !== Optional::Undefined) { if (! array_is_list($range) || ! count($range) === 2) { - throw new InvalidArgumentException('Expected $range argument to be a list of 2 string or int.'); + throw new InvalidArgumentException('Expected $range argument to be a list of 2 string or numeric.'); } $window ??= new stdClass(); diff --git a/tests/Builder/BuilderEncoderTest.php b/tests/Builder/BuilderEncoderTest.php index 3679d6342..96563346f 100644 --- a/tests/Builder/BuilderEncoderTest.php +++ b/tests/Builder/BuilderEncoderTest.php @@ -208,6 +208,46 @@ public function testSetWindowFields(): void $this->assertSamePipeline($expected, $pipeline); } + public function testUnionWith(): void + { + $unionWith = Stage::unionWith(...); + $match = Stage::match(...); + $project = Stage::project(...); + $pipeline = new Pipeline( + $unionWith( + coll: 'orders', + pipeline: new Pipeline( + $match(status: 'A'), + $project( + item: 1, + status: 1, + ), + ), + ), + ); + + $expected = [ + [ + '$unionWith' => [ + 'coll' => 'orders', + 'pipeline' => [ + [ + '$match' => ['status' => 'A'], + ], + [ + '$project' => [ + 'item' => 1, + 'status' => 1, + ], + ], + ], + ], + ], + ]; + + $this->assertSamePipeline($expected, $pipeline); + } + /** @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/redact/ */ public function testRedactStage(): void {