← All changes
|
libraries/vendor/PhpSpreadsheet/Reader/Gnumeric/Styles.php
+15
-7
3.3.3
→
3.4
View file →
| @@ -17,10 +17,17 @@ | ||
| 17 | 17 | private Spreadsheet $spreadsheet; |
| 18 | 18 | |
| 19 | 19 | protected bool $readDataOnly; |
| 20 | 20 | |
| 21 | - /** @var array<string, string[]> */ | |
| 22 | - public static array $mappings = [ | |
| 21 | + /** | |
| 22 | + * @deprecated 5.10.0 No longer used, replaced by const which is not user-accessible. | |
| 23 | + * | |
| 24 | + * @var array<string[]> | |
| 25 | + */ | |
| 26 | + public static array $mappings = self::MAPPINGS; | |
| 27 | + | |
| 28 | + /** @internal */ | |
| 29 | + public const MAPPINGS = [ | |
| 23 | 30 | 'borderStyle' => [ |
| 24 | 31 | '0' => Border::BORDER_NONE, |
| 25 | 32 | '1' => Border::BORDER_THIN, |
| 26 | 33 | '2' => Border::BORDER_MEDIUM, |
| @@ -142,8 +149,9 @@ | ||
| 142 | 149 | private function addBorderStyle(SimpleXMLElement $srssb, array &$styleArray, string $direction): void |
| 143 | 150 | { |
| 144 | 151 | $ucDirection = ucfirst($direction); |
| 145 | 152 | if (isset($srssb->$ucDirection)) { |
| 153 | + // https://github.com/phpstan/phpstan/issues/14925 | |
| 146 | 154 | /** @var SimpleXMLElement */ |
| 147 | 155 | $temp = $srssb->$ucDirection; |
| 148 | 156 | $styleArray['borders'][$direction] = self::parseBorderAttributes($temp->attributes()); |
| 149 | 157 | } |
| @@ -159,13 +167,13 @@ | ||
| 159 | 167 | |
| 160 | 168 | return $rotation; |
| 161 | 169 | } |
| 162 | 170 | |
| 163 | - /** @param mixed[][] $styleArray */ | |
| 171 | + /** @param array<array<mixed>|string> $styleArray */ | |
| 164 | 172 | private static function addStyle(array &$styleArray, string $key, string $value): void |
| 165 | 173 | { |
| 166 | - if (array_key_exists($value, self::$mappings[$key])) { | |
| 167 | - $styleArray[$key] = self::$mappings[$key][$value]; //* @phpstan-ignore-line | |
| 174 | + if (array_key_exists($value, self::MAPPINGS[$key])) { | |
| 175 | + $styleArray[$key] = self::MAPPINGS[$key][$value]; | |
| 168 | 176 | } |
| 169 | 177 | } |
| 170 | 178 | |
| 171 | 179 | /** @param mixed[][] $styleArray */ |
| @@ -170,10 +178,10 @@ | ||
| 170 | 178 | |
| 171 | 179 | /** @param mixed[][] $styleArray */ |
| 172 | 180 | private static function addStyle2(array &$styleArray, string $key1, string $key, string $value): void |
| 173 | 181 | { |
| 174 | - if (array_key_exists($value, self::$mappings[$key])) { | |
| 175 | - $styleArray[$key1][$key] = self::$mappings[$key][$value]; | |
| 182 | + if (array_key_exists($value, self::MAPPINGS[$key])) { | |
| 183 | + $styleArray[$key1][$key] = self::MAPPINGS[$key][$value]; | |
| 176 | 184 | } |
| 177 | 185 | } |
| 178 | 186 | |
| 179 | 187 | /** @return mixed[][] */ |