mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Replace facades instead of aliases
More logical, because aliases are auto-detected. This way, the original facade is also kept.
This commit is contained in:
@@ -25,7 +25,7 @@ If you use SublimeText CodeIntel, the format is a bit different. So add --sublim
|
|||||||
|
|
||||||
php artisan ide-helper:generate -S
|
php artisan ide-helper:generate -S
|
||||||
|
|
||||||
You can also publish the config-file to add extra facades (ie. for bundles) or set defaults for --helpers or --sublime.
|
You can also publish the config-file to change implementations (ie. interface to specific class) or set defaults for --helpers or --sublime.
|
||||||
|
|
||||||
php artisan config:publish barryvdh/laravel-ide-helper
|
php artisan config:publish barryvdh/laravel-ide-helper
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ class GeneratorCommand extends Command {
|
|||||||
$this->useMemoryDriver();
|
$this->useMemoryDriver();
|
||||||
}
|
}
|
||||||
|
|
||||||
$aliases = \Config::get('laravel-ide-helper::aliases');
|
$replace = \Config::get('laravel-ide-helper::replace');
|
||||||
$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'))){
|
||||||
$helpers = \Config::get('laravel-ide-helper::helper_files');
|
$helpers = \Config::get('laravel-ide-helper::helper_files');
|
||||||
@@ -45,7 +45,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, $helpers, $sublime);
|
$content = $this->generateDocs($aliases, $replace, $helpers, $sublime);
|
||||||
|
|
||||||
$written = \File::put($filename, $content);
|
$written = \File::put($filename, $content);
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class GeneratorCommand extends Command {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function generateDocs($aliases, $helpers = array(), $sublime = false){
|
protected function generateDocs($aliases, $replace, $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);
|
||||||
@@ -107,6 +107,11 @@ class GeneratorCommand extends Command {
|
|||||||
}else{
|
}else{
|
||||||
$root = $facade;
|
$root = $facade;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(in_array($root, $replace)){
|
||||||
|
$root = $replace[$root];
|
||||||
|
}
|
||||||
|
|
||||||
if(!class_exists($root) && !interface_exists($root)){
|
if(!class_exists($root) && !interface_exists($root)){
|
||||||
$this->error("Class $root is not found.");
|
$this->error("Class $root is not found.");
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -43,19 +43,19 @@ return array(
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Custom Facades
|
| Replaced classes (Managers)
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| These facades cannot be found directly, because of a Manager class.
|
| These implementations cannot be found directly, because of a Manager class.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'aliases' => array(
|
'replace' => array(
|
||||||
'Auth' => 'Illuminate\Auth\Guard',
|
'Illuminate\Auth\AuthManager' => 'Illuminate\Auth\Guard',
|
||||||
'Cache' => 'Illuminate\Cache\StoreInterface',
|
'Illuminate\Cache\CacheManager' => 'Illuminate\Cache\StoreInterface',
|
||||||
'DB' => 'Illuminate\Database\Connection',
|
'Illuminate\Database\DatabaseManager' => 'Illuminate\Database\Connection',
|
||||||
'Queue' => 'Illuminate\Queue\QueueInterface',
|
'Illuminate\Queue\QueueManager' => 'Illuminate\Queue\QueueInterface',
|
||||||
'Redis' => 'Illuminate\Redis\Database',
|
'Illuminate\Redis\RedisManager' => 'Illuminate\Redis\Database',
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user