reinstall dependencies on php 7.4

This commit is contained in:
Attila Jozsef Kerekes
2022-11-14 21:15:40 +01:00
parent 8972a11c0a
commit 98401f20a2
681 changed files with 65697 additions and 9274 deletions

View File

@@ -54,8 +54,8 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
'zh' => 'Han-Latin',
];
private ?string $defaultLocale;
private \Closure|array $symbolsMap = [
private $defaultLocale;
private $symbolsMap = [
'en' => ['@' => 'at', '&' => 'and'],
];
@@ -64,10 +64,17 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
*
* @var \Transliterator[]
*/
private array $transliterators = [];
private $transliterators = [];
public function __construct(string $defaultLocale = null, array|\Closure $symbolsMap = null)
/**
* @param array|\Closure|null $symbolsMap
*/
public function __construct(string $defaultLocale = null, $symbolsMap = null)
{
if (null !== $symbolsMap && !\is_array($symbolsMap) && !$symbolsMap instanceof \Closure) {
throw new \TypeError(sprintf('Argument 2 passed to "%s()" must be array, Closure or null, "%s" given.', __METHOD__, \gettype($symbolsMap)));
}
$this->defaultLocale = $defaultLocale;
$this->symbolsMap = $symbolsMap ?? $this->symbolsMap;
}
@@ -75,7 +82,7 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
/**
* {@inheritdoc}
*/
public function setLocale(string $locale)
public function setLocale($locale)
{
$this->defaultLocale = $locale;
}
@@ -83,7 +90,7 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
/**
* {@inheritdoc}
*/
public function getLocale(): string
public function getLocale()
{
return $this->defaultLocale;
}
@@ -93,10 +100,10 @@ class AsciiSlugger implements SluggerInterface, LocaleAwareInterface
*/
public function slug(string $string, string $separator = '-', string $locale = null): AbstractUnicodeString
{
$locale ??= $this->defaultLocale;
$locale = $locale ?? $this->defaultLocale;
$transliterator = [];
if ($locale && ('de' === $locale || str_starts_with($locale, 'de_'))) {
if ($locale && ('de' === $locale || 0 === strpos($locale, 'de_'))) {
// Use the shortcut for German in UnicodeString::ascii() if possible (faster and no requirement on intl)
$transliterator = ['de-ASCII'];
} elseif (\function_exists('transliterator_transliterate') && $locale) {