Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jun 19, 2024
1 parent 2aa11f1 commit b4741b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Model/ModelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function getIdentifierValues(object $model): array

public function getIdentifierFieldNames(string $class): array
{
return array_filter($this->getMetadata($class)->getIdentifier());
return array_filter($this->getMetadata($class)->getIdentifier(), static fn (?string $id) => null !== $id);
}

public function getNormalizedIdentifier(object $model): ?string
Expand Down
5 changes: 3 additions & 2 deletions tests/Model/ModelManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ public function testFailingBatchDelete(string $expectedExceptionMessage, array $
Configuration::AUTOGENERATE_FILE_NOT_EXISTS
);
$uow = new UnitOfWork($dm, $eventManager, $hydratorFactory);
/** @psalm-suppress InternalMethod */
$hydratorFactory->setUnitOfWork($uow);
if (method_exists($hydratorFactory, 'setUnitOfWork')) {

Check failure on line 330 in tests/Model/ModelManagerTest.php

View workflow job for this annotation

GitHub Actions / PHPStan

Call to function method_exists() with Doctrine\ODM\MongoDB\Hydrator\HydratorFactory and 'setUnitOfWork' will always evaluate to false.
$hydratorFactory->setUnitOfWork($uow);
}

$dm
->expects(static::atLeastOnce())
Expand Down

0 comments on commit b4741b8

Please sign in to comment.