From 432452cf9c68023027b587695360c4f64f151141 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 22 Mar 2018 02:05:23 +0700 Subject: [PATCH] replace call_user_func* with self invoked function --- src/Transport/File.php | 2 +- src/Transport/Sendmail.php | 2 +- test/Header/AddressListHeaderTest.php | 4 ++-- test/Transport/FileOptionsTest.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Transport/File.php b/src/Transport/File.php index d62a3ed4..9f822666 100644 --- a/src/Transport/File.php +++ b/src/Transport/File.php @@ -71,7 +71,7 @@ public function setOptions(FileOptions $options) public function send(Message $message) { $options = $this->options; - $filename = call_user_func($options->getCallback(), $this); + $filename = $options->getCallback()($this); $file = $options->getPath() . DIRECTORY_SEPARATOR . $filename; $email = $message->toString(); diff --git a/src/Transport/Sendmail.php b/src/Transport/Sendmail.php index 08511a27..562922f6 100644 --- a/src/Transport/Sendmail.php +++ b/src/Transport/Sendmail.php @@ -134,7 +134,7 @@ public function send(Mail\Message $message) $headers = str_replace("\r\n", "\n", $headers); } - call_user_func($this->callable, $to, $subject, $body, $headers, $params); + ($this->callable)($to, $subject, $body, $headers, $params); } /** diff --git a/test/Header/AddressListHeaderTest.php b/test/Header/AddressListHeaderTest.php index 0bcc92ac..4fb8e527 100644 --- a/test/Header/AddressListHeaderTest.php +++ b/test/Header/AddressListHeaderTest.php @@ -118,7 +118,7 @@ public function getStringHeaders() public function testDeserializationFromString($headerLine, $class) { $callback = sprintf('%s::fromString', $class); - $header = call_user_func($callback, $headerLine); + $header = $callback($headerLine); $this->assertInstanceOf($class, $header); $list = $header->getAddressList(); $this->assertEquals(4, count($list)); @@ -175,7 +175,7 @@ public function getHeadersWithComments() public function testAllowsNoWhitespaceBetweenHeaderAndValue($headerLine, $class) { $callback = sprintf('%s::fromString', $class); - $header = call_user_func($callback, $headerLine); + $header = $callback($headerLine); $this->assertInstanceOf($class, $header); $list = $header->getAddressList(); $this->assertEquals(4, count($list)); diff --git a/test/Transport/FileOptionsTest.php b/test/Transport/FileOptionsTest.php index 2a5a3c23..dcd7c8f3 100644 --- a/test/Transport/FileOptionsTest.php +++ b/test/Transport/FileOptionsTest.php @@ -32,7 +32,7 @@ public function testDefaultCallbackIsSetByDefault() { $callback = $this->options->getCallback(); $this->assertInternalType('callable', $callback); - $test = call_user_func($callback, ''); + $test = $callback(''); $this->assertRegExp('#^ZendMail_\d+_\d+\.eml$#', $test); }