make commands lazily loaded

This commit is contained in:
sunxyw
2022-12-17 22:18:50 +08:00
parent 3806983bc2
commit 44c25f7fdd
8 changed files with 98 additions and 50 deletions

View File

@@ -0,0 +1,20 @@
<?php
declare(strict_types=1);
namespace ZM\Command;
trait NonPharLoadModeOnly
{
protected function shouldExecute(): bool
{
if (\Phar::running() === '') {
return true;
}
if (method_exists($this, 'error')) {
$this->error('此命令只能在非 Phar 模式下使用!');
}
return false;
}
}