savinmikhail/add_named_arguments_rector

Rector rule to add names to arguments for functions'/methods' calls

v0.1.3 2025-01-19 05:09 UTC

This package is auto-updated.

Last update: 2025-01-19 05:10:10 UTC


README

In two words this feature doing this:

- (new DateTimeImmutable())->format('Y-m-d');
+ (new DateTimeImmutable())->format(format: 'Y-m-d');
  • Also for functions, static methods, constructors

It seems for me and my teammates that code with named arguments less prone to errors and more readable

I made this rule standalone, due to discussion

Installation

composer require --dev savinmikhail/add_named_arguments_rector

Usage

Add new rule to your rector.php config file like that:

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withRules([
        \SavinMikhail\AddNamedArgumentsRector\AddNamedArgumentsRector::class
    ]);