diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index bfc62fb..3b34c43 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -149,7 +149,7 @@ jobs:
strategy:
matrix:
- php-version: [ "8.0", "8.1" ]
+ php-version: [ "8.0", "8.1", "8.2", "8.3" ]
operating-system: [ "ubuntu-latest" ]
composer-args: [ "" ]
include:
diff --git a/composer.json b/composer.json
index ce35aa6..9b147fd 100644
--- a/composer.json
+++ b/composer.json
@@ -16,7 +16,7 @@
],
"require": {
"php": "^8.0.2",
- "latte/latte": "^2.6|^3.0",
+ "latte/latte": "^2.6|^3.0.12",
"nette/di": "^3.0.6",
"nette/finder": "^2.5.2|~3.0.0",
"nette/http": "^3.0.7",
@@ -24,24 +24,24 @@
"nette/schema": "^1.0",
"nette/routing": "^3.0",
"nette/utils": "^3.2.1|~4.0.0",
- "symfony/translation": "^6.0",
- "symfony/config": "^6.0"
+ "symfony/translation": "^6.0|^7.0",
+ "symfony/config": "^6.0|^7.0"
},
"require-dev": {
"doctrine/orm": "^2.8",
"mockery/mockery": "^1.4",
"nette/application": "^3.1.0",
- "nette/bootstrap": "^3.0",
+ "nette/bootstrap": "^3.2.1",
"nette/database": "^3.1.1",
"nette/robot-loader": "^3.4.0|~4.0.0",
"nette/tester": "^2.3.1",
- "ninjify/nunjuck": "^0.3.0",
+ "ninjify/nunjuck": "^0.4.0",
"ninjify/qa": "^0.13",
"phpstan/phpstan": "^1.8",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-nette": "^1.0",
"phpstan/phpstan-strict-rules": "^1.1",
- "psr/log": "^1.1",
+ "psr/log": "^1.1|^2.0|^3.0",
"tracy/tracy": "^2.8"
},
"autoload": {
diff --git a/ruleset.xml b/ruleset.xml
index 7288e16..a1d48e0 100644
--- a/ruleset.xml
+++ b/ruleset.xml
@@ -4,6 +4,9 @@
+
+
+
diff --git a/src/Latte/TranslatorExtension.php b/src/Latte/TranslatorExtension.php
index f436eff..159a39f 100644
--- a/src/Latte/TranslatorExtension.php
+++ b/src/Latte/TranslatorExtension.php
@@ -9,7 +9,7 @@
use Latte\Compiler\Nodes\Php\ArgumentNode;
use Latte\Compiler\Nodes\Php\Expression\ArrayNode;
use Latte\Compiler\Nodes\Php\Expression\BinaryOpNode;
-use Latte\Compiler\Nodes\Php\Expression\StaticCallNode;
+use Latte\Compiler\Nodes\Php\Expression\StaticMethodCallNode;
use Latte\Compiler\Nodes\Php\Expression\VariableNode;
use Latte\Compiler\Nodes\Php\FilterNode;
use Latte\Compiler\Nodes\Php\IdentifierNode;
@@ -70,7 +70,7 @@ public function parseTranslate(
$prefixProp = Helpers::createLatteProperty('Prefix');
- $messageNode = new StaticCallNode(
+ $messageNode = new StaticMethodCallNode(
new NameNode('\Contributte\Translation\Helpers', NameNode::KindFullyQualified),
new IdentifierNode('prefixMessage'),
[
diff --git a/tests/Tests/Helpers.php b/tests/Tests/Helpers.php
index fe3df0a..7331dab 100644
--- a/tests/Tests/Helpers.php
+++ b/tests/Tests/Helpers.php
@@ -3,7 +3,7 @@
namespace Tests;
use Contributte\Translation\DI\TranslationExtension;
-use Nette\Configurator;
+use Nette\Bootstrap\Configurator;
use Nette\DI\Container;
final class Helpers
diff --git a/tests/Tests/PsrLoggerMock.php b/tests/Tests/PsrLoggerMock.php
index 33c1f67..826c1f3 100644
--- a/tests/Tests/PsrLoggerMock.php
+++ b/tests/Tests/PsrLoggerMock.php
@@ -14,7 +14,7 @@ public function log(
$level,
$message,
array $context = []
- )
+ ): void
{
}
diff --git a/tests/Tests/TestAbstract.php b/tests/Tests/TestAbstract.php
index dac8605..4c620cf 100644
--- a/tests/Tests/TestAbstract.php
+++ b/tests/Tests/TestAbstract.php
@@ -2,7 +2,10 @@
namespace Tests;
+use Composer\InstalledVersions;
use Nette\DI\Container;
+use Nette\Utils\FileSystem;
+use Nette\Utils\Json;
use Tester\TestCase;
abstract class TestAbstract extends TestCase
@@ -17,22 +20,26 @@ public function __construct(
)
{
if (class_exists('\Composer\InstalledVersions')) { // Composer 2
- $netteUtilsVersion = \Composer\InstalledVersions::getPrettyVersion('nette/utils');
+ $netteUtilsVersion = InstalledVersions::getPrettyVersion('nette/utils');
} else { // Composer 1
- $composerRaw = \Nette\Utils\FileSystem::read(__DIR__ . '/../../composer.lock');
- $composerData = \Nette\Utils\Json::decode($composerRaw);
- $netteUtilsVersion = '0.0.0';
- foreach ($composerData->packages as $package) {
- if ($package->name !== 'nette/utils') {
+ $composerRaw = FileSystem::read(__DIR__ . '/../../composer.lock');
+
+ /** @var array{ packages: array } $composerData */
+ $composerData = Json::decode($composerRaw, 1);
+
+ $netteUtilsVersion = null;
+
+ foreach ($composerData['packages'] as $package) {
+ if ($package['name'] !== 'nette/utils') {
continue;
}
- $netteUtilsVersion = ltrim($package->version, 'v');
+ $netteUtilsVersion = ltrim($package['version'], 'v');
}
}
$this->container = $container;
- $this->isNewNetteUtils = version_compare($netteUtilsVersion, '4.0.0', '>=');
+ $this->isNewNetteUtils = version_compare($netteUtilsVersion ?? '0.0.0', '4.0.0', '>=');
}
}
diff --git a/tests/Tests/TranslatorTest.phpt b/tests/Tests/TranslatorTest.phpt
index cb0b6bd..fb135bb 100644
--- a/tests/Tests/TranslatorTest.phpt
+++ b/tests/Tests/TranslatorTest.phpt
@@ -339,7 +339,7 @@ final class TranslatorTest extends TestAbstract
$level,
$message,
array $context = []
- )
+ ): void
{
Assert::same(LogLevel::NOTICE, $level);
Assert::same('Missing translation', $message);
diff --git a/tests/Toolkit/Container.php b/tests/Toolkit/Container.php
index fb6c3dd..4cc1171 100644
--- a/tests/Toolkit/Container.php
+++ b/tests/Toolkit/Container.php
@@ -84,13 +84,19 @@ public function withCompiler(callable $cb): Container
public function build(): NetteContainer
{
$loader = new ContainerLoader(Tests::TEMP_PATH, true);
+
+ /** @var class-string $class */
$class = $loader->load(function (Compiler $compiler): void {
foreach ($this->onCompile as $cb) {
$cb($compiler);
}
}, $this->key);
- return new $class();
+ $container = new $class();
+
+ assert($container instanceof NetteContainer);
+
+ return $container;
}
}
diff --git a/tests/Toolkit/Helpers.php b/tests/Toolkit/Helpers.php
index ab0f084..193fe56 100644
--- a/tests/Toolkit/Helpers.php
+++ b/tests/Toolkit/Helpers.php
@@ -22,11 +22,19 @@ public static function createConfiguration(?callable $callback = null): Configur
{
$container = Container::of()
->withDefaults()
- ->withCompiler(function (Compiler $compiler) use ($callback): void {
- if ($callback) {
+ ->withCompiler(
+ static function (
+ Compiler $compiler
+ ) use (
+ $callback
+ ): void {
+ if ($callback === null) {
+ return;
+ }
+
$callback($compiler);
}
- })
+ )
->build();
return $container->getByType(Configuration::class);
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 27864fd..a3702b6 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -2,7 +2,7 @@
require __DIR__ . '/../vendor/autoload.php';
-use Nette\Configurator;
+use Nette\Bootstrap\Configurator;
use Tester\Environment;
Environment::setup();