Skip to content

Commit

Permalink
Merge pull request #2620 from malarzm/fix-ci
Browse files Browse the repository at this point in the history
Fix CI
  • Loading branch information
malarzm authored Mar 27, 2024
2 parents 8c7fa3f + 18f9828 commit 4325c11
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ public function getOperatorParams(): object
return $this->appendScore($params);
}

/**
* @param array|Geometry $geometry
*
* @return array
*/
/** @param array|Geometry $geometry */
private function convertGeometry($geometry): array
{
if (! $geometry instanceof Geometry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ class Output extends Operator implements WindowOperators

private string $currentField = '';

/**
* @var array
* @psalm-var array<string, Window>
*/
/** @psalm-var array<string, Window> */
private array $windows = [];

public function __construct(Builder $builder, private SetWindowFields $setWindowFields)
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,13 +1845,13 @@ public function getFieldMapping(string $fieldName): array
/**
* Gets mappings of fields holding embedded document(s).
*
* @psalm-return array<string, FieldMapping>
* @psalm-return array<string, AssociationFieldMapping>
*/
public function getEmbeddedFieldsMappings(): array
{
return array_filter(
$this->associationMappings,
static fn ($assoc) => ! empty($assoc['embedded'])
static fn ($assoc) => ! empty($assoc['embedded']),
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ODM/MongoDB/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ private function computeOrRecomputeChangeSet(ClassMetadata $class, object $docum
// Look for changes in associations of the document
$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => empty($assoc['notSaved'])
static fn ($assoc) => empty($assoc['notSaved']),
);

foreach ($associationMappings as $mapping) {
Expand Down Expand Up @@ -2169,7 +2169,7 @@ private function cascadeRefresh(object $document, array &$visited): void

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadeRefresh']
static fn ($assoc) => $assoc['isCascadeRefresh'],
);

foreach ($associationMappings as $mapping) {
Expand Down Expand Up @@ -2229,7 +2229,7 @@ private function cascadeMerge(object $document, object $managedCopy, array &$vis

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadeMerge']
static fn ($assoc) => $assoc['isCascadeMerge'],
);

foreach ($associationMappings as $assoc) {
Expand Down Expand Up @@ -2261,7 +2261,7 @@ private function cascadePersist(object $document, array &$visited): void

$associationMappings = array_filter(
$class->associationMappings,
static fn ($assoc) => $assoc['isCascadePersist']
static fn ($assoc) => $assoc['isCascadePersist'],
);

foreach ($associationMappings as $fieldName => $mapping) {
Expand Down
10 changes: 10 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,16 @@ parameters:
count: 1
path: tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php

-
message: "#^Property Doctrine\\\\ODM\\\\MongoDB\\\\Tests\\\\Mapping\\\\MappedSuperclassRelated1\\:\\:\\$id is unused\\.$#"
count: 1
path: tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php

-
message: "#^Property Doctrine\\\\ODM\\\\MongoDB\\\\Tests\\\\Mapping\\\\MappedSuperclassRelated1\\:\\:\\$name is unused\\.$#"
count: 1
path: tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php

-
message: "#^Property Doctrine\\\\ODM\\\\MongoDB\\\\Tests\\\\Mapping\\\\TransientBaseClass\\:\\:\\$transient1 is unused\\.$#"
count: 1
Expand Down
12 changes: 1 addition & 11 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.22.2@d768d914152dbbf3486c36398802f74e80cfde48">
<files psalm-version="5.23.1@8471a896ccea3526b26d082f4461eeea467f10a4">
<file src="lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php">
<MissingTemplateParam>
<code><![CDATA[IteratorAggregate]]></code>
Expand Down Expand Up @@ -60,14 +60,9 @@
</InvalidPropertyAssignmentValue>
<InvalidReturnStatement>
<code><![CDATA[$mapping]]></code>
<code><![CDATA[array_filter(
$this->associationMappings,
static fn ($assoc) => ! empty($assoc['embedded'])
)]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[FieldMapping]]></code>
<code><![CDATA[array<string, FieldMapping>]]></code>
</InvalidReturnType>
<LessSpecificImplementedReturnType>
<code><![CDATA[array]]></code>
Expand Down Expand Up @@ -305,11 +300,6 @@
<code><![CDATA[empty($divided[$class->name])]]></code>
</TypeDoesNotContainType>
</file>
<file src="tests/Doctrine/ODM/MongoDB/Tests/Aggregation/Stage/OperatorTest.php">
<InternalClass>
<code><![CDATA[Operator]]></code>
</InternalClass>
</file>
<file src="tests/Doctrine/ODM/MongoDB/Tests/Aggregation/Stage/UnsetTest.php">
<InvalidArgument>
<code><![CDATA[$documentPersister]]></code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,6 @@ public function testPrepareQueryOrNewObjWithEmbeddedReferenceToTargetDocumentWit
self::assertEquals($expected, $documentPersister->prepareQueryOrNewObj($value));
}

/** @return array */
public static function dataProviderTestWriteConcern(): array
{
return [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Doctrine\ODM\MongoDB\Mapping\ClassMetadataFactory;
use Doctrine\ODM\MongoDB\Mapping\MappingException;
use Doctrine\ODM\MongoDB\Tests\BaseTestCase;
use Doctrine\ODM\MongoDB\Tests\Functional\MappedSuperclassRelated1;

use function serialize;
use function unserialize;
Expand Down Expand Up @@ -132,6 +131,18 @@ class MappedSuperclassBase
private $transient;
}

#[ODM\Document]
class MappedSuperclassRelated1
{
/** @var int|null */
#[ODM\Id(strategy: 'none')]
private $id;

/** @var string|null */
#[ODM\Field(type: 'string')]
private $name;
}

#[ODM\Document]
class DocumentSubClass2 extends MappedSuperclassBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ public function testPrepareInsertData(object $document, array $expectedData): vo
/**
* Provides data for @see PersistenceBuilderTest::testPrepareInsertData()
* Returns arrays of array(document => expected data)
*
* @return array
*/
public static function getDocumentsAndExpectedData(): array
{
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,6 @@ public static function provideExcludeProjections(): array
* Provide arguments for select() and exclude() tests.
*
* @param bool $include Whether the field should be included or excluded
*
* @return array
*/
private static function provideProjections(bool $include): array
{
Expand Down

0 comments on commit 4325c11

Please sign in to comment.