Skip to content

Commit

Permalink
symfony 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Smeagolworms4 committed Nov 9, 2018
1 parent 2e19514 commit 9db81b4
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 43 deletions.
20 changes: 2 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
language: php

php:
- 5.6
- 7.0
- hhvm
- 7.1

matrix:
fast_finish: true
include:
- php: 5.6
env: SYMFONY_VERSION=2.7.*
- php: 5.6
env: SYMFONY_VERSION=2.8.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
allow_failures:
- php: hhvm

before_install:
# If PHP >= 7.0, force use of PHPunit 5.7
- mkdir ~/bin ; if php -r "exit( (int)! version_compare( '$TRAVIS_PHP_VERSION', '7.0', '>=' ) );"; then wget -O ~/bin/phpunit https://phar.phpunit.de/phpunit-6.1.3.phar; else wget -O ~/bin/phpunit https://phar.phpunit.de/phpunit-5.7.phar; fi ; chmod +x ~/bin/phpunit
- mkdir ~/bin; wget -O ~/bin/phpunit https://phar.phpunit.de/phpunit-6.1.3.phar; chmod +x ~/bin/phpunit

before_script:
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then echo "memory_limit=2G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;

install: composer update --prefer-dist --no-interaction $COMPOSER_FLAGS

script: ~/bin/phpunit --coverage-text
Expand Down
11 changes: 7 additions & 4 deletions Builder/EmailBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\HttpKernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Translation\TranslatorInterface;

Expand All @@ -21,7 +20,7 @@ class EmailBuilder implements EmailBuilderInterface{
const HEADER_ALT_TEXT = 'mail-text';

/**
* @var HttpKernel
* @var HttpKernelInterface
*/
private $httpKernel;

Expand All @@ -35,7 +34,11 @@ class EmailBuilder implements EmailBuilderInterface{
*/
private $translator;

public function __construct(HttpKernel $httpKernel, RequestStack $requestStack, TranslatorInterface $translator) {
public function __construct(
HttpKernelInterface $httpKernel,
RequestStack $requestStack,
TranslatorInterface $translator
) {
$this->httpKernel = $httpKernel;
$this->requestStack = $requestStack;
$this->translator = $translator;
Expand Down Expand Up @@ -100,7 +103,7 @@ public function build($subject, $body, $to, $cc = NULL, $bcc = NULL, $from = NUL
->setCc ($cc)
->setBcc ($bcc)
->setFrom($from)
;
;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Model/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function addFrom($mail, $name = NULL) {
* @return \Swift_Message
*/
public function toSwiftMessage() {
$message = \Swift_Message::newInstance();
$message = new \Swift_Message();

$message->setSubject($this->getSubject());
$message->setBody($this->getBody(), 'text/html');
Expand Down
27 changes: 10 additions & 17 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
parameters:
gsf_email.senderemailsender_class: GollumSF\EmailBundle\Sender\EmailSender
gsf_email.builderemailbuilder_class: GollumSF\EmailBundle\Builder\EmailBuilder

services:

gsf_email.sender:
class: '%gsf_email.senderemailsender_class%'
arguments:
- '@gsf_email.builder'
- '@mailer'

gsf_email.builder:
class: '%gsf_email.builderemailbuilder_class%'
arguments:
- '@http_kernel'
- '@request_stack'
- '@translator'
_defaults:
autowire: true
autoconfigure: true
public: true

GollumSF\EmailBundle\Builder\EmailBuilderInterface:
class: GollumSF\EmailBundle\Builder\EmailBuilder

GollumSF\EmailBundle\Sender\EmailSenderInterface:
class: GollumSF\EmailBundle\Sender\EmailSender
5 changes: 4 additions & 1 deletion Sender/EmailSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class EmailSender implements EmailSenderInterface {
*/
private $mailer;

public function __construct(EmailBuilderInterface $emailBuilder, \Swift_Mailer $mailer) {
public function __construct(
EmailBuilderInterface $emailBuilder,
\Swift_Mailer $mailer
) {
$this->emailBuilder = $emailBuilder;
$this->mailer = $mailer;
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"wiki" : "https://github.com/GollumSF/email-bundle/blob/master/README.md"
},
"require" : {
"php" : ">=5.5",
"symfony/framework-bundle" : ">=2.7"
"php" : ">=7.1",
"symfony/framework-bundle" : ">=3.4"
},
"autoload" : {
"psr-0" : {
Expand Down

0 comments on commit 9db81b4

Please sign in to comment.