ray-di / rector-ray

The rector rules for Ray.Di

Home Page:https://packagist.org/packages/ray/rector-ray

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rector Rules for Ray.Di

Continuous Integration

The rector/rector rules for Ray.Di.

Install

composer require ray/rector-ray --dev

Rules

AnnotationBindingRector

This Rector converts annotation bindings in PHPDoc into parameter attribute bindings.

🔧 configure it!

use PHPStan\Type\ObjectType;
use Rector\Arguments\Rector\ClassMethod\ArgumentAdderRector;
use Rector\Arguments\ValueObject\ArgumentAdder;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->ruleWithConfiguration(
        AnnotationBindingRector::class
    );
};

class SomeClass
{
    /**
-    * @Named("a=foo, b=bar")
     * @Foo
     */
-    public function __construct(int $a, int $b)
+    public function __construct(#[Named('foo')] int $a, #[Named('bar')] int $b)
    {
    }
-    /**
-     * @Foo("a")
-     */
-    public function __construct(int $a, int $b)
+    public function __construct(#[Foo] int $a, int $b)
    {
    }

See Also

About

The rector rules for Ray.Di

https://packagist.org/packages/ray/rector-ray

License:MIT License


Languages

Language:PHP 100.0%