Skip to content

Commit

Permalink
WIP: symfony 6 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
BeBlood committed Dec 30, 2022
1 parent 834aa3a commit 302ab87
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 33 deletions.
5 changes: 3 additions & 2 deletions Gateway/AbstractPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
use IDCI\Bundle\PaymentBundle\Model\Transaction;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

abstract class AbstractPaymentGateway implements PaymentGatewayInterface
{
/**
* @var \Twig_Environment
* @var Environment
*/
protected $templating;

Expand All @@ -21,7 +22,7 @@ abstract class AbstractPaymentGateway implements PaymentGatewayInterface
protected $dispatcher;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher
) {
$this->templating = $templating;
Expand Down
3 changes: 2 additions & 1 deletion Gateway/AlmaPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AlmaPaymentGateway extends AbstractPaymentGateway
{
public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
LoggerInterface $logger
) {
Expand Down
3 changes: 2 additions & 1 deletion Gateway/AtosSipsBinPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Process\Process;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AtosSipsBinPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -30,7 +31,7 @@ class AtosSipsBinPaymentGateway extends AbstractPaymentGateway
private $responseBinPath;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
string $pathfile,
string $requestBinPath,
Expand Down
3 changes: 2 additions & 1 deletion Gateway/AtosSipsJsonPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Payum\ISO4217\ISO4217;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AtosSipsJsonPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -21,7 +22,7 @@ class AtosSipsJsonPaymentGateway extends AbstractPaymentGateway
private $serverHostName;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
string $serverHostName
) {
Expand Down
3 changes: 2 additions & 1 deletion Gateway/AtosSipsPostPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Payum\ISO4217\ISO4217;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class AtosSipsPostPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -19,7 +20,7 @@ class AtosSipsPostPaymentGateway extends AbstractPaymentGateway
private $serverHostName;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
string $serverHostName
) {
Expand Down
3 changes: 2 additions & 1 deletion Gateway/EurekaPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use IDCI\Bundle\PaymentBundle\Payment\PaymentStatus;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class EurekaPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -23,7 +24,7 @@ class EurekaPaymentGateway extends AbstractPaymentGateway
private $serverHostName;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
EurekaPaymentGatewayClient $eurekaPaymentGatewayClient
) {
Expand Down
3 changes: 2 additions & 1 deletion Gateway/PayboxPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Payum\ISO4217\ISO4217;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class PayboxPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -19,7 +20,7 @@ class PayboxPaymentGateway extends AbstractPaymentGateway
private $serverHostName;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
string $serverHostName,
string $keyPath,
Expand Down
3 changes: 2 additions & 1 deletion Gateway/StripePaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class StripePaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -18,7 +19,7 @@ class StripePaymentGateway extends AbstractPaymentGateway
private $router;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
UrlGeneratorInterface $router
) {
Expand Down
3 changes: 2 additions & 1 deletion Gateway/SystemPayPaymentGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Payum\ISO4217\ISO4217;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class SystemPayPaymentGateway extends AbstractPaymentGateway
{
Expand All @@ -24,7 +25,7 @@ class SystemPayPaymentGateway extends AbstractPaymentGateway
private $serverUrl;

public function __construct(
\Twig_Environment $templating,
Environment $templating,
EventDispatcherInterface $dispatcher,
string $serverUrl
) {
Expand Down
5 changes: 3 additions & 2 deletions Step/Event/Action/ManageTransactionStepEventAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
use Twig\Environment;

class ManageTransactionStepEventAction extends AbstractStepEventAction
{
Expand Down Expand Up @@ -45,7 +46,7 @@ class ManageTransactionStepEventAction extends AbstractStepEventAction
protected $dispatcher;

/**
* @var \Twig_Environment
* @var Environment
*/
private $templating;

Expand All @@ -60,7 +61,7 @@ public function __construct(
UrlGeneratorInterface $router,
RequestStack $requestStack,
EventDispatcherInterface $dispatcher,
\Twig_Environment $templating,
Environment $templating,
array $templates
) {
$this->paymentManager = $paymentManager;
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/Gateway/PaymentGatewayTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
use IDCI\Bundle\PaymentBundle\Model\Transaction;
use IDCI\Bundle\PaymentBundle\Payment\TransactionFactory;
use PHPUnit\Framework\TestCase;
use Twig\Environment as TwigEnvironment;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

class PaymentGatewayTestCase extends TestCase
{
/**
* @var \Twig_Environment
* @var Environment
*/
protected $twig;

Expand All @@ -36,7 +36,7 @@ public function setUp()
$loader = new FilesystemLoader();
$loader->addPath(__DIR__.'/../../..', 'IDCIPaymentBundle');

$this->twig = new TwigEnvironment($loader);
$this->twig = new Environment($loader);

$this->paymentGatewayConfiguration = (new PaymentGatewayConfiguration())
->setAlias('dummy_gateway_alias')
Expand Down
6 changes: 3 additions & 3 deletions Tests/Unit/Payment/PaymentContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;
use Twig\Environment as TwigEnvironment;
use Twig\Environment;
use Twig\Loader\ArrayLoader;

class PaymentContextTest extends TestCase
Expand All @@ -35,7 +35,7 @@ class PaymentContextTest extends TestCase
private $dispatcher;

/**
* @var \Twig_Environment
* @var Environment
*/
private $twig;

Expand All @@ -51,7 +51,7 @@ class PaymentContextTest extends TestCase

public function setUp()
{
$this->twig = new TwigEnvironment(new ArrayLoader());
$this->twig = new Environment(new ArrayLoader());

$this->paymentGateway = $this->getMockBuilder(AbstractPaymentGateway::class)
->setConstructorArgs([$this->twig])
Expand Down
29 changes: 14 additions & 15 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,31 @@
}
],
"require": {
"php": ">=7.0",
"symfony/dependency-injection": "^4.0",
"symfony/dom-crawler": "^4.0",
"symfony/framework-bundle": "^4.0",
"symfony/form": "^4.0",
"symfony/templating": "^4.0",
"symfony/twig-bundle": "^4.0",
"php": "^7.1 || ^8.0",
"symfony/dependency-injection": "^4.0 || ^5.0 || ^6.0",
"symfony/dom-crawler": "^4.0 || ^5.0 || ^6.0",
"symfony/framework-bundle": "^4.0 || ^5.0 || ^6.0",
"symfony/form": "^4.0 || ^5.0 || ^6.0",
"symfony/templating": "^4.0 || ^5.0 || ^6.0",
"symfony/twig-bundle": "^4.0 || ^5.0 || ^6.0",
"symfony/monolog-bundle": "^3.3",
"symfony/process": "^4.0",
"ramsey/uuid": "^4.0",
"symfony/process": "^4.0 || ^5.0 || ^6.0",
"ramsey/uuid": "^4.0 || ^5.0 || ^6.0",
"ramsey/uuid-doctrine": "^1.4",
"doctrine/persistence": "^1.1",
"doctrine/persistence": "^2.2 || ^3.0",
"payum/iso4217": "~1.0",
"paypal/rest-api-sdk-php": "^1.13",
"stripe/stripe-php": "^6.7",
"jwarkentin/flaky": "~0.0.9",
"payplug/payplug-php": "~2.5",
"pascaldevink/shortuuid": "~2.0"
"payplug/payplug-php": "~2.5"
},
"suggest": {
"alma/alma-php-client": "^1.0",
"idci/step-bundle": "~3.0",
"symfony/cache": "^4.0"
"idci/step-bundle": ">=4.0",
"symfony/cache": "^4.0 || ^5.0 || ^6.0"
},
"require-dev": {
"phpunit/phpunit": "~5.7"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 302ab87

Please sign in to comment.