← All changes
|
libraries/vendor/PhpSpreadsheet/Shared/StringHelper.php
+20
-3
3.3.4
→
3.4
View file →
| @@ -788,19 +788,36 @@ | ||
| 788 | 788 | /** |
| 789 | 789 | * Php introduced str_increment with Php8.3, |
| 790 | 790 | * but didn't issue deprecation notices till 8.5. |
| 791 | 791 | * |
| 792 | + * @param-out string $str | |
| 793 | + * | |
| 792 | 794 | * @codeCoverageIgnore |
| 793 | 795 | */ |
| 794 | 796 | public static function stringIncrement(string &$str): string |
| 795 | 797 | { |
| 796 | 798 | if (function_exists('str_increment')) { |
| 797 | - $str = str_increment($str); // @phpstan-ignore-line | |
| 799 | + /** @var non-empty-string $str */ | |
| 800 | + $str2 = str_increment($str); | |
| 798 | 801 | } else { |
| 799 | - ++$str; // @phpstan-ignore-line | |
| 802 | + $str1 = $str; | |
| 803 | + /** | |
| 804 | + * This is an outright lie, but I don't know how else to satisfy Phpstan for Php8.5+. | |
| 805 | + * | |
| 806 | + * @var numeric-string $str1 | |
| 807 | + */ | |
| 808 | + ++$str1; | |
| 809 | + $str2 = "$str1"; | |
| 800 | 810 | } |
| 801 | 811 | |
| 802 | - return $str; // @phpstan-ignore-line | |
| 812 | + /** | |
| 813 | + * This is demonstrably the case. I don't know why Phpstan thinks $str2 is mixed at this point. | |
| 814 | + * | |
| 815 | + * @var string $str2 set above by str_increment or ="..." | |
| 816 | + */ | |
| 817 | + $str = $str2; | |
| 818 | + | |
| 819 | + return $str; | |
| 803 | 820 | } |
| 804 | 821 | |
| 805 | 822 | /** @internal */ |
| 806 | 823 | protected static string $testClass = IntlCalendar::class; |