mohammad-alavi/apiato-rector

A collection of Rectors for the Apiato meta-framework.

dev-latest 2025-04-07 10:03 UTC

This package is auto-updated.

Last update: 2025-04-07 10:03:53 UTC


README

tests status code coverage

Apiato Rector

A set of Rector rules to automatically upgrade your Apiato project to the latest version.

Installation

composer require --dev mohammad-alavi/apiato-rector dev-latest

Also ensure you have Rector itself installed:

composer require --dev rector/rector

Usage

php vendor/bin/rector

v12 to v13 Rules

TransformMethodToResponseFacadeRector

Converts $this->transform(...) calls to Response::create(...).

use MohammadAlavi\ApiatoRector\Rules\TransformMethodToResponseFacadeRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([
        __DIR__ . '/app',
        __DIR__ . '/config',
    ])
    ->withImportNames(true, false, false, true)
    ->withRules([
        TransformMethodToResponseFacadeRector::class,
    ]);

RefactorHttpExceptionRector

Refactor exception classes to the new HTTP exception signature.

use MohammadAlavi\ApiatoRector\Rules\RefactorHttpExceptionRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withPaths([
        __DIR__ . '/app',
        __DIR__ . '/config',
    ])
    ->withImportNames(true, false, false, true)
    ->withConfiguredRule(RefactorHttpExceptionRector::class, [
        'parent_class' => \App\Ship\Parents\Exceptions\HttpException::class,
    ]);