invenso/rector
最新稳定版本:1.0.3
Composer 安装命令:
composer require invenso/rector
包简介
Invenso Rector Bundle to update API Platform Annotations to Attributes
README 文档
README
Invenso Rector can be used to convert Api Platform annotations to attributes
Since PHP version 8.0 annotations are replaced by using attributes
/** * @ApiResource */ class BookEntity { }
will be
#[ApiResource]
class BookEntity
{
}
Getting started
Requirement
- Api Platform must be installed
- Rector must be installed
Installation
Install the bundle by using composer
composer require invenso/rector
Configuration
The bundle can be configured by adding the configuration to the rector.php file
Add the following line to the rector file inside
$rectorConfig->sets([ ApiPlatformSetList::ANNOTATIONS_TO_ATTRIBUTES, ]);
Best practice is to have all ANNOTATIONS_TO_ATTRIBUTES converters present
$rectorConfig->sets([ DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES, DoctrineSetList::GEDMO_ANNOTATIONS_TO_ATTRIBUTES, ApiPlatformSetList::ANNOTATIONS_TO_ATTRIBUTES, SymfonySetList::ANNOTATIONS_TO_ATTRIBUTES, SensiolabsSetList::ANNOTATIONS_TO_ATTRIBUTES, ]);
Execute Rector
Rector can be run by using the command
vendor/bin/rector process src
To make it a bit easier you can also add the rector command inside the composer.json file
{
...
"scripts": {
"rector": "vendor/bin/rector"
}
}
Now you can run the following command to execute the rector script
composer rector process src
install with docker composer
docker run -ti -v ./:/app composer:latest composer install
PHP CS Fix
docker run -ti -v ./:/app composer:latest composer php-cs-fix
PHPstan
docker run -ti -v ./:/app composer:latest composer phpstan
Find deprecations
docker run -ti -v ./:/app composer:latest composer outdated
统计信息
- 总下载量: 95.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2023-11-15