Skip to content

Commit abc36b1

Browse files
Merge v1.x into v2.x (#1614)
2 parents 4509fe6 + ad5b49a commit abc36b1

File tree

130 files changed

+1212
-863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+1212
-863
lines changed

generator/config/expressions.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace MongoDB\Builder\Expression;
88

9+
use DateTimeInterface;
910
use MongoDB\BSON;
1011
use MongoDB\Builder\Pipeline;
1112
use MongoDB\Builder\Type;
@@ -26,7 +27,7 @@
2627
'binData' => ['string', BSON\Binary::class],
2728
'objectId' => [BSON\ObjectId::class],
2829
'bool' => ['bool'],
29-
'date' => [BSON\UTCDateTime::class],
30+
'date' => [BSON\UTCDateTime::class, DateTimeInterface::class],
3031
'null' => ['null'],
3132
'regex' => [BSON\Regex::class],
3233
'javascript' => ['string', BSON\Javascript::class],
@@ -37,7 +38,7 @@
3738
];
3839

3940
// "any" accepts all the BSON types. No generic "object" or "mixed"
40-
$bsonTypes['any'] = ['bool', 'int', 'float', 'string', 'array', 'null', stdClass::class, BSON\Type::class];
41+
$bsonTypes['any'] = ['bool', 'int', 'float', 'string', 'array', 'null', stdClass::class, BSON\Type::class, DateTimeInterface::class];
4142

4243
// "number" accepts all the numeric types
4344
$bsonTypes['number'] = ['int', 'float', BSON\Int64::class, BSON\Decimal128::class];

psalm-baseline.xml

+13-6
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@
4040
<code><![CDATA[stdClass]]></code>
4141
</MoreSpecificReturnType>
4242
</file>
43-
<file src="src/Builder/Encoder/AbstractExpressionEncoder.php">
44-
<MixedAssignment>
45-
<code><![CDATA[$val]]></code>
46-
<code><![CDATA[$val]]></code>
47-
<code><![CDATA[$value[$key]]]></code>
48-
</MixedAssignment>
43+
<file src="src/Builder/BuilderEncoder.php">
44+
<MixedReturnStatement>
45+
<code><![CDATA[$encoder->encode($value)]]></code>
46+
</MixedReturnStatement>
4947
</file>
5048
<file src="src/Builder/Encoder/CombinedFieldQueryEncoder.php">
5149
<MixedAssignment>
@@ -98,6 +96,13 @@
9896
<code><![CDATA[$value]]></code>
9997
</MixedAssignment>
10098
</file>
99+
<file src="src/Builder/Encoder/RecursiveEncode.php">
100+
<MixedAssignment>
101+
<code><![CDATA[$val]]></code>
102+
<code><![CDATA[$val]]></code>
103+
<code><![CDATA[$value[$key]]]></code>
104+
</MixedAssignment>
105+
</file>
101106
<file src="src/Builder/Query.php">
102107
<ArgumentTypeCoercion>
103108
<code><![CDATA[$query]]></code>
@@ -239,6 +244,8 @@
239244
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
240245
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
241246
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
247+
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
248+
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
242249
</InvalidReturnType>
243250
<MixedArgumentTypeCoercion>
244251
<code><![CDATA[$value]]></code>

src/Builder/Accumulator/AddToSetAccumulator.php

+7-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Accumulator/BottomAccumulator.php

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Accumulator/BottomNAccumulator.php

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Builder/Accumulator/DerivativeAccumulator.php

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)