Skip to content

Commit

Permalink
declare types
Browse files Browse the repository at this point in the history
  • Loading branch information
nbayramberdiyev committed Dec 28, 2021
1 parent dc1296c commit 672742d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 51 deletions.
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
20 changes: 4 additions & 16 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
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
15 changes: 3 additions & 12 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 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

0 comments on commit 672742d

Please sign in to comment.