Skip to content

Modernise code#156

Draft
mrliptontea wants to merge 19 commits intomasterfrom
PLT-951-modernise-code
Draft

Modernise code#156
mrliptontea wants to merge 19 commits intomasterfrom
PLT-951-modernise-code

Conversation

@mrliptontea
Copy link
Member

  • Precursor to PLT-951

  • Modernise codebase with Rector

    • Strict types where possible
    • PHP 7.3 features
    • Resolve todo: use ObjectId->getTimestamp()
Used rector.php
<?php

declare(strict_types=1);

use Rector\CodingStyle\Rector\Catch_\CatchExceptionNameMatchingTypeRector;
use Rector\CodingStyle\Rector\PostInc\PostIncDecToPreIncDecRector;
use Rector\Config\RectorConfig;
use Rector\Naming\Rector\Assign\RenameVariableToMatchMethodCallReturnTypeRector;
use Rector\Naming\Rector\ClassMethod\RenameParamToMatchTypeRector;
use Rector\Naming\Rector\ClassMethod\RenameVariableToMatchNewTypeRector;
use Rector\Naming\Rector\Foreach_\RenameForeachValueVariableToMatchExprVariableRector;
use Rector\Privatization\Rector\Class_\FinalizeTestCaseClassRector;

return RectorConfig::configure()
    ->withPaths([
        __DIR__ . '/scripts',
        __DIR__ . '/src',
        __DIR__ . '/test',
    ])
    ->withBootstrapFiles([
        __DIR__ . '/src/tripod.inc.php',
    ])
    ->withPhpSets(php73: true)
    ->withPreparedSets(
        deadCode: true,
        codeQuality: true,
        codingStyle: true,
        typeDeclarations: true,
        typeDeclarationDocblocks: true,
        privatization: true,
        naming: true,
        instanceOf: true,
        earlyReturn: true,
        rectorPreset: true,
        phpunitCodeQuality: true,
    )
    ->withSkip([
        CatchExceptionNameMatchingTypeRector::class,
        FinalizeTestCaseClassRector::class,
        PostIncDecToPreIncDecRector::class,
        RenameForeachValueVariableToMatchExprVariableRector::class,
        RenameParamToMatchTypeRector::class,
        RenameVariableToMatchMethodCallReturnTypeRector::class,
        RenameVariableToMatchNewTypeRector::class,
    ])
;

@mrliptontea mrliptontea force-pushed the PLT-951-modernise-code branch 4 times, most recently from 8589f63 to 487a541 Compare March 2, 2026 22:12
@mrliptontea mrliptontea force-pushed the PLT-951-modernise-code branch 2 times, most recently from daa6771 to adec782 Compare March 3, 2026 14:53
@mrliptontea mrliptontea force-pushed the PLT-951-modernise-code branch from adec782 to fdee7bc Compare March 3, 2026 22:31
@mrliptontea mrliptontea force-pushed the PLT-951-modernise-code branch from fdee7bc to a1fa945 Compare March 5, 2026 14:59
@mrliptontea mrliptontea force-pushed the PLT-951-modernise-code branch from a1fa945 to 6a0ca80 Compare March 5, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant