作者 竞泽

style:cs

... ... @@ -26,7 +26,8 @@
"wujunze/dingtalk-exception": "^2.2"
},
"require-dev": {
"phpunit/phpunit": "^9.5.10"
"phpunit/phpunit": "^9.5.10",
"friendsofphp/php-cs-fixer": "^3.7"
},
"extra": {
"laravel": {
... ...
... ... @@ -42,7 +42,7 @@ class Dispatcher implements CallbackInterface
*/
public static function callback(): \Closure
{
$that = new static;
$that = new static();
if ($dispatcher = $that->config()) {
return $dispatcher;
... ...
... ... @@ -18,7 +18,7 @@ class ExceptionPush
public function __construct()
{
$this->parser = new Parser;
$this->parser = new Parser();
$this->agents = static::getAgents();
}
... ... @@ -36,7 +36,7 @@ class ExceptionPush
$agents = [];
foreach ($agentOpts as $agentName => $opts) {
$agent = new $agentName;
$agent = new $agentName();
if (!is_array($opts)) {
continue;
... ...
... ... @@ -18,8 +18,14 @@ class Formatter implements CallbackInterface
'时间:' . Carbon::now()->toDateTimeString(), '环境:' . config('app.env'), '项目:' . config('app.name'),
'参数:' . json_encode($context->getInput()), 'runtime:' . php_sapi_name(), '地址:' . $context->getPath(),
'请求方法:' . $context->getMethod(), 'IP:' . $context->getIp(),
'异常:' . sprintf('%s(%s)(code:%d):at %s:%d', $context->getException(), $context->getMessage(),
$context->getCode(), $context->getFile(), $context->getLine()),
'异常:' . sprintf(
'%s(%s)(code:%d):at %s:%d',
$context->getException(),
$context->getMessage(),
$context->getCode(),
$context->getFile(),
$context->getLine()
),
'trace:' . implode(PHP_EOL, $context->getTrace()),
];
};
... ... @@ -39,7 +45,7 @@ class Formatter implements CallbackInterface
*/
public static function callback(): \Closure
{
$that = new static;
$that = new static();
if ($formatter = $that->config()) {
return $formatter;
... ...
... ... @@ -40,11 +40,10 @@ class MonologHandler extends AbstractSyslogHandler
*/
public function __construct(
array $channels,
$facility = LOG_USER,
$level = Logger::DEBUG,
$facility = LOG_USER,
$level = Logger::DEBUG,
bool $bubble = true
)
{
) {
parent::__construct($facility, $level, $bubble);
$this->dispatcher = Dispatcher::callback();
... ...
... ... @@ -14,7 +14,7 @@ if (!function_exists('closure')) {
[$class, $method] = $closure;
return function () use ($class, $method) {
$handler = new $class;
$handler = new $class();
return call_user_func_array([$handler, $method], func_get_args());
};
... ...
... ... @@ -16,7 +16,7 @@ class Parser
public function __construct()
{
$this->context = new Context;
$this->context = new Context();
$this->request = app(Request::class);
}
... ...