@@ -14,7 +14,7 @@ class AttributedStringBuilder
1414 * @param bool $trimWhitespaceAroundAttachments Whether to trim whitespace around attachments.
1515 */
1616 public function __construct (
17- public readonly bool $ preserveWhitespace = false ,
17+ public readonly bool $ preserveWhitespace = true ,
1818 public readonly bool $ trimWhitespaceAroundAttachments = false
1919 ) {
2020 }
@@ -104,7 +104,10 @@ private function normalizeTrailingSpace(): array
104104 return $ elements ;
105105 }
106106
107- public function appendString (string $ string , AttributeContainer $ attributes ): void
107+ /**
108+ * @param AttributeContainer|array<int, Attribute> $attributes
109+ */
110+ public function appendString (string $ string , AttributeContainer |array $ attributes = []): void
108111 {
109112 $ string = $ this ->normalizeSpace ($ string , end ($ this ->elements ) ?: null );
110113 if (strlen ($ string ) === 0 ) {
@@ -114,7 +117,10 @@ public function appendString(string $string, AttributeContainer $attributes): vo
114117 $ this ->elements [] = new AttributedSubstring ($ string , $ attributes );
115118 }
116119
117- public function appendLineBreak (AttributeContainer $ attributes ): void
120+ /**
121+ * @param AttributeContainer|array<int, Attribute> $attributes
122+ */
123+ public function appendLineBreak (AttributeContainer |array $ attributes = []): void
118124 {
119125 $ this ->elements [] = new AttributedSubstring ("\n" , $ attributes );
120126 }
0 commit comments