diff --git a/mailpoet/composer.json b/mailpoet/composer.json index 276d302d09..aaffe4913a 100644 --- a/mailpoet/composer.json +++ b/mailpoet/composer.json @@ -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", diff --git a/mailpoet/tasks/fix-php82-deprecations.php b/mailpoet/tasks/fix-php82-deprecations.php new file mode 100644 index 0000000000..5fda76ccbe --- /dev/null +++ b/mailpoet/tasks/fix-php82-deprecations.php @@ -0,0 +1,28 @@ + __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); +}