Skip to content

Commit

Permalink
Fix psalm errors
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed Mar 27, 2024
1 parent 339f618 commit 18f9828
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ 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
{
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 @@ -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

0 comments on commit 18f9828

Please sign in to comment.