Tweak meta methods

This commit is contained in:
Barry vd. Heuvel
2015-03-16 14:16:41 +01:00
parent 8c339bd6b0
commit 6ed5367f6b
2 changed files with 28 additions and 21 deletions
+12 -1
View File
@@ -41,6 +41,12 @@ class MetaCommand extends Command {
/** @var \Illuminate\View\Factory */ /** @var \Illuminate\View\Factory */
protected $view; protected $view;
protected $methods = [
'\Illuminate\Foundation\Application::make',
'\App::make',
'app'
];
/** /**
* *
* @param \Illuminate\Filesystem\Filesystem $files * @param \Illuminate\Filesystem\Filesystem $files
@@ -73,7 +79,12 @@ class MetaCommand extends Command {
$this->error("Cannot make $abstract: ".$e->getMessage()); $this->error("Cannot make $abstract: ".$e->getMessage());
} }
} }
$content = $this->view->make('laravel-ide-helper::meta', ['bindings' => $bindings])->render();
$content = $this->view->make('laravel-ide-helper::meta', [
'bindings' => $bindings,
'methods' => $this->methods,
])->render();
$written = $this->files->put($filename, $content); $written = $this->files->put($filename, $content);
if ($written !== false) { if ($written !== false) {
+5 -9
View File
@@ -6,19 +6,15 @@
* *
* @author Barry vd. Heuvel <[email protected]> * @author Barry vd. Heuvel <[email protected]>
* @see https://github.com/barryvdh/laravel-ide-helper * @see https://github.com/barryvdh/laravel-ide-helper
* @noinspection PhpUnusedLocalVariableInspection
* @noinspection PhpIllegalArrayKeyTypeInspection
*/ */
/** @noinspection PhpUnusedLocalVariableInspection */
/** @noinspection PhpIllegalArrayKeyTypeInspection */
$STATIC_METHOD_TYPES = [ $STATIC_METHOD_TYPES = [
\App::make('') => [ <?php foreach($methods as $method): ?>
<?php foreach($bindings as $abstract => $class): ?> <?= $method ?>('') => [
'<?= $abstract ?>' instanceof \<?= $class ?>,
<?php endforeach ?> ],
app('') => [
<?php foreach($bindings as $abstract => $class): ?> <?php foreach($bindings as $abstract => $class): ?>
'<?= $abstract ?>' instanceof \<?= $class ?>, '<?= $abstract ?>' instanceof \<?= $class ?>,
<?php endforeach ?> ], <?php endforeach ?> ],
<?php endforeach ?>
]; ];
} }