Created
January 29, 2024 13:50
-
-
Save Tjitse-E/b368670a80a2ab357e59acec02562fc9 to your computer and use it in GitHub Desktop.
Add missing dynamic properties using RectorPHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector; | |
use Rector\Config\RectorConfig; | |
return static function (RectorConfig $rectorConfig): void { | |
$rectorConfig->rule(CompleteDynamicPropertiesRector::class); | |
// Define directories to check | |
$directories = [ | |
__DIR__ . '/app/code', | |
__DIR__ . '/extensions' | |
]; | |
// Filter out directories that do not exist | |
$existingDirectories = array_filter($directories, function ($dir) { | |
return is_dir($dir); | |
}); | |
// Add existing directories to the configuration | |
$rectorConfig->paths($existingDirectories); | |
}; |
Also add to check for the PHP version you're upgrading to;
// PHP 8.2 upgrade
$rectorConfig->sets([Rector\Set\ValueObject\LevelSetList::UP_TO_PHP_82]);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Additions to also check template files;