Improve class import and strict typing for generated migration class

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2018-09-07 09:19:55 +02:00
parent 09a223fee9
commit c5cd8d9166
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8
1 changed files with 10 additions and 6 deletions

View File

@ -40,8 +40,12 @@ class GenerateCommand extends Command implements CompletionAwareInterface {
protected static $_templateSimple = protected static $_templateSimple =
'<?php '<?php
declare(strict_types=1);
namespace {{namespace}}; namespace {{namespace}};
use Closure;
use OCP\DB\ISchemaWrapper; use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep; use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput; use OCP\Migration\IOutput;
@ -53,28 +57,28 @@ class {{classname}} extends SimpleMigrationStep {
/** /**
* @param IOutput $output * @param IOutput $output
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*/ */
public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }
/** /**
* @param IOutput $output * @param IOutput $output
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
* @return null|ISchemaWrapper * @return null|ISchemaWrapper
*/ */
public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
{{schemabody}} {{schemabody}}
} }
/** /**
* @param IOutput $output * @param IOutput $output
* @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options * @param array $options
*/ */
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
} }
} }
'; ';