1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 09:06:10 +02:00

Replace call_user_func

This commit is contained in:
Mponos George
2020-07-08 23:02:57 +03:00
parent 53e2c97b0b
commit a54cd1f178
8 changed files with 10 additions and 10 deletions

View File

@@ -145,7 +145,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
$this->handler = ($this->handler)($record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}

View File

@@ -188,7 +188,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
$this->handler = ($this->handler)($record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}

View File

@@ -37,7 +37,7 @@ class MandrillHandler extends MailHandler
parent::__construct($level, $bubble);
if (!$message instanceof \Swift_Message && is_callable($message)) {
$message = call_user_func($message);
$message = $message();
}
if (!$message instanceof \Swift_Message) {
throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it');

View File

@@ -86,7 +86,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter
public function getHandler(array $record = null)
{
if (!$this->handler instanceof HandlerInterface) {
$this->handler = call_user_func($this->handler, $record, $this);
$this->handler = ($this->handler)($record, $this);
if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a HandlerInterface");
}

View File

@@ -75,7 +75,7 @@ class SwiftMailerHandler extends MailHandler
$message = clone $this->messageTemplate;
$message->generateId();
} elseif (is_callable($this->messageTemplate)) {
$message = call_user_func($this->messageTemplate, $content, $records);
$message = ($this->messageTemplate)($content, $records);
}
if (!$message instanceof Swift_Message) {

View File

@@ -159,7 +159,7 @@ class TestHandler extends AbstractProcessingHandler
}
foreach ($this->recordsByLevel[$level] as $i => $rec) {
if (call_user_func($predicate, $rec, $i)) {
if ($predicate($rec, $i)) {
return true;
}
}