mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add default class for HttpClient macro
This commit is contained in:
@@ -5,10 +5,15 @@ namespace Barryvdh\LaravelIdeHelper;
|
|||||||
use Barryvdh\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
use Barryvdh\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Http\Client\PendingRequest;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class Macro extends Method
|
class Macro extends Method
|
||||||
{
|
{
|
||||||
|
protected $macroDefaults = [
|
||||||
|
\Illuminate\Http\Client\Factory::class => PendingRequest::class,
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macro constructor.
|
* Macro constructor.
|
||||||
*
|
*
|
||||||
@@ -77,6 +82,12 @@ class Macro extends Method
|
|||||||
|
|
||||||
$this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
|
$this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$class = ltrim($this->declaringClassName, "\\");
|
||||||
|
if (!$this->phpdoc->hasTag('return') && isset($this->macroDefaults[$class])) {
|
||||||
|
$type = $this->macroDefaults[$class];
|
||||||
|
$this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function concatReflectionTypes(?\ReflectionType $type): string
|
protected function concatReflectionTypes(?\ReflectionType $type): string
|
||||||
|
|||||||
Reference in New Issue
Block a user