Skip to content

Commit 7038f1b

Browse files
committed
Fix PHPStan type checking issue in GetAssociationTypeCodeByAssociationIdQuery
This commit addresses the PHPStan error "Cannot access offset 'code' on mixed" by using getScalarResult() instead of getOneOrNullResult(). Changes made: - Changed from getOneOrNullResult() to getScalarResult() - Updated array access to $result[0]['code'] to properly access scalar results - Maintained null coalescing operator for handling empty results Using getScalarResult() provides better type safety as it returns a well-defined array structure that PHPStan can properly analyze, eliminating the type checking warnings. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b84f9c2 commit 7038f1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Doctrine/Query/GetAssociationTypeCodeByAssociationIdQuery.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public function get(int $associationId): ?string
2525
->where('pa.id = :associationId')
2626
->setParameter('associationId', $associationId)
2727
->getQuery()
28-
->getOneOrNullResult()
28+
->getScalarResult()
2929
;
3030

31-
return $result['code'] ?? null;
31+
return $result[0]['code'] ?? null;
3232
}
3333
}

0 commit comments

Comments
 (0)