Files
piratepoet/prefixer/fix-symfony-polyfill.php
Rostislav Wolny 2a60ca3a13 Remove unused polyfills
[MAILPOET-3658]
2021-07-06 13:29:00 +02:00

29 lines
1.3 KiB
PHP

<?php
// throw exception if anything fails
set_error_handler(function ($severity, $message, $file, $line) {
throw new ErrorException($message, 0, $severity, $file, $line);
});
$file = __DIR__ . '/../vendor-prefixed/symfony/polyfill-intl-idn/Idn.php';
$data = file_get_contents($file);
$data = str_replace('\\Normalizer::', '\\MailPoetVendor\\Normalizer::', $data);
$data = str_replace('use Normalizer;', 'use MailPoetVendor\\Normalizer;', $data);
file_put_contents($file, $data);
$file = __DIR__ . '/../vendor-prefixed/symfony/polyfill-intl-normalizer/Normalizer.php';
$data = file_get_contents($file);
$data = str_replace('\\Normalizer::', '\\MailPoetVendor\\Normalizer::', $data);
$data = str_replace('\'Normalizer::', '\'\\MailPoetVendor\\Normalizer::', $data); // for use in strings like defined('...')
file_put_contents($file, $data);
$file = __DIR__ . '/../vendor-prefixed/symfony/polyfill-iconv/Iconv.php';
$data = file_get_contents($file);
$data = str_replace('\\Normalizer::', '\\MailPoetVendor\\Normalizer::', $data);
file_put_contents($file, $data);
// Remove unnecessary polyfills these polyfills are required by symfony/console
// but don't use and remove the package
exec('rm -r ' . __DIR__ . '/../vendor-prefixed/symfony/polyfill-php73');
exec('rm -r ' . __DIR__ . '/../vendor-prefixed/symfony/polyfill-php80');