Skip to content

Commit

Permalink
Use object check instead of null (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 8, 2024
1 parent 162fe00 commit 3514eca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<!-- Psalm equivalent of PHPStan config `treatPhpDocTypesAsCertain: false` -->
<DocblockTypeContradiction errorLevel="suppress"/>
<RedundantConditionGivenDocblockType errorLevel="suppress"/>
<MissingClassConstType errorLevel="suppress"/>
</issueHandlers>
</psalm>
4 changes: 0 additions & 4 deletions src/Collection/AuditedCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ public function exists(\Closure $p)
*
* @phpstan-param \Closure(T, TKey):bool $p
* @phpstan-return Collection<TKey, T>
*
* @psalm-suppress MoreSpecificImplementedParamType https://github.com/doctrine/collections/pull/411
*/
#[\ReturnTypeWillChange]
public function filter(\Closure $p)
Expand Down Expand Up @@ -341,8 +339,6 @@ public function map(\Closure $func)
*
* @phpstan-param \Closure(TKey, T):bool $p
* @phpstan-return array{0: Collection<TKey, T>, 1: Collection<TKey, T>}
*
* @psalm-suppress MoreSpecificImplementedParamType https://github.com/doctrine/collections/pull/411
*/
#[\ReturnTypeWillChange]
public function partition(\Closure $p)
Expand Down
4 changes: 2 additions & 2 deletions src/EventListener/LogRevisionsListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ private function saveRevisionEntityData(EntityManagerInterface $em, ClassMetadat
$data = $entityData[$field] ?? null;
$relatedId = [];

if (null !== $data && $uow->isInIdentityMap($data)) {
if (\is_object($data) && $uow->isInIdentityMap($data)) {
$relatedId = $uow->getEntityIdentifier($data);
}

Expand Down Expand Up @@ -744,7 +744,7 @@ private function prepareUpdateData(EntityManagerInterface $em, EntityPersister $

$newValId = null;

if (null !== $newVal) {
if (\is_object($newVal)) {
if (!$uow->isInIdentityMap($newVal)) {
continue;
}
Expand Down

0 comments on commit 3514eca

Please sign in to comment.