Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
mongodb-version:
- "6.0"
- "7.0"
- "8.0"
- "9.0"

env:
MONGODB_URI: 'mongodb://localhost:27017'
Expand Down
24 changes: 0 additions & 24 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@ parameters:
count: 1
path: src/Repository/MongoDBRepository.php

-
message: '#^Parameter \#1 \$documents of method MongoDB\\Collection\:\:insertMany\(\) expects list\<array\|object\>, array\<int\|string, array\<string, mixed\>\> given\.$#'
identifier: argument.type
count: 1
path: src/Repository/MongoDBRepository.php

-
message: '#^Parameter \#1 \$operations of method MongoDB\\Collection\:\:bulkWrite\(\) expects list\<array\{deleteMany\: array\{0\: array\|object, 1\?\: array\}\}\|array\{deleteOne\: array\{0\: array\|object, 1\?\: array\}\}\|array\{insertOne\: array\{array\|object\}\}\|array\{replaceOne\: array\{0\: array\|object, 1\: array\|object, 2\?\: array\}\}\|array\{updateMany\: array\{0\: array\|object, 1\: array\|object, 2\?\: array\}\}\|array\{updateOne\: array\{0\: array\|object, 1\: array\|object, 2\?\: array\}\}\>, non\-empty\-array\<int\|string, array\{updateOne\: array\{array\<string, mixed\>, array\{''\$set''\: array\<string, mixed\>\}\}\}\> given\.$#'
identifier: argument.type
count: 1
path: src/Repository/MongoDBRepository.php

-
message: '#^Parameter \#2 \$data of method Patchlevel\\ODM\\Hydrator\\DocumentHydrator\:\:hydrate\(\) expects array\<string, mixed\>, array\|object given\.$#'
identifier: argument.type
Expand Down Expand Up @@ -114,18 +102,6 @@ parameters:
count: 1
path: src/Repository/RangoRepository.php

-
message: '#^Parameter \#1 \$documents of method Patchlevel\\Rango\\Collection\<array\<string, mixed\>\>\:\:insertMany\(\) expects list\<array\<string, mixed\>\>, array\<int\|string, array\<string, mixed\>\> given\.$#'
identifier: argument.type
count: 1
path: src/Repository/RangoRepository.php

-
message: '#^Parameter \#1 \$operations of method Patchlevel\\Rango\\Collection\<array\<string, mixed\>\>\:\:bulkWrite\(\) expects list\<array\<string, list\<array\<string, mixed\>\>\>\>, non\-empty\-array\<int\|string, array\{updateOne\: array\{array\<string, mixed\>, array\{''\$set''\: array\<string, mixed\>\}\}\}\> given\.$#'
identifier: argument.type
count: 1
path: src/Repository/RangoRepository.php

-
message: '#^Property Patchlevel\\ODM\\Repository\\RangoRepository\:\:\$collection with generic class Patchlevel\\Rango\\Collection does not specify its types\: TDocument$#'
identifier: missingType.generics
Expand Down
5 changes: 5 additions & 0 deletions src/Metadata/DocumentMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public function discriminatorFilter(): array
return [$this->discriminatorField => ['$in' => $this->discriminatorValues]];
}

/** @throws UnknownPropertyPath */
public function propertyPathToFieldPath(string $propertyPath): string
{
return $this->propertyPathToFieldPathWithChildren($propertyPath, $this->fields)[0];
Expand All @@ -131,6 +132,8 @@ public function propertyPathToFieldPath(string $propertyPath): string
* @param array<string, mixed> $filter
*
* @return array<string, mixed>
*
* @throws UnknownPropertyPath
*/
public function mapFilterToFieldPaths(array $filter): array
{
Expand Down Expand Up @@ -210,6 +213,8 @@ private function propertyPathToFieldPathWithChildren(string $propertyPath, array
* @param array<string, 'asc' | 'desc'> $orderBy
*
* @return array<string, -1|1>
*
* @throws UnknownPropertyPath
*/
public function mapSortingToFieldPaths(array $orderBy): array
{
Expand Down
5 changes: 5 additions & 0 deletions src/Repository/MongoDBRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Patchlevel\ODM\Metadata\DocumentMetadata;

use function array_map;
use function array_values;
use function count;
use function in_array;
use function iterator_to_array;
Expand Down Expand Up @@ -40,6 +41,8 @@ public function __construct(
/** @param list<T> ...$objects */
public function insert(object ...$objects): void
{
$objects = array_values($objects);

try {
if (count($objects) === 1) {
$object = $objects[0];
Expand Down Expand Up @@ -73,6 +76,8 @@ public function update(object ...$objects): void
return;
}

$objects = array_values($objects);

if (count($objects) === 1) {
$update = $this->prepareUpdate($objects[0]);

Expand Down
5 changes: 5 additions & 0 deletions src/Repository/RangoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Patchlevel\Rango\Exception\QueryException;

use function array_map;
use function array_values;
use function count;
use function in_array;
use function str_ends_with;
Expand Down Expand Up @@ -39,6 +40,8 @@ public function __construct(
/** @param list<T> ...$objects */
public function insert(object ...$objects): void
{
$objects = array_values($objects);

try {
if (count($objects) === 1) {
$object = $objects[0];
Expand Down Expand Up @@ -78,6 +81,8 @@ public function update(object ...$objects): void
return;
}

$objects = array_values($objects);

if (count($objects) === 1) {
$update = $this->prepareUpdate($objects[0]);

Expand Down
Loading