Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions generator/config/expressions.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace MongoDB\Builder\Expression;

use DateTimeInterface;
use MongoDB\BSON;
use MongoDB\Builder\Pipeline;
use MongoDB\Builder\Type;
Expand All @@ -26,7 +27,7 @@
'binData' => ['string', BSON\Binary::class],
'objectId' => [BSON\ObjectId::class],
'bool' => ['bool'],
'date' => [BSON\UTCDateTime::class],
'date' => [BSON\UTCDateTime::class, DateTimeInterface::class],
'null' => ['null'],
'regex' => [BSON\Regex::class],
'javascript' => ['string', BSON\Javascript::class],
Expand All @@ -37,7 +38,7 @@
];

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

// "number" accepts all the numeric types
$bsonTypes['number'] = ['int', 'float', BSON\Int64::class, BSON\Decimal128::class];
Expand Down
19 changes: 13 additions & 6 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,10 @@
<code><![CDATA[stdClass]]></code>
</MoreSpecificReturnType>
</file>
<file src="src/Builder/Encoder/AbstractExpressionEncoder.php">
<MixedAssignment>
<code><![CDATA[$val]]></code>
<code><![CDATA[$val]]></code>
<code><![CDATA[$value[$key]]]></code>
</MixedAssignment>
<file src="src/Builder/BuilderEncoder.php">
<MixedReturnStatement>
<code><![CDATA[$encoder->encode($value)]]></code>
</MixedReturnStatement>
</file>
<file src="src/Builder/Encoder/CombinedFieldQueryEncoder.php">
<MixedAssignment>
Expand Down Expand Up @@ -98,6 +96,13 @@
<code><![CDATA[$value]]></code>
</MixedAssignment>
</file>
<file src="src/Builder/Encoder/RecursiveEncode.php">
<MixedAssignment>
<code><![CDATA[$val]]></code>
<code><![CDATA[$val]]></code>
<code><![CDATA[$value[$key]]]></code>
</MixedAssignment>
</file>
<file src="src/Builder/Query.php">
<ArgumentTypeCoercion>
<code><![CDATA[$query]]></code>
Expand Down Expand Up @@ -239,6 +244,8 @@
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
<code><![CDATA[($value is NativeType ? BSONType : $value)]]></code>
</InvalidReturnType>
<MixedArgumentTypeCoercion>
<code><![CDATA[$value]]></code>
Expand Down
12 changes: 7 additions & 5 deletions src/Builder/Accumulator/AddToSetAccumulator.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/Builder/Accumulator/BottomAccumulator.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/Builder/Accumulator/BottomNAccumulator.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions src/Builder/Accumulator/DerivativeAccumulator.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading