From ac6740f59f73a70635ac3a1e8b61d8041b58e19e Mon Sep 17 00:00:00 2001 From: "Barry vd. Heuvel" Date: Thu, 4 Jul 2013 14:26:17 +0200 Subject: [PATCH] Change aliasing way back Not really nice in NetBeans. Also reference the calling class and show the implementing class in comments (phpStorm will understand it anyways) --- .../LaravelIdeHelper/GeneratorCommand.php | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php index bba48ba..66a926e 100755 --- a/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php +++ b/src/Barryvdh/LaravelIdeHelper/GeneratorCommand.php @@ -314,29 +314,17 @@ exit('Only to be used as an helper for your IDE');\n\n"; $output .= "){\r\n"; //Only return when not a constructor and not void. - $return = ($returnValue && $returnValue !== "void" && $method->name !== "__construct") ? 'return ' : ''; + $return = ($returnValue && $returnValue !== "void" && $method->name !== "__construct") ? 'return' : ''; //Reference the 'real' function in the declaringclass $declaringClass = $method->getDeclaringClass(); - if($declaringClass->isAbstract()){ - $declaringClass = $class; + $root = $class->getName(); + + if($declaringClass->name != $root){ + $output .= "\t\t//Method inherited from $declaringClass->name\r\n"; } - $constructor = $declaringClass->getConstructor(); - $root = $declaringClass->getName(); - - - $output .= "\t\t\$root = new \\$root("; - if(!is_null($constructor)){ - $constructorParams = array(); - for($i=0;$i<$constructor->getNumberOfRequiredParameters();$i++){ - $constructorParams[] = 'null'; - } - $output .= implode($constructorParams, ','); - } - $output .= ");\n"; - - $output .= "\t\t$return\$root->"; + $output .= "\t\t$return $root::"; //Write the default parameters in the function call $output .= $method->name."(".implode($params, ", ").");\r\n";