Skip to content

Commit

Permalink
PHP 5.3 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
adamaveray authored and Ninir committed Jul 16, 2014
1 parent 7850508 commit 6fbd68b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/Stampie/Mailer.php
Expand Up @@ -182,7 +182,7 @@ protected function buildIdentityString($identities)
*@return array
* @see \Stampie\Utils\AttachmentUtils::processAttachments
*/
protected function processAttachments(array $attachments, callable $callback)
protected function processAttachments(array $attachments, $callback)
{
return AttachmentUtils::processAttachments($attachments, $callback);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Stampie/Mailer/MailGun.php
Expand Up @@ -137,7 +137,7 @@ protected function handle(ResponseInterface $response)
/**
* {@inheritdoc}
*/
protected function processAttachments(array $attachments, callable $callback){
protected function processAttachments(array $attachments, $callback){
return array_values(parent::processAttachments($attachments, $callback));
}
}
2 changes: 1 addition & 1 deletion lib/Stampie/Mailer/Mandrill.php
Expand Up @@ -141,7 +141,7 @@ protected function getAttachmentContent(AttachmentInterface $attachment){
/**
* {@inheritdoc}
*/
protected function processAttachments(array $attachments, callable $callback)
protected function processAttachments(array $attachments, $callback)
{
// Strip keys
return array_values(parent::processAttachments($attachments, $callback));
Expand Down
2 changes: 1 addition & 1 deletion lib/Stampie/Mailer/Postmark.php
Expand Up @@ -120,7 +120,7 @@ protected function getAttachmentContent(AttachmentInterface $attachment){
/**
* {@inheritdoc}
*/
protected function processAttachments(array $attachments, callable $callback){
protected function processAttachments(array $attachments, $callback){
// Strip keys
return array_values(parent::processAttachments($attachments, $callback));
}
Expand Down
6 changes: 5 additions & 1 deletion lib/Stampie/Util/AttachmentUtils.php
Expand Up @@ -20,8 +20,12 @@ abstract class AttachmentUtils
*
* @throws \InvalidArgumentException
*/
public static function processAttachments(array $attachments, callable $callback)
public static function processAttachments(array $attachments, $callback)
{
if (!is_callable($callback)) {
throw new \InvalidArgumentException('Callback must be callable');
}

$processed = array();

foreach ($attachments as $attachment) {
Expand Down
7 changes: 4 additions & 3 deletions tests/Stampie/Tests/Mailer/MailGunTest.php
Expand Up @@ -45,9 +45,10 @@ public function testHeaders()

public function testGetFiles(){
$self = $this; // PHP5.3 compatibility
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\MailGun', null, array($self->adapter, $token));
$adapter = $this->adapter;
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $adapter, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\MailGun', null, array($adapter, $token));

// Wrap protected method with accessor
$mirror = new \ReflectionClass($mailer);
Expand Down
7 changes: 4 additions & 3 deletions tests/Stampie/Tests/Mailer/MandrillTest.php
Expand Up @@ -177,9 +177,10 @@ public function testFormatAttachments()

public function testGetFiles(){
$self = $this; // PHP5.3 compatibility
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\Mandrill', null, array($self->adapter, $token));
$adapter = $this->adapter;
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $adapter, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\Mandrill', null, array($adapter, $token));

// Wrap protected method with accessor
$mirror = new \ReflectionClass($mailer);
Expand Down
7 changes: 4 additions & 3 deletions tests/Stampie/Tests/Mailer/PostmarkTest.php
Expand Up @@ -151,9 +151,10 @@ public function testFormatAttachments()

public function testGetFiles(){
$self = $this; // PHP5.3 compatibility
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\Postmark', null, array($self->adapter, $token));
$adapter = $this->adapter;
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $adapter, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\Postmark', null, array($adapter, $token));

// Wrap protected method with accessor
$mirror = new \ReflectionClass($mailer);
Expand Down
7 changes: 4 additions & 3 deletions tests/Stampie/Tests/Mailer/SendGridTest.php
Expand Up @@ -180,9 +180,10 @@ public function testFormatAttachments()

public function testGetFiles(){
$self = $this; // PHP5.3 compatibility
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\SendGrid', null, array($self->adapter, $token));
$adapter = $this->adapter;
$token = self::SERVER_TOKEN;
$buildMocks = function($attachments, &$invoke) use($self, $adapter, $token){
$mailer = $self->getMock('\\Stampie\\Mailer\\SendGrid', null, array($adapter, $token));

// Wrap protected method with accessor
$mirror = new \ReflectionClass($mailer);
Expand Down

0 comments on commit 6fbd68b

Please sign in to comment.