Fix gregwar/captcha PHP 8.2 deprecation notices
[MAILPOET-4874]
This commit is contained in:
committed by
Aschepikov
parent
310d689219
commit
a11a462eee
@@ -77,12 +77,14 @@
|
||||
"post-update-cmd": [
|
||||
"./tools/vendor/composer.phar --working-dir=tasks/code_sniffer install",
|
||||
"./tools/vendor/composer.phar --working-dir=tasks/phpstan install",
|
||||
"php ./tasks/fix-guzzle.php"
|
||||
"php ./tasks/fix-guzzle.php",
|
||||
"php ./tasks/fix-php82-deprecations.php"
|
||||
],
|
||||
"post-install-cmd": [
|
||||
"./tools/vendor/composer.phar --working-dir=tasks/code_sniffer install",
|
||||
"./tools/vendor/composer.phar --working-dir=tasks/phpstan install",
|
||||
"php ./tasks/fix-guzzle.php"
|
||||
"php ./tasks/fix-guzzle.php",
|
||||
"php ./tasks/fix-php82-deprecations.php"
|
||||
],
|
||||
"pre-autoload-dump": [
|
||||
"php ./tasks/fix-codeception-stub.php",
|
||||
|
28
mailpoet/tasks/fix-php82-deprecations.php
Normal file
28
mailpoet/tasks/fix-php82-deprecations.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
|
||||
|
||||
// throw exception if anything fails
|
||||
set_error_handler(function ($severity, $message, $file, $line) {
|
||||
throw new ErrorException($message, 0, $severity, $file, $line);
|
||||
});
|
||||
|
||||
// Fixes for PHP8.2 Compatibility
|
||||
|
||||
// Production packages
|
||||
$replacements = [
|
||||
[
|
||||
'file' => __DIR__ . '/../vendor-prefixed/gregwar/captcha/src/Gregwar/Captcha/CaptchaBuilder.php',
|
||||
'find' => [
|
||||
'protected $backgroundColor = null;' . "\n" . ' /**',
|
||||
],
|
||||
'replace' => [
|
||||
'protected $backgroundColor = null;' . PHP_EOL . ' protected $background = null;' . PHP_EOL . ' /**',
|
||||
],
|
||||
],
|
||||
];
|
||||
|
||||
// Apply replacements
|
||||
foreach ($replacements as $singleFile) {
|
||||
$data = file_get_contents($singleFile['file']);
|
||||
$data = str_replace($singleFile['find'], $singleFile['replace'], $data);
|
||||
file_put_contents($singleFile['file'], $data);
|
||||
}
|
Reference in New Issue
Block a user