Search code examples
phplaravelphpstormlaravel-facade

How to mass generate PHPDoc Facade Laravel on PhpStorm


I want to mass generate PHPDoc on my Facade class without ide_helper.php. How to generate it? I've tried ide_helper.php it's work for autocomplete. But in my case I want write the PHPDoc into my Facade class Then in my Facade class will automatically written PHPDoc

From this

<?php

namespace AshAllenDesign\LaravelExchangeRates\Facades;

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

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

To this

<?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, $to, Carbon $date, Carbon $endDate, array $conversions = [])
 * @method static float|array convert(int $value, string $from, $to, Carbon $date = null)
 * @method static array convertBetweenDateRange(int $value, string $from, $to, Carbon $date, Carbon $endDate, 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';
    }
}

Solution

  • I made my own tool to mass generate PHPDocs for facade laravel, check this out https://gist.github.com/ardzz/473f8b994714370b917d6232ce5146f0