如何在 PhpStorm 上批量生成 PHPDoc Facade Laravel

问题描述

我想在没有 ide_helper.PHP 的情况下在我的 Facade 类上批量生成 PHPDoc。如何生成它? 我试过 ide_helper.PHP 它适用于自动完成。但就我而言,我想将 PHPDoc 写入我的 Facade 类 然后在我的 Facade 类中会自动PHPDoc

从这里

<?PHP

namespace AshAllenDesign\LaravelExchangeRates\Facades;

use Carbon\Carbon;
use Illuminate\Support\Facades\Facade;

class ExchangeRate extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'exchange-rate';
    }
}

为此

<?PHP

namespace AshAllenDesign\LaravelExchangeRates\Facades;

use Carbon\Carbon;
use Illuminate\Support\Facades\Facade;

/**
 * @method static array currencies(array $currencies = [])
 * @method static string|array exchangeRate(string $from,$to,?Carbon $date = null)
 * @method static array exchangeRateBetweenDaterange(string $from,Carbon $date,Carbon $endDate,array $conversions = [])
 * @method static float|array convert(int $value,string $from,Carbon $date = null)
 * @method static array convertBetweenDaterange(int $value,array $conversions = [])
 * @method static self shouldBustCache(bool $bustCache = true)
 * @method static self shouldCache(bool $shouldCache = true)
 *
 * @see \AshAllenDesign\LaravelExchangeRates\Classes\ExchangeRate
 */
class ExchangeRate extends Facade
{
    protected static function getFacadeAccessor()
    {
        return 'exchange-rate';
    }
}

解决方法

我制作了自己的工具来为门面 Laravel 批量生成 PHPDocs,看看这个 https://gist.github.com/ardzz/473f8b994714370b917d6232ce5146f0