Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop Support for PHP 7.3 #238

Merged
merged 3 commits into from
Jan 2, 2022
Merged
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
9 changes: 1 addition & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@ jobs:
tests:
name: Tests PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0]
experimental: [false]
include:
- php: 8.0
analysis: true
- php: 8.1
experimental: true
php: [7.4, 8.0, 8.1]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Via [Composer](https://getcomposer.org/)
$ composer require slim/twig-view:^3.0
```

Requires Slim Framework 4, Twig 3 and PHP 7.3 or newer.
Requires Slim Framework 4, Twig 3 and PHP 7.4 or newer.

## Usage

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"php": "^7.4 || ^8.0",
"psr/http-message": "^1.0",
"slim/slim": "^4.9",
"twig/twig": "^3.3",
Expand Down
10 changes: 3 additions & 7 deletions src/Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,20 @@ class Twig implements ArrayAccess
{
/**
* Twig loader
*
* @var LoaderInterface
*/
protected $loader;
protected LoaderInterface $loader;

/**
* Twig environment
*
* @var Environment
*/
protected $environment;
protected Environment $environment;

/**
* Default view variables
*
* @var array<string, mixed>
*/
protected $defaultVariables = [];
protected array $defaultVariables = [];

/**
* @param ServerRequestInterface $request
Expand Down
27 changes: 10 additions & 17 deletions src/TwigMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,13 @@

class TwigMiddleware implements MiddlewareInterface
{
/**
* @var Twig
*/
protected $twig;
protected Twig $twig;

/**
* @var RouteParserInterface
*/
protected $routeParser;
protected RouteParserInterface $routeParser;

/**
* @var string
*/
protected $basePath;
protected string $basePath;

/**
* @var string|null
*/
protected $attributeName;
protected ?string $attributeName;

/**
* @param App $app
Expand Down Expand Up @@ -108,7 +96,12 @@ public function __construct(
}

/**
* {@inheritdoc}
* Process an incoming server request.
*
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
*
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
Expand Down
15 changes: 3 additions & 12 deletions src/TwigRuntimeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,11 @@

class TwigRuntimeExtension
{
/**
* @var RouteParserInterface
*/
protected $routeParser;
protected RouteParserInterface $routeParser;

/**
* @var string
*/
protected $basePath = '';
protected string $basePath = '';

/**
* @var UriInterface
*/
protected $uri;
protected UriInterface $uri;

/**
* @param RouteParserInterface $routeParser Route parser
Expand Down
21 changes: 8 additions & 13 deletions src/TwigRuntimeLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,11 @@

class TwigRuntimeLoader implements RuntimeLoaderInterface
{
/**
* @var RouteParserInterface
*/
protected $routeParser;
protected RouteParserInterface $routeParser;

/**
* @var UriInterface
*/
protected $uri;
protected UriInterface $uri;

/**
* @var string
*/
protected $basePath = '';
protected string $basePath = '';

/**
* TwigRuntimeLoader constructor.
Expand All @@ -46,7 +37,11 @@ public function __construct(RouteParserInterface $routeParser, UriInterface $uri
}

/**
* {@inheritdoc}
* Create the runtime implementation of a Twig element.
*
* @param string $class
*
* @return mixed
*/
public function load(string $class)
{
Expand Down
8 changes: 4 additions & 4 deletions tests/TwigRuntimeExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function mapRouteCollectorRoute(
return $route;
}

public function isCurrentUrlProvider()
public function isCurrentUrlProvider(): array
{
return [
['/hello/{name}', ['name' => 'world'], '/hello/world', '/base-path', true],
Expand Down Expand Up @@ -109,7 +109,7 @@ public function testIsCurrentUrl(string $pattern, array $data, string $path, ?st
$this->assertEquals($expected, $result);
}

public function currentUrlProvider()
public function currentUrlProvider(): array
{
return [
['/hello/{name}', 'http://example.com/hello/world?a=b', '', true],
Expand Down Expand Up @@ -164,7 +164,7 @@ public function testCurrentUrl(string $pattern, string $url, string $basePath, b
$this->assertEquals($expected, $result);
}

public function urlForProvider()
public function urlForProvider(): array
{
return [
['/hello/{name}', ['name' => 'world'], [], '', '/hello/world'],
Expand Down Expand Up @@ -204,7 +204,7 @@ public function testUrlFor(
$this->assertEquals($expectedUrl, $extension->urlFor($routeName, $routeData, $queryParams));
}

public function fullUrlForProvider()
public function fullUrlForProvider(): array
{
return [
['/hello/{name}', ['name' => 'world'], [], '', 'http://localhost/hello/world'],
Expand Down