@@ -39,24 +39,23 @@ public static function coalesce(?string ...$strings): ?string
3939 }
4040
4141 /**
42- * Convert ASCII alphabetic characters in a string to lowercase
42+ * Convert an ASCII string to lowercase
4343 */
4444 public static function lower (string $ string ): string
4545 {
4646 return strtr ($ string , self ::UPPER , self ::LOWER );
4747 }
4848
4949 /**
50- * Convert ASCII alphabetic characters in a string to uppercase
50+ * Convert an ASCII string to uppercase
5151 */
5252 public static function upper (string $ string ): string
5353 {
5454 return strtr ($ string , self ::LOWER , self ::UPPER );
5555 }
5656
5757 /**
58- * If the first character in a string is an ASCII alphabetic character, make
59- * it uppercase
58+ * Make the first character in an ASCII string uppercase
6059 */
6160 public static function upperFirst (string $ string ): string
6261 {
@@ -102,7 +101,7 @@ public static function matchCase(string $string, string $match): string
102101 }
103102
104103 /**
105- * Check if a string starts with any of the given substrings
104+ * Check if a string starts with a given substring
106105 *
107106 * @param iterable<string>|string $needles
108107 */
@@ -124,7 +123,7 @@ public static function startsWith(string $haystack, $needles, bool $ignoreCase =
124123 }
125124
126125 /**
127- * Check if a string ends with any of the given substrings
126+ * Check if a string ends with a given substring
128127 *
129128 * @param iterable<string>|string $needles
130129 */
@@ -369,7 +368,9 @@ public static function words(
369368 }
370369
371370 /**
372- * Expand tabs to spaces
371+ * Expand tabs in a string to spaces
372+ *
373+ * @param int $column The starting column (1-based) of `$text`.
373374 */
374375 public static function expandTabs (
375376 string $ text ,
@@ -379,7 +380,7 @@ public static function expandTabs(
379380 if (strpos ($ text , "\t" ) === false ) {
380381 return $ text ;
381382 }
382- $ eol = Get::eol ($ text ) ?: "\n" ;
383+ $ eol = Get::eol ($ text ) ?? "\n" ;
383384 $ expanded = '' ;
384385 foreach (explode ($ eol , $ text ) as $ i => $ line ) {
385386 !$ i || $ expanded .= $ eol ;
@@ -402,7 +403,11 @@ public static function expandTabs(
402403 }
403404
404405 /**
405- * Expand leading tabs to spaces
406+ * Expand leading tabs in a string to spaces
407+ *
408+ * @param bool $preserveLine1 If `true`, tabs in the first line of `$text`
409+ * are not expanded.
410+ * @param int $column The starting column (1-based) of `$text`.
406411 */
407412 public static function expandLeadingTabs (
408413 string $ text ,
@@ -413,7 +418,7 @@ public static function expandLeadingTabs(
413418 if (strpos ($ text , "\t" ) === false ) {
414419 return $ text ;
415420 }
416- $ eol = Get::eol ($ text ) ?: "\n" ;
421+ $ eol = Get::eol ($ text ) ?? "\n" ;
417422 $ softTab = str_repeat (' ' , $ tabSize );
418423 $ expanded = '' ;
419424 foreach (explode ($ eol , $ text ) as $ i => $ line ) {
@@ -432,7 +437,7 @@ public static function expandLeadingTabs(
432437 if (!$ parts ) {
433438 break ;
434439 }
435- if ($ part ) {
440+ if ($ part !== '' ) {
436441 $ expanded .= "\t" . implode ("\t" , $ parts );
437442 break ;
438443 }
0 commit comments