Skip to content

Commit 37bade5

Browse files
Merge branch '5.1' into 5.2
* 5.1: Changed private static array-properties to const
2 parents b817c88 + a3ef378 commit 37bade5

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Encoder/QpEncoder.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class QpEncoder implements EncoderInterface
2121
/**
2222
* Pre-computed QP for HUGE optimization.
2323
*/
24-
private static $qpMap = [
24+
private const QP_MAP = [
2525
0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',
2626
5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',
2727
10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',
@@ -170,7 +170,7 @@ private function encodeByteSequence(array $bytes, int &$size): string
170170
$ret .= $this->safeMap[$b];
171171
++$size;
172172
} else {
173-
$ret .= self::$qpMap[$b];
173+
$ret .= self::QP_MAP[$b];
174174
$size += 3;
175175
}
176176
}
@@ -187,7 +187,7 @@ private function standardize(string $string): string
187187
switch ($end = \ord(substr($string, -1))) {
188188
case 0x09:
189189
case 0x20:
190-
$string = substr_replace($string, self::$qpMap[$end], -1);
190+
$string = substr_replace($string, self::QP_MAP[$end], -1);
191191
}
192192

193193
return $string;

MimeTypes.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function getExtensions(string $mimeType): array
8787
$extensions = $this->extensions[$mimeType] ?? $this->extensions[$lcMimeType = strtolower($mimeType)] ?? null;
8888
}
8989

90-
return $extensions ?? self::$map[$mimeType] ?? self::$map[$lcMimeType ?? strtolower($mimeType)] ?? [];
90+
return $extensions ?? self::MAP[$mimeType] ?? self::MAP[$lcMimeType ?? strtolower($mimeType)] ?? [];
9191
}
9292

9393
/**
@@ -99,7 +99,7 @@ public function getMimeTypes(string $ext): array
9999
$mimeTypes = $this->mimeTypes[$ext] ?? $this->mimeTypes[$lcExt = strtolower($ext)] ?? null;
100100
}
101101

102-
return $mimeTypes ?? self::$reverseMap[$ext] ?? self::$reverseMap[$lcExt ?? strtolower($ext)] ?? [];
102+
return $mimeTypes ?? self::REVERSE_MAP[$ext] ?? self::REVERSE_MAP[$lcExt ?? strtolower($ext)] ?? [];
103103
}
104104

105105
/**
@@ -150,7 +150,7 @@ public function guessMimeType(string $path): ?string
150150
*
151151
* @see Resources/bin/update_mime_types.php
152152
*/
153-
private static $map = [
153+
private const MAP = [
154154
'application/acrobat' => ['pdf'],
155155
'application/andrew-inset' => ['ez'],
156156
'application/annodex' => ['anx'],
@@ -1742,7 +1742,7 @@ public function guessMimeType(string $path): ?string
17421742
'zz-application/zz-winassoc-xls' => ['xls', 'xlc', 'xll', 'xlm', 'xlw', 'xla', 'xlt', 'xld'],
17431743
];
17441744

1745-
private static $reverseMap = [
1745+
private const REVERSE_MAP = [
17461746
'1km' => ['application/vnd.1000minds.decision-model+xml'],
17471747
'32x' => ['application/x-genesis-32x-rom'],
17481748
'3dml' => ['text/vnd.in3d.3dml'],

0 commit comments

Comments
 (0)