Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

replace call_user_func* with self invoked function #200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Transport/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion src/Transport/Sendmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test/Header/AddressListHeaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion test/Transport/FileOptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down