1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 20:57:36 +02:00

Merge pull request #1480 from gmponos/remove-call-user-func

Replace call_user_func
This commit is contained in:
Jordi Boggiano
2020-07-09 10:32:21 +02:00
committed by GitHub
8 changed files with 10 additions and 10 deletions

View File

@@ -166,7 +166,7 @@ class ErrorHandler
); );
if ($this->previousExceptionHandler) { if ($this->previousExceptionHandler) {
call_user_func($this->previousExceptionHandler, $e); ($this->previousExceptionHandler)($e);
} }
if (!headers_sent() && !ini_get('display_errors')) { if (!headers_sent() && !ini_get('display_errors')) {
@@ -198,7 +198,7 @@ class ErrorHandler
if ($this->previousErrorHandler === true) { if ($this->previousErrorHandler === true) {
return false; return false;
} elseif ($this->previousErrorHandler) { } elseif ($this->previousErrorHandler) {
return call_user_func($this->previousErrorHandler, $code, $message, $file, $line, $context); return ($this->previousErrorHandler)($code, $message, $file, $line, $context);
} }
return true; return true;

View File

@@ -145,7 +145,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese
public function getHandler(array $record = null) public function getHandler(array $record = null)
{ {
if (!$this->handler instanceof HandlerInterface) { 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) { if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a 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) public function getHandler(array $record = null)
{ {
if (!$this->handler instanceof HandlerInterface) { 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) { if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a 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); parent::__construct($level, $bubble);
if (!$message instanceof \Swift_Message && is_callable($message)) { if (!$message instanceof \Swift_Message && is_callable($message)) {
$message = call_user_func($message); $message = $message();
} }
if (!$message instanceof \Swift_Message) { if (!$message instanceof \Swift_Message) {
throw new \InvalidArgumentException('You must provide either a Swift_Message instance or a callable returning it'); 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) public function getHandler(array $record = null)
{ {
if (!$this->handler instanceof HandlerInterface) { 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) { if (!$this->handler instanceof HandlerInterface) {
throw new \RuntimeException("The factory callable should return a 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 = clone $this->messageTemplate;
$message->generateId(); $message->generateId();
} elseif (is_callable($this->messageTemplate)) { } elseif (is_callable($this->messageTemplate)) {
$message = call_user_func($this->messageTemplate, $content, $records); $message = ($this->messageTemplate)($content, $records);
} }
if (!$message instanceof Swift_Message) { if (!$message instanceof Swift_Message) {

View File

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

View File

@@ -312,7 +312,7 @@ class Logger implements LoggerInterface, ResettableInterface
try { try {
foreach ($this->processors as $processor) { foreach ($this->processors as $processor) {
$record = call_user_func($processor, $record); $record = $processor($record);
} }
// advance the array pointer to the first handler that will handle this record // advance the array pointer to the first handler that will handle this record
@@ -610,6 +610,6 @@ class Logger implements LoggerInterface, ResettableInterface
throw $e; throw $e;
} }
call_user_func($this->exceptionHandler, $e, $record); ($this->exceptionHandler)($e, $record);
} }
} }