mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Tweak behavior for some classes
Just extend the Seeder class, because it isn't called static (Fixes Issue #3)
This commit is contained in:
@@ -35,6 +35,7 @@ class GeneratorCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$replace = \Config::get('laravel-ide-helper::replace');
|
$replace = \Config::get('laravel-ide-helper::replace');
|
||||||
|
$onlyExtend = \Config::get('laravel-ide-helper::only_extend');
|
||||||
$aliases = \Config::get('app.aliases');
|
$aliases = \Config::get('app.aliases');
|
||||||
|
|
||||||
if( $this->option('helpers') || (\Config::get('laravel-ide-helper::include_helpers') && ! $this->option('nohelpers'))){
|
if( $this->option('helpers') || (\Config::get('laravel-ide-helper::include_helpers') && ! $this->option('nohelpers'))){
|
||||||
@@ -45,7 +46,7 @@ class GeneratorCommand extends Command {
|
|||||||
|
|
||||||
$sublime = $this->option('sublime') || \Config::get('laravel-ide-helper::sublime');
|
$sublime = $this->option('sublime') || \Config::get('laravel-ide-helper::sublime');
|
||||||
|
|
||||||
$content = $this->generateDocs($aliases, $replace, $helpers, $sublime);
|
$content = $this->generateDocs($aliases, $replace, $onlyExtend, $helpers, $sublime);
|
||||||
|
|
||||||
$written = \File::put($filename, $content);
|
$written = \File::put($filename, $content);
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ class GeneratorCommand extends Command {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateDocs($aliases, $replace, $helpers = array(), $sublime = false){
|
protected function generateDocs($aliases, $replace, $onlyExtend = array(), $helpers = array(), $sublime = false){
|
||||||
$d = new Parser();
|
$d = new Parser();
|
||||||
$d->setAllowInherited(true);
|
$d->setAllowInherited(true);
|
||||||
$d->setMethodFilter(\ReflectionMethod::IS_PUBLIC);
|
$d->setMethodFilter(\ReflectionMethod::IS_PUBLIC);
|
||||||
@@ -140,18 +141,22 @@ class GeneratorCommand extends Command {
|
|||||||
$output .= " class $alias extends \\$root{\n";
|
$output .= " class $alias extends \\$root{\n";
|
||||||
}else{
|
}else{
|
||||||
//If the root class is not the same as the facade extend it.
|
//If the root class is not the same as the facade extend it.
|
||||||
if($root !== $facade){
|
if($root !== $facade || in_array($alias, $onlyExtend)){
|
||||||
$output .= " class $alias extends $facade{\n";
|
$output .= " class $alias extends $facade{\n";
|
||||||
}else{
|
}else{
|
||||||
$output .= " class $alias{\n";
|
$output .= " class $alias{\n";
|
||||||
}
|
}
|
||||||
$output .= "\t/**\n\t * @var \\$root \$root\n\t */\n\t static private \$root;\n\n";
|
$output .= "\t/**\n\t * @var \\$root \$root\n\t */\n\t static private \$root;\n\n";
|
||||||
}
|
}
|
||||||
$methods = $d->getMethods();
|
|
||||||
|
|
||||||
foreach ($methods as $method)
|
if(!in_array($alias, $onlyExtend) || $sublime)
|
||||||
{
|
{
|
||||||
$output .= $this->parseMethod($method, $sublime);
|
$methods = $d->getMethods();
|
||||||
|
|
||||||
|
foreach ($methods as $method)
|
||||||
|
{
|
||||||
|
$output .= $this->parseMethod($method, $sublime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$output .= " }\n}\n\n";
|
$output .= " }\n}\n\n";
|
||||||
|
|
||||||
|
|||||||
@@ -58,4 +58,17 @@ return array(
|
|||||||
'Illuminate\Redis\RedisManager' => 'Illuminate\Redis\Database',
|
'Illuminate\Redis\RedisManager' => 'Illuminate\Redis\Database',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Only extend
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| These implementations aren't called static, so only extend them.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'only_extend' => array(
|
||||||
|
'Seeder',
|
||||||
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user