diff --git a/src/CodeGenerator.php b/src/CodeGenerator.php index f1087eb..f163b72 100644 --- a/src/CodeGenerator.php +++ b/src/CodeGenerator.php @@ -14,7 +14,7 @@ interface CodeGenerator { - public function generator(); + public function generator(): void; - public function preview(); + public function preview(): string; } diff --git a/src/MineGenerator.php b/src/MineGenerator.php index b95c6ef..9f5b52f 100644 --- a/src/MineGenerator.php +++ b/src/MineGenerator.php @@ -25,12 +25,10 @@ abstract class MineGenerator protected string $namespace; - protected ContainerInterface $container; - /** * MineGenerator constructor. */ - public function __construct(ContainerInterface $container) + public function __construct(protected ContainerInterface $container) { $this->setStubDir( realpath( @@ -39,7 +37,6 @@ public function __construct(ContainerInterface $container) ) ) . DIRECTORY_SEPARATOR . 'Stubs' . DIRECTORY_SEPARATOR ); - $this->container = $container; } public function getStubDir(): string diff --git a/src/ModuleGenerator.php b/src/ModuleGenerator.php index ec1d59e..e5e0943 100644 --- a/src/ModuleGenerator.php +++ b/src/ModuleGenerator.php @@ -23,9 +23,8 @@ class ModuleGenerator extends MineGenerator /** * 设置模块信息. - * @return $this */ - public function setModuleInfo(array $moduleInfo): ModuleGenerator + public function setModuleInfo(array $moduleInfo): static { $this->moduleInfo = $moduleInfo; return $this;