test
This commit is contained in:
+16
-4
@@ -3,7 +3,6 @@
|
||||
namespace app\config;
|
||||
|
||||
|
||||
|
||||
class Config
|
||||
{
|
||||
/**
|
||||
@@ -84,9 +83,20 @@ class Config
|
||||
get => $this->blockMode;
|
||||
}
|
||||
|
||||
public function setBlockMode(bool $value)
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
* @return void
|
||||
* @deprecated 禁止使用,改方法仅仅用于 test 方法
|
||||
*/
|
||||
public function setBlockMode(bool $value): void
|
||||
{
|
||||
echo "\033[31m获取禁止修改热修改阻断模式,这只是用于测试方法\033[0m\n";
|
||||
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 10);
|
||||
$isContainTests = false;
|
||||
foreach ($stack as $item) if (str_contains($item['file'] ?? '', 'tests')) {
|
||||
$isContainTests = true;
|
||||
}
|
||||
if (!$isContainTests) throw new \RuntimeException('禁止修改阻断模式');
|
||||
$this->blockMode = $value;
|
||||
}
|
||||
|
||||
@@ -146,7 +156,9 @@ class Config
|
||||
$this->enableVirtualCleanerParser = self::getBoolEnv('ENABLE_VIRTUAL_CLEANER_PARSER', false);
|
||||
}
|
||||
|
||||
private function __clone() {}
|
||||
private function __clone()
|
||||
{
|
||||
}
|
||||
|
||||
private function detectCircularDependency(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user