Skip to content

Commit

Permalink
Fix phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
Korbeil committed Dec 9, 2023
1 parent f5b82c7 commit 60ecb7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
7 changes: 2 additions & 5 deletions src/Transformer/AbstractUniqueTypeTransformerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ abstract class AbstractUniqueTypeTransformerFactory implements TransformerFactor
{
public function getTransformer(?array $sourceTypes, ?array $targetTypes, MapperMetadataInterface $mapperMetadata): ?TransformerInterface
{
$nbSourceTypes = $sourceTypes ? \count($sourceTypes) : 0;
$nbTargetTypes = $targetTypes ? \count($targetTypes) : 0;

if (0 === $nbSourceTypes || $nbSourceTypes > 1 || !$sourceTypes[0] instanceof Type) {
if (0 === \count($sourceTypes ?? []) || \count($sourceTypes) > 1 || !$sourceTypes[0] instanceof Type) {
return null;
}

if (0 === $nbTargetTypes || $nbTargetTypes > 1 || !$targetTypes[0] instanceof Type) {
if (0 === \count($targetTypes ?? []) || \count($targetTypes) > 1 || !$targetTypes[0] instanceof Type) {
return null;
}

Expand Down
5 changes: 0 additions & 5 deletions tools/phpstan/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -535,11 +535,6 @@ parameters:
count: 1
path: ../../src/Transformer/AbstractArrayTransformer.php

-
message: "#^Offset 0 does not exist on array\\<Symfony\\\\Component\\\\PropertyInfo\\\\Type\\>\\|null\\.$#"
count: 2
path: ../../src/Transformer/AbstractUniqueTypeTransformerFactory.php

-
message: "#^Parameter \\#1 \\$object_or_class of function is_subclass_of expects object\\|string, string\\|null given\\.$#"
count: 2
Expand Down

0 comments on commit 60ecb7e

Please sign in to comment.