ray/rector-ray

Rector upgrades rules for Ray.Di

Installs: 28 105

Dependents: 5

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

Type:rector-extension

1.1.0 2023-05-25 08:47 UTC

This package is auto-updated.

Last update: 2024-05-30 04:13:41 UTC


README

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