<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\SetList;
use Rector\TypeDeclaration\Rector\ClassMethod\AddVoidReturnTypeWhereNoReturnRector;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->paths([
        __DIR__ . '/Articles',
        __DIR__ . '/Server',
        __DIR__ . '/Web',
    ]);

    // Uncomment and set this to your target PHP version
    $rectorConfig->phpVersion(80100); // for PHP 8, this might be 80000 for 8.0

    // Include sets of rules for PHP version upgrades
    // For upgrading to PHP 8.0
    $rectorConfig->sets([
        SetList::PHP_80,
    ]);

    // Optionally, include PHP 7.x sets if upgrading from PHP 5
    $rectorConfig->sets([
        SetList::PHP_70,
        SetList::PHP_71,
        SetList::PHP_72,
        SetList::PHP_73,
        SetList::PHP_74,
        SetList::PHP_80, // Ensure this is the last to apply PHP 8 changes
    ]);

    // Custom rules (you can keep this if you need specific rules like the one below)
    $rectorConfig->rules([
        AddVoidReturnTypeWhereNoReturnRector::class,
    ]);

    // Uncomment and adjust to your current PHP version
    // This helps Rector make decisions based on your starting PHP version.
    // $rectorConfig->phpVersion(70400); // Example for PHP 7.4
};