Skip to content

Commit 999d30e

Browse files
committed
Downgrade code to PHP 8.1 for wordpress.org
The wordpress.org subversion pre-commit hook is running PHP 8.1 and doesn't understand PHP 8.2 syntax. I don't want to be stuck on outdated (and possibly insecure) libraries, so we run rector to downgrade code to PHP 8.1 just for wordpress.org. This doesn't really guarantee PHP 8.1 compatibility, and we don't test that, so retain the minimum 8.2 requirement. This is purely to pass the wordpress.org pre-commit hook. Downgrading the entire vendor dir is very slow, but it is what it is.
1 parent 428eaf1 commit 999d30e

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
staticDeployWpOrgSrc = buildStaticDeploySrc "${releaseExtras}/release/wp-org/constants.php" ''
9898
composer remove yahnis-elsts/plugin-update-checker --minimal-changes --no-cache
9999
sed -i '/^use YahnisElsts\\PluginUpdateChecker/d' src/WordPressAdmin.php
100+
just rector -c rector-downgrade.php
100101
'';
101102
staticDeployGitHubSrc = buildStaticDeploySrc "${releaseExtras}/release/github/constants.php" "";
102103
pluginZip =

rector-downgrade.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php declare(strict_types=1);
2+
3+
use Rector\Config\RectorConfig;
4+
5+
return RectorConfig::configure()
6+
->withPaths(
7+
[
8+
__DIR__ . '/src',
9+
__DIR__ . '/vendor',
10+
__DIR__ . '/views',
11+
]
12+
)
13+
->withRootFiles() // Include staticweb-deploy.php and uninstall.php
14+
->withDowngradeSets( php81: true );

0 commit comments

Comments
 (0)