Skip to content

Commit 35c8754

Browse files
Koldo Picazakpicaza
Koldo Picaza
authored andcommitted
update dev dependencies
1 parent f183e54 commit 35c8754

File tree

5 files changed

+56
-39
lines changed

5 files changed

+56
-39
lines changed

phpunit.xml.dist

+11-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
colors="true">
6-
<testsuites>
7-
<testsuite name="Antidot\\Tests">
8-
<directory>./test</directory>
9-
</testsuite>
10-
</testsuites>
11-
12-
<filter>
13-
<whitelist processUncoveredFilesFromWhitelist="true">
14-
<directory suffix=".php">./src</directory>
15-
</whitelist>
16-
</filter>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true">
3+
<coverage processUncoveredFiles="true">
4+
<include>
5+
<directory suffix=".php">./src</directory>
6+
</include>
7+
</coverage>
8+
<testsuites>
9+
<testsuite name="Antidot\\Tests">
10+
<directory>./test</directory>
11+
</testsuite>
12+
</testsuites>
1713
</phpunit>

src/Container/Config/ConfigProvider.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99

1010
class ConfigProvider
1111
{
12-
public function __invoke()
12+
/**
13+
* @return array<mixed>
14+
*/
15+
public function __invoke(): array
1316
{
1417
return [
1518
'dependencies' => $this->getDependencies(),
@@ -18,7 +21,10 @@ public function __invoke()
1821
];
1922
}
2023

21-
protected function getDependencies()
24+
/**
25+
* @return array<array<string, string>>
26+
*/
27+
protected function getDependencies(): array
2228
{
2329
return [
2430
'factories' => [

src/Container/Config/PugConfig.php

+19-2
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,24 @@ class PugConfig implements JsonSerializable
2929
public const DEFAULT_TEMPLATE_CONFIG = [
3030
'extension' => 'pug',
3131
];
32-
/** @var array */
32+
/** @var array<mixed> */
3333
private $config;
34-
/** @var array */
34+
/** @var array<string> */
3535
private $templates;
3636

37+
/**
38+
* @param array<mixed> $config
39+
* @param array<string> $templates
40+
*/
3741
private function __construct(array $config, array $templates)
3842
{
3943
$this->config = $config;
4044
$this->templates = $templates;
4145
}
4246

47+
/**
48+
* @param array<mixed> $config
49+
*/
4350
public static function createFromAntidotConfig(array $config): self
4451
{
4552
$templates = self::DEFAULT_TEMPLATE_CONFIG;
@@ -60,6 +67,10 @@ public static function createFromAntidotConfig(array $config): self
6067
return new self($pugConfig, $templates);
6168
}
6269

70+
/**
71+
* @param string $key
72+
* @return mixed
73+
*/
6374
public function get(string $key)
6475
{
6576
if (false === array_key_exists($key, $this->config)) {
@@ -72,11 +83,17 @@ public function get(string $key)
7283
return $this->config[$key];
7384
}
7485

86+
/**
87+
* @return array<mixed>
88+
*/
7589
public function templates(): array
7690
{
7791
return $this->templates;
7892
}
7993

94+
/**
95+
* @return array<mixed>
96+
*/
8097
public function jsonSerialize(): array
8198
{
8299
return $this->config;

src/Container/PugFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function __invoke(ContainerInterface $container): Pug
3131
return $pug;
3232
}
3333

34-
private function addOns(Pug $pug, ContainerInterface $container, PugConfig $config)
34+
private function addOns(Pug $pug, ContainerInterface $container, PugConfig $config): void
3535
{
3636
foreach (self::AVAILABLE_ADD_ONS as $method => $type) {
3737
foreach ($config->get($type) as $name => $callable) {

src/PugTemplateRenderer.php

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace Antidot\Render\Phug;
46

57
use Antidot\Render\TemplateRenderer;
@@ -13,27 +15,22 @@
1315
class PugTemplateRenderer implements TemplateRenderer
1416
{
1517
public const DEFAULT_PATH = 'templates/';
16-
17-
/**
18-
* @var Pug
19-
*/
18+
/** @var Pug */
2019
private $pug;
21-
22-
/**
23-
* @var string
24-
*/
20+
/** @var string */
2521
private $path;
26-
27-
/**
28-
* @var array
29-
*/
22+
/** @var array<mixed> */
3023
private $globals;
24+
/** @var array<mixed> */
25+
private $config;
3126

3227
/**
33-
* @var array
28+
* PugTemplateRenderer constructor.
29+
* @param Pug $pug
30+
* @param array<mixed> $defaultParams
31+
* @param array<mixed> $globals
32+
* @param array<mixed> $config
3433
*/
35-
private $config;
36-
3734
public function __construct(Pug $pug, array $defaultParams, array $globals, array $config)
3835
{
3936
$this->pug = $pug;
@@ -43,14 +40,17 @@ public function __construct(Pug $pug, array $defaultParams, array $globals, arra
4340
$this->setDefaultParams($defaultParams);
4441
}
4542

43+
/**
44+
* @param array<mixed> $defaultParams
45+
*/
4646
private function setDefaultParams(array $defaultParams): void
4747
{
4848
$this->globals = (array) array_replace_recursive($this->globals, $defaultParams);
4949
}
5050

5151
/**
5252
* @param string $name
53-
* @param array $params
53+
* @param array<mixed> $params
5454
* @return string
5555
*/
5656
public function render(string $name, array $params = []) : string
@@ -69,10 +69,8 @@ public function render(string $name, array $params = []) : string
6969
* Add a template path to the engine.
7070
*
7171
* Adds a template path
72-
*
73-
* @param string $path
7472
*/
75-
private function addPath(string $path) : void
73+
private function addPath(?string $path) : void
7674
{
7775
$this->path = $path ?: self::DEFAULT_PATH;
7876
}

0 commit comments

Comments
 (0)