承接 savinmikhail/annotate_throws_rector 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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 throw expressions 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/catch are not propagated
  • existing @throws tags are preserved and deduplicated
  • no removal of stale @throws tags 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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固