Open szepeviktor opened 3 years ago
Hmm, do you know any WP plugin which is using this?
It looks interesting!
I'm not in the WordPress business, just playing with PHP technologies. Do you think it will somehow fail?
https://github.com/rectorphp/rector/issues?q=WordPress 🖱️
<?php
use Rector\Core\Configuration\Option;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::SETS, [
SetList::DOWNGRADE_PHP74,
SetList::DOWNGRADE_PHP73,
SetList::DOWNGRADE_PHP72,
SetList::DOWNGRADE_PHP71,
SetList::DOWNGRADE_PHP70,
SetList::DOWNGRADE_PHP56,
]);
};
WordPress is very specific and bloated, looking at all the problems with ie with PHPUnit I wouldn't be surprised if it fail miserably. I will take a closer look at this package and its usage with WP though
You can audit the changes.
Tests must be written for PHPUnit running on PHP 5.6. -> https://github.com/rectorphp/rector/blob/master/packages/set/src/ValueObject/SetList.php#L399-L467
Hmm, do you know any WP plugin which is using this?
Found one: https://github.com/leoloso/PoP/blob/master/rector-downgrade-code.php
Hmm, do you know any WP plugin which is using this?
Found one: https://github.com/leoloso/PoP/blob/master/rector-downgrade-code.php Another one: https://github.com/szepeviktor/phpstan-higher-order-collections/blob/master/rector.php
These are not Wordpress plugins.
Also, seems like support of autoload and includes (WordPress beloved stuffs) is still a work in progress https://github.com/rectorphp/rector/issues/4330.
I think using Composer autoloader (not the tool!) in a WordPress plugin is okay. Please see Yoast SEO for example. So Rector won't have to rectify that. Composer autoloader is PHP 5.3+ compatible.
This is how I try to break away from WordPress legacy technologies. Theory https://github.com/szepeviktor/small-project/blob/master/MAIN-FILE-PARTS.md In practice https://github.com/meilisearch/meilisearch-wordpress/pull/20
We're good with Composer itself because all its loaders are backward compatible. There are problems with a few things:
I'm looking into using the Rector within this project and I'd like to find out if all the packages processed by Imposter can be rectified to older PHP versions.
Highly interesting topic 👀
Time traveling 101!
Public testing with Rectorizer 🤖 https://github.com/szepeviktor/rectorize/actions/runs/588606017
Wow, this truly seems to work!
Problem
We want to write PHP 7.4/8.0 code but users run PHP 5.6
Solution
Use Rector in the release process!
Alternatives you've considered
Sleep.