laravel-ide-helper
laravel-ide-helper copied to clipboard
Can not generate `Carbon::macro` PHPDocs
Versions:
- ide-helper Version:
2.9.0
- Laravel Version:
8.29.0
- PHP Version:
7.4
Description:
Can not generate Carbon::macro
PHPDocs.
Steps To Reproduce:
- Set Carbon macro
use Illuminate\Support\Carbon;
// in AppServiceProvider.php
public function boot()
{
Carbon::macro('sayHello', function () : string {
return 'hello';
});
}
-
Regenerate PHPDocs run
php artisan ide-helper:generate
-
Not found
Carbon::sayHello
in_ide_helper.php
Same here:
Versions
- ide-helper Version: 2.8.1
- Laravel Version: 6.18.40
- PHP Version: 7.4
// app/Providers/CarbonServiceProvider.php
use Illuminate\Support\Carbon;
use Illuminate\Support\ServiceProvider;
class CarbonServiceProvider extends ServiceProvider
{
...
public function boot()
{
Carbon::macro('startOfLatest15Min', static function () {
$minutes = floor(self::this()->minute / 15) * 15;
return self::this()->startOfHour()->minutes($minutes);
});
}
}
// config/app.php
return [
'providers' => [
App\Providers\CarbonServiceProvider::class,
...
],
];
Can't find Carbon::startOfLatest15Min
in _ide_helper.php
Any news on this?
Just coming here to report the same thing.
What makes the Carbon Macros so different from other macros that DO get parsed by the ide-helper?
@jonnywilliamson the ide helper checks that the macros are for classes that have the Illuminate\Support\Traits\Macroable
trait.
https://github.com/barryvdh/laravel-ide-helper/blob/3ba1e2573b38f72107b8aacc4ee177fcab30a550/src/Generator.php#L298-L303