Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Macro.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
use Barryvdh\Reflection\DocBlock;
use Barryvdh\Reflection\DocBlock\Tag;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Support\Collection;

class Macro extends Method
{
protected $macroDefaults = [
\Illuminate\Http\Client\Factory::class => PendingRequest::class,
];

/**
* Macro constructor.
*
Expand Down Expand Up @@ -77,6 +82,12 @@ protected function initPhpDoc($method)

$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
Expand Down
Loading