savinmikhail/annotate_throws_rector
Composer 安装命令:
composer require --dev savinmikhail/annotate_throws_rector
包简介
Rector rule to add missing @throws tags for direct throws and inter-class propagation
关键字:
README 文档
README
Rector extension that adds missing @throws tags for:
- direct
throwexpressions in class methods - propagation through same-class calls like
$this->foo(),self::foo(),static::foo() - propagation through inter-class calls when the callee already has
@throws
Current MVP scope:
- class methods only
- inter-class propagation relies on existing callee docblocks
- repeated Rector runs can gradually converge the call graph across files
- caught exceptions inside
try/catchare not propagated - existing
@throwstags are preserved and deduplicated - no removal of stale
@throwstags yet
Install
composer require --dev savinmikhail/annotate_throws_rector
Configure
<?php declare(strict_types=1); use Rector\Config\RectorConfig; use SavinMikhail\AnnotateThrowsRector\AnnotateThrowsRector; return RectorConfig::configure() ->withRules([ AnnotateThrowsRector::class, ]);
Example
final class InterviewRunner { public function process(): void { $this->normalize(); } public function normalize(): void { throw new \RuntimeException('Boom'); } }
becomes
final class InterviewRunner { /** * @throws \RuntimeException */ public function process(): void { $this->normalize(); } /** * @throws \RuntimeException */ public function normalize(): void { throw new \RuntimeException('Boom'); } }
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-06-20