mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
Work on static references
Reference the child class (your actual model), instead of the base model, using static (same behaviour as $this).
This commit is contained in:
@@ -222,10 +222,11 @@ namespace {\n\tdie('Only to be used as an helper for your IDE');\n}\n\n";
|
|||||||
$output .="\t * @param\t".implode($annotation->values, "\t")."\n";
|
$output .="\t * @param\t".implode($annotation->values, "\t")."\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!$sublime && $root == 'Illuminate\Database\Eloquent\Model' &&
|
if(!$sublime and ($root == 'Illuminate\Database\Eloquent\Model' or $root == 'Illuminate\Database\Query\Builder') and
|
||||||
in_array($method->name, array('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')){
|
||||||
//Reference the calling class, to provide more accurate auto-complete
|
//Reference the calling class, to provide more accurate auto-complete
|
||||||
$output .= "\t * @return \$this\n";
|
$output .= "\t * @return static\n";
|
||||||
}else{
|
}else{
|
||||||
$output .= "\t * @return ".$returnValue."\n";
|
$output .= "\t * @return ".$returnValue."\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user