split InitException to SingletonViolationException

This commit is contained in:
sunxyw
2022-12-16 17:58:52 +08:00
parent daa07dcb2b
commit ebb724415d
5 changed files with 24 additions and 20 deletions

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace ZM\Exception;
class SingletonViolationException extends ZMException
{
public function __construct(string $singleton_class_name)
{
parent::__construct(
"{$singleton_class_name} 是单例模式,不允许初始化多个实例。",
"请检查代码,确保只初始化了一个 {$singleton_class_name} 实例。",
69
);
}
}