mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add phpstorm meta hints
This commit is contained in:
@@ -65,4 +65,12 @@ namespace PHPSTORM_META {
|
|||||||
override(\tap(0), type(0));
|
override(\tap(0), type(0));
|
||||||
override(\optional(0), type(0));
|
override(\optional(0), type(0));
|
||||||
|
|
||||||
|
<?php if (isset($expectedArguments)) : ?>
|
||||||
|
<?php foreach ($expectedArguments as $function => $arguments) : ?>
|
||||||
|
<?php foreach ($arguments as $index => $argumentList) : ?>
|
||||||
|
expectedArguments(\<?= $function ?>(), <?= $index ?>,<?php foreach ($argumentList as $i => $arg) : ?><?php if($i % 10 == 0) { echo "\n"; } ?><?= var_export($arg, true); ?>,<?php endforeach; ?>
|
||||||
|
);
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-15
@@ -51,17 +51,17 @@ class MetaCommand extends Command
|
|||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
protected $methods = [
|
protected $methods = [
|
||||||
'new \Illuminate\Contracts\Container\Container',
|
'new \Illuminate\Contracts\Container\Container',
|
||||||
'\Illuminate\Container\Container::makeWith(0)',
|
'\Illuminate\Container\Container::makeWith(0)',
|
||||||
'\Illuminate\Contracts\Container\Container::get(0)',
|
'\Illuminate\Contracts\Container\Container::get(0)',
|
||||||
'\Illuminate\Contracts\Container\Container::make(0)',
|
'\Illuminate\Contracts\Container\Container::make(0)',
|
||||||
'\Illuminate\Contracts\Container\Container::makeWith(0)',
|
'\Illuminate\Contracts\Container\Container::makeWith(0)',
|
||||||
'\App::get(0)',
|
'\App::get(0)',
|
||||||
'\App::make(0)',
|
'\App::make(0)',
|
||||||
'\App::makeWith(0)',
|
'\App::makeWith(0)',
|
||||||
'\app(0)',
|
'\app(0)',
|
||||||
'\resolve(0)',
|
'\resolve(0)',
|
||||||
'\Psr\Container\ContainerInterface::get(0)',
|
'\Psr\Container\ContainerInterface::get(0)',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +108,7 @@ class MetaCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$reflectionClass = new \ReflectionClass($concrete);
|
$reflectionClass = new \ReflectionClass($concrete);
|
||||||
if (is_object($concrete) && !$reflectionClass->isAnonymous()) {
|
if (is_object($concrete) && !$reflectionClass->isAnonymous() && $abstract !== get_class($concrete)) {
|
||||||
$bindings[$abstract] = get_class($concrete);
|
$bindings[$abstract] = get_class($concrete);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
@@ -121,9 +121,10 @@ class MetaCommand extends Command
|
|||||||
$this->unregisterClassAutoloadExceptions($ourAutoloader);
|
$this->unregisterClassAutoloadExceptions($ourAutoloader);
|
||||||
|
|
||||||
$content = $this->view->make('meta', [
|
$content = $this->view->make('meta', [
|
||||||
'bindings' => $bindings,
|
'bindings' => $bindings,
|
||||||
'methods' => $this->methods,
|
'methods' => $this->methods,
|
||||||
'factories' => $factories,
|
'factories' => $factories,
|
||||||
|
'expectedArguments' => $this->getExpectedArguments()
|
||||||
])->render();
|
])->render();
|
||||||
|
|
||||||
$filename = $this->option('filename');
|
$filename = $this->option('filename');
|
||||||
@@ -167,6 +168,20 @@ class MetaCommand extends Command
|
|||||||
return $autoloader;
|
return $autoloader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getExpectedArguments()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'config' => [
|
||||||
|
0 => $this->getConfigHints()
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getConfigHints()
|
||||||
|
{
|
||||||
|
return collect($this->config->all())->dot()->keys()->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the console command options.
|
* Get the console command options.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user