Use return $this for some Eloquent

So autocomplete uses the real model, not just the base Model. (Doesn't
seem to work on Sublime)
This commit is contained in:
Barry vd. Heuvel
2013-04-29 16:21:57 +02:00
parent e47f15c9fa
commit 9410f00cb5
@@ -222,7 +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($returnValue !== "void"){ if(!$sublime && $root == 'Illuminate\Database\Eloquent\Model' &&
in_array($method->name, array('fill', 'newInstance', 'newFromBuilder', 'create', 'find', 'findOrFail'))){
//Reference the calling class, to provide more accurate auto-complete
$output .= "\t * @return \$this\n";
}else{
$output .= "\t * @return ".$returnValue."\n"; $output .= "\t * @return ".$returnValue."\n";
} }
$output .= "\t */\n\t public static function ".$method->name."("; $output .= "\t */\n\t public static function ".$method->name."(";