diff --git a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/GeoWithin.php b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/GeoWithin.php index 026b850cc0..5237a194dd 100644 --- a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/GeoWithin.php +++ b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/GeoWithin.php @@ -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) { diff --git a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SetWindowFields/Output.php b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SetWindowFields/Output.php index d9f1a9a966..386d9ff30e 100644 --- a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SetWindowFields/Output.php +++ b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SetWindowFields/Output.php @@ -37,10 +37,7 @@ class Output extends Operator implements WindowOperators private string $currentField = ''; - /** - * @var array - * @psalm-var array - */ + /** @psalm-var array */ private array $windows = []; public function __construct(Builder $builder, private SetWindowFields $setWindowFields) diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php index cb0d0e08bb..874050d9b5 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php @@ -1845,13 +1845,13 @@ public function getFieldMapping(string $fieldName): array /** * Gets mappings of fields holding embedded document(s). * - * @psalm-return array + * @psalm-return array */ public function getEmbeddedFieldsMappings(): array { return array_filter( $this->associationMappings, - static fn ($assoc) => ! empty($assoc['embedded']) + static fn ($assoc) => ! empty($assoc['embedded']), ); } diff --git a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php index b25ea58eb0..c80b9d9099 100644 --- a/lib/Doctrine/ODM/MongoDB/UnitOfWork.php +++ b/lib/Doctrine/ODM/MongoDB/UnitOfWork.php @@ -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) { @@ -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) { @@ -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) { @@ -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) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f8d7c76aa6..0aafde288d 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -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 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index bc854ae734..fe37bade60 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + @@ -60,14 +60,9 @@ - associationMappings, - static fn ($assoc) => ! empty($assoc['embedded']) - )]]> - ]]> @@ -305,11 +300,6 @@ name])]]> - - - - - diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Functional/DocumentPersisterTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Functional/DocumentPersisterTest.php index 326446298f..6be4e71123 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Functional/DocumentPersisterTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Functional/DocumentPersisterTest.php @@ -602,7 +602,6 @@ public function testPrepareQueryOrNewObjWithEmbeddedReferenceToTargetDocumentWit self::assertEquals($expected, $documentPersister->prepareQueryOrNewObj($value)); } - /** @return array */ public static function dataProviderTestWriteConcern(): array { return [ diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php index f4ea08679b..832a208feb 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Mapping/BasicInheritanceMappingTest.php @@ -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; @@ -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 { diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Persisters/PersistenceBuilderTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Persisters/PersistenceBuilderTest.php index 5e3f393f5e..015a4c184a 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Persisters/PersistenceBuilderTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Persisters/PersistenceBuilderTest.php @@ -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 { diff --git a/tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php b/tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php index 9f15207a16..77252d76d4 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/Query/BuilderTest.php @@ -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 {