Skip to content

Commit cbd124a

Browse files
committed
Fix compatibility
1 parent 2c83379 commit cbd124a

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

src/PugRenderer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Psr\Http\Message\ResponseInterface;
88
use Pug\Pug;
99
use Slim\App;
10+
use Slim\Psr7\Factory\ResponseFactory;
1011

1112
/**
1213
* Class PugRenderer.
@@ -56,7 +57,9 @@ public function __construct($templatePath = null, $options = [], $attributes = [
5657
public static function create(?App $app = null, $templatePath = null, array $options = [], array $attributes = [])
5758
{
5859
if (!$app) {
59-
$app = new App();
60+
$app = defined(App::class . '::VERSION') && ((int) App::VERSION) >= 4
61+
? new App(new ResponseFactory())
62+
: new App();
6063
}
6164

6265
$container = $app->getContainer();

tests/AbstractTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use DI\ContainerBuilder;
66
use PHPUnit\Framework\TestCase;
77
use RuntimeException;
8+
use Slim\App;
9+
use Slim\Factory\AppFactory;
810
use Slim\Http\Body as Slim3Body;
911
use Slim\Http\Headers as Slim3Headers;
1012
use Slim\Http\Request as Slim3Request;
1113
use Slim\Http\Response as Slim3Response;
1214
use Slim\Http\Stream as Slim3Stream;
1315
use Slim\Http\Uri as Slim3Uri;
14-
use Slim\App;
15-
use Slim\Factory\AppFactory;
1616
use Slim\Psr7\Headers;
1717
use Slim\Psr7\Request;
1818
use Slim\Psr7\Stream;

0 commit comments

Comments
 (0)