ray / rector-ray
Rector 升级 Ray.Di 规则
1.1.0
2023-05-25 08:47 UTC
Requires
- php: >=8.0
- koriym/attributes: ^1.0
- ray/di: ^2.14
Requires (Dev)
- doctrine/coding-standard: ^12.0.0
- phpunit/phpunit: ^9.5
- rector/rector: ^0.16.0
- vimeo/psalm: ^4.29
This package is auto-updated.
Last update: 2024-08-30 04:51:08 UTC
README
这是针对 rector/rector 的 Ray.Di 规则。
安装
composer require ray/rector-ray --dev
规则
AnnotationBindingRector
此 Rector 将 PHPDoc 中的注解绑定转换为参数属性绑定。
🔧 配置它!
- class:
AnnotationBindingRector
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) { }