Skip to content

Commit

Permalink
psalm fix
Browse files Browse the repository at this point in the history
  • Loading branch information
morrislaptop committed Jul 12, 2022
1 parent 484aace commit 94d1352
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Psalm

on:
pull_request:
paths:
- '**.php'
- 'psalm.xml.dist'
push:
paths:
- '**.php'
Expand Down
6 changes: 6 additions & 0 deletions src/PropertyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,15 @@ protected function extractDocBlockType(ReflectionProperty $property): ?string

if ($type->isCollection()) {
// Patch for Symfony 6
/**
* @psalm-suppress RedundantCondition
*/
if (method_exists($type, 'getCollectionValueTypes')) {
$collectionType = $type->getCollectionValueTypes()[0];
} else {
/**
* @psalm-suppress UndefinedMethod
*/
$collectionType = $type->getCollectionValueType();
}
$className = $collectionType->getClassName() ?? $collectionType->getBuiltinType();
Expand Down

0 comments on commit 94d1352

Please sign in to comment.