diff --git a/rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockReturnArrayFromDirectArrayInstanceRector/Fixture/repeated_item_type.php.inc b/rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockReturnArrayFromDirectArrayInstanceRector/Fixture/repeated_item_type.php.inc new file mode 100644 index 00000000000..9bc257ac9f9 --- /dev/null +++ b/rules-tests/TypeDeclarationDocblocks/Rector/ClassMethod/DocblockReturnArrayFromDirectArrayInstanceRector/Fixture/repeated_item_type.php.inc @@ -0,0 +1,66 @@ + $this->partitionName, + 'replica_number' => $this->replicaNumber, + 'timeout' => $this->timeout, + ]; + + $params = array_filter($params); + + return [ + 'collection_name' => $this->collectionName, + 'params' => $params, + ]; + } +} + +?> +----- +> + */ + public function toRequestPayload(): array + { + $params = [ + 'partition_name' => $this->partitionName, + 'replica_number' => $this->replicaNumber, + 'timeout' => $this->timeout, + ]; + + $params = array_filter($params); + + return [ + 'collection_name' => $this->collectionName, + 'params' => $params, + ]; + } +} + +?> diff --git a/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php b/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php index 3325bf3ba07..15cdcc4252a 100644 --- a/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php +++ b/src/BetterPhpDocParser/ValueObject/Type/BracketsAwareUnionTypeNode.php @@ -25,6 +25,7 @@ public function __construct( */ public function __toString(): string { + $this->types = array_unique($this->types, SORT_REGULAR); if (! $this->isWrappedInBrackets) { return implode('|', $this->types); }