Skip to content

Commit 32b64f5

Browse files
committed
Fix type assertion
1 parent de7f4e4 commit 32b64f5

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

phpstan.neon.dist

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ parameters:
1111

1212
editorUrl: 'phpstorm://open?file=%%file%%&line=%%line%%'
1313

14+
universalObjectCratesClasses:
15+
- MongoDB\BSON\Document
16+
1417
ignoreErrors:
1518
- '#Unsafe usage of new static#'
1619
- '#Call to an undefined method [a-zA-Z0-9\\_\<\>\(\)]+::[a-zA-Z]+\(\)#'

src/Session/MongoDbSessionHandler.php

+3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313

1414
use Illuminate\Session\DatabaseSessionHandler;
1515
use MongoDB\BSON\Binary;
16+
use MongoDB\BSON\Document;
1617
use MongoDB\BSON\UTCDateTime;
1718
use MongoDB\Collection;
1819

20+
use function assert;
1921
use function tap;
2022
use function time;
2123

@@ -54,6 +56,7 @@ public function read($sessionId): string|false
5456
'typeMap' => ['root' => 'bson'],
5557
],
5658
);
59+
assert($result instanceof Document);
5760

5861
return $result ? (string) $result->payload : false;
5962
}

tests/Query/BuilderTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ function (Builder $builder) {
868868
[],
869869
],
870870
],
871-
fn (Builder $builder) => $builder->whereDate('created_at', '=', new DateTimeImmutable('2018-09-30 15:00:00 +02:00')),
871+
fn (Builder $builder) => $builder->whereDate('created_at', '=', new DateTimeImmutable('2018-09-30 15:00:00 +00:00')),
872872
];
873873

874874
yield 'where date !=' => [

0 commit comments

Comments
 (0)