mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-28 07:39:55 +09:00
Fix #1553 downgrade symfony packages to 1.19, for compatibility with PHP 7.0
This commit is contained in:
parent
f4ad0dbb48
commit
790434ad32
43 changed files with 1465 additions and 965 deletions
|
|
@ -23,27 +23,28 @@ namespace Symfony\Polyfill\Intl\Normalizer;
|
|||
*/
|
||||
class Normalizer
|
||||
{
|
||||
public const FORM_D = \Normalizer::FORM_D;
|
||||
public const FORM_KD = \Normalizer::FORM_KD;
|
||||
public const FORM_C = \Normalizer::FORM_C;
|
||||
public const FORM_KC = \Normalizer::FORM_KC;
|
||||
public const NFD = \Normalizer::NFD;
|
||||
public const NFKD = \Normalizer::NFKD;
|
||||
public const NFC = \Normalizer::NFC;
|
||||
public const NFKC = \Normalizer::NFKC;
|
||||
const FORM_D = \Normalizer::FORM_D;
|
||||
const FORM_KD = \Normalizer::FORM_KD;
|
||||
const FORM_C = \Normalizer::FORM_C;
|
||||
const FORM_KC = \Normalizer::FORM_KC;
|
||||
const NFD = \Normalizer::NFD;
|
||||
const NFKD = \Normalizer::NFKD;
|
||||
const NFC = \Normalizer::NFC;
|
||||
const NFKC = \Normalizer::NFKC;
|
||||
|
||||
private static $C;
|
||||
private static $D;
|
||||
private static $KD;
|
||||
private static $cC;
|
||||
private static $ulenMask = ["\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4];
|
||||
private static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
|
||||
private static $ASCII = "\x20\x65\x69\x61\x73\x6E\x74\x72\x6F\x6C\x75\x64\x5D\x5B\x63\x6D\x70\x27\x0A\x67\x7C\x68\x76\x2E\x66\x62\x2C\x3A\x3D\x2D\x71\x31\x30\x43\x32\x2A\x79\x78\x29\x28\x4C\x39\x41\x53\x2F\x50\x22\x45\x6A\x4D\x49\x6B\x33\x3E\x35\x54\x3C\x44\x34\x7D\x42\x7B\x38\x46\x77\x52\x36\x37\x55\x47\x4E\x3B\x4A\x7A\x56\x23\x48\x4F\x57\x5F\x26\x21\x4B\x3F\x58\x51\x25\x59\x5C\x09\x5A\x2B\x7E\x5E\x24\x40\x60\x7F\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
|
||||
|
||||
public static function isNormalized(string $s, int $form = self::FORM_C)
|
||||
public static function isNormalized($s, $form = self::NFC)
|
||||
{
|
||||
if (!\in_array($form, [self::NFD, self::NFKD, self::NFC, self::NFKC])) {
|
||||
if (!\in_array($form, array(self::NFD, self::NFKD, self::NFC, self::NFKC))) {
|
||||
return false;
|
||||
}
|
||||
$s = (string) $s;
|
||||
if (!isset($s[strspn($s, self::$ASCII)])) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -54,8 +55,9 @@ class Normalizer
|
|||
return self::normalize($s, $form) === $s;
|
||||
}
|
||||
|
||||
public static function normalize(string $s, int $form = self::FORM_C)
|
||||
public static function normalize($s, $form = self::NFC)
|
||||
{
|
||||
$s = (string) $s;
|
||||
if (!preg_match('//u', $s)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -70,11 +72,7 @@ class Normalizer
|
|||
return $s;
|
||||
}
|
||||
|
||||
if (80000 > \PHP_VERSION_ID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
throw new \ValueError('normalizer_normalize(): Argument #2 ($form) must be a a valid normalization form');
|
||||
return false;
|
||||
}
|
||||
|
||||
if ('' === $s) {
|
||||
|
|
@ -154,7 +152,7 @@ class Normalizer
|
|||
|| $lastUcls) {
|
||||
// Table lookup and combining chars composition
|
||||
|
||||
$ucls = $combClass[$uchr] ?? 0;
|
||||
$ucls = isset($combClass[$uchr]) ? $combClass[$uchr] : 0;
|
||||
|
||||
if (isset($compMap[$lastUchr.$uchr]) && (!$lastUcls || $lastUcls < $ucls)) {
|
||||
$lastUchr = $compMap[$lastUchr.$uchr];
|
||||
|
|
@ -206,7 +204,7 @@ class Normalizer
|
|||
$compatMap = self::$KD;
|
||||
}
|
||||
|
||||
$c = [];
|
||||
$c = array();
|
||||
$i = 0;
|
||||
$len = \strlen($s);
|
||||
|
||||
|
|
@ -217,7 +215,7 @@ class Normalizer
|
|||
if ($c) {
|
||||
ksort($c);
|
||||
$result .= implode('', $c);
|
||||
$c = [];
|
||||
$c = array();
|
||||
}
|
||||
|
||||
$j = 1 + strspn($s, $ASCII, $i + 1);
|
||||
|
|
@ -233,7 +231,7 @@ class Normalizer
|
|||
if ($uchr < "\xEA\xB0\x80" || "\xED\x9E\xA3" < $uchr) {
|
||||
// Table lookup
|
||||
|
||||
if ($uchr !== $j = $compatMap[$uchr] ?? ($decompMap[$uchr] ?? $uchr)) {
|
||||
if ($uchr !== $j = isset($compatMap[$uchr]) ? $compatMap[$uchr] : (isset($decompMap[$uchr]) ? $decompMap[$uchr] : $uchr)) {
|
||||
$uchr = $j;
|
||||
|
||||
$j = \strlen($uchr);
|
||||
|
|
@ -285,7 +283,7 @@ class Normalizer
|
|||
if ($c) {
|
||||
ksort($c);
|
||||
$result .= implode('', $c);
|
||||
$c = [];
|
||||
$c = array();
|
||||
}
|
||||
|
||||
$result .= $uchr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue