Skip to content

Commit

Permalink
Fixes after PHPStan update
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Sep 24, 2024
1 parent 23a776d commit bd9efb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Type/Symfony/EnvelopeReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ public function getTypeFromMethodCall(
if (count($methodCall->getArgs()) === 0) {
return new ArrayType(
new GenericClassStringType(new ObjectType('Symfony\Component\Messenger\Stamp\StampInterface')),
AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), new ObjectType('Symfony\Component\Messenger\Stamp\StampInterface'))),
TypeCombinator::intersect(new ArrayType(new IntegerType(), new ObjectType('Symfony\Component\Messenger\Stamp\StampInterface')), new AccessoryArrayListType()),
);
}

$argType = $scope->getType($methodCall->getArgs()[0]->value);
if (count($argType->getConstantStrings()) === 0) {
return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), new ObjectType('Symfony\Component\Messenger\Stamp\StampInterface')));
return TypeCombinator::intersect(new ArrayType(new IntegerType(), new ObjectType('Symfony\Component\Messenger\Stamp\StampInterface')), new AccessoryArrayListType());
}

$objectTypes = [];
foreach ($argType->getConstantStrings() as $constantString) {
$objectTypes[] = new ObjectType($constantString->getValue());
}

return AccessoryArrayListType::intersectWith(new ArrayType(new IntegerType(), TypeCombinator::union(...$objectTypes)));
return TypeCombinator::intersect(new ArrayType(new IntegerType(), TypeCombinator::union(...$objectTypes)), new AccessoryArrayListType());
}

}

0 comments on commit bd9efb7

Please sign in to comment.