mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
Make __construct return @self
This commit is contained in:
@@ -311,7 +311,9 @@ namespace {\n\tdie('Only to be used as an helper for your IDE');\n}\n\n";
|
|||||||
$tag = reset($returnTags);
|
$tag = reset($returnTags);
|
||||||
$returnValue = $tag->getType();
|
$returnValue = $tag->getType();
|
||||||
|
|
||||||
if(!$this->sublime and $alias == 'Eloquent' and
|
if($method->name == "__construct"){
|
||||||
|
$returnValue = 'self';
|
||||||
|
}elseif(!$this->sublime and $alias == 'Eloquent' and
|
||||||
(in_array($method->name, array('pluck', 'first', 'fill', 'newInstance', 'newFromBuilder', 'create', 'find', 'findOrFail'))
|
(in_array($method->name, array('pluck', 'first', 'fill', 'newInstance', 'newFromBuilder', 'create', 'find', 'findOrFail'))
|
||||||
or $returnValue === '\Illuminate\Database\Query\Builder')){
|
or $returnValue === '\Illuminate\Database\Query\Builder')){
|
||||||
//Reference the calling class, to provide more accurate auto-complete
|
//Reference the calling class, to provide more accurate auto-complete
|
||||||
@@ -353,7 +355,7 @@ namespace {\n\tdie('Only to be used as an helper for your IDE');\n}\n\n";
|
|||||||
$output .= implode($paramsWithDefault, ", ");
|
$output .= implode($paramsWithDefault, ", ");
|
||||||
$output .= "){\r\n";
|
$output .= "){\r\n";
|
||||||
|
|
||||||
$return = ($returnValue && $returnValue !== "void") ? 'return' : '';
|
$return = ($returnValue && $returnValue !== "void" && $method->name !== "__construct") ? 'return' : '';
|
||||||
|
|
||||||
if($this->sublime){
|
if($this->sublime){
|
||||||
$output .= "\t\t\$$rootParam = new $root();\r\n";
|
$output .= "\t\t\$$rootParam = new $root();\r\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user