Skip to content

Commit ae4ff4e

Browse files
authored
composer update (#126)
* composer update * fix * logger mock * logger test fix * allow php 8.2 and 8.3 in CI * Update ruleset.xml
1 parent cf6fc53 commit ae4ff4e

File tree

11 files changed

+49
-25
lines changed

11 files changed

+49
-25
lines changed

.github/workflows/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ jobs:
149149

150150
strategy:
151151
matrix:
152-
php-version: [ "8.0", "8.1" ]
152+
php-version: [ "8.0", "8.1", "8.2", "8.3" ]
153153
operating-system: [ "ubuntu-latest" ]
154154
composer-args: [ "" ]
155155
include:

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@
1616
],
1717
"require": {
1818
"php": "^8.0.2",
19-
"latte/latte": "^2.6|^3.0",
19+
"latte/latte": "^2.6|^3.0.12",
2020
"nette/di": "^3.0.6",
2121
"nette/finder": "^2.5.2|~3.0.0",
2222
"nette/http": "^3.0.7",
2323
"nette/neon": "^3.3.1",
2424
"nette/schema": "^1.0",
2525
"nette/routing": "^3.0",
2626
"nette/utils": "^3.2.1|~4.0.0",
27-
"symfony/translation": "^6.0",
28-
"symfony/config": "^6.0"
27+
"symfony/translation": "^6.0|^7.0",
28+
"symfony/config": "^6.0|^7.0"
2929
},
3030
"require-dev": {
3131
"doctrine/orm": "^2.8",
3232
"mockery/mockery": "^1.4",
3333
"nette/application": "^3.1.0",
34-
"nette/bootstrap": "^3.0",
34+
"nette/bootstrap": "^3.2.1",
3535
"nette/database": "^3.1.1",
3636
"nette/robot-loader": "^3.4.0|~4.0.0",
3737
"nette/tester": "^2.3.1",
38-
"ninjify/nunjuck": "^0.3.0",
38+
"ninjify/nunjuck": "^0.4.0",
3939
"ninjify/qa": "^0.13",
4040
"phpstan/phpstan": "^1.8",
4141
"phpstan/phpstan-deprecation-rules": "^1.0",
4242
"phpstan/phpstan-nette": "^1.0",
4343
"phpstan/phpstan-strict-rules": "^1.1",
44-
"psr/log": "^1.1",
44+
"psr/log": "^1.1|^2.0|^3.0",
4545
"tracy/tracy": "^2.8"
4646
},
4747
"autoload": {

ruleset.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousSuffix" />
55
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix" />
66
<exclude name="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature.RequiredMultiLineSignature" />
7+
<exclude name="Generic.WhiteSpace.ScopeIndent" /><!-- error: Property "spaceIndent" does not exist on sniff Generic.WhiteSpace.ScopeIndent -->
8+
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" /><!-- error: Property "newlinesCountBetweenOpenTagAndDeclare" does not exist on sniff SlevomatCodingStandard.TypeHints.DeclareStrictTypes -->
9+
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing" /><!-- error: Property "tokensToCheck" does not exist on sniff SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing -->
710
</rule>
811
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation">
912
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />

src/Latte/TranslatorExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Latte\Compiler\Nodes\Php\ArgumentNode;
1010
use Latte\Compiler\Nodes\Php\Expression\ArrayNode;
1111
use Latte\Compiler\Nodes\Php\Expression\BinaryOpNode;
12-
use Latte\Compiler\Nodes\Php\Expression\StaticCallNode;
12+
use Latte\Compiler\Nodes\Php\Expression\StaticMethodCallNode;
1313
use Latte\Compiler\Nodes\Php\Expression\VariableNode;
1414
use Latte\Compiler\Nodes\Php\FilterNode;
1515
use Latte\Compiler\Nodes\Php\IdentifierNode;
@@ -70,7 +70,7 @@ public function parseTranslate(
7070

7171
$prefixProp = Helpers::createLatteProperty('Prefix');
7272

73-
$messageNode = new StaticCallNode(
73+
$messageNode = new StaticMethodCallNode(
7474
new NameNode('\Contributte\Translation\Helpers', NameNode::KindFullyQualified),
7575
new IdentifierNode('prefixMessage'),
7676
[

tests/Tests/Helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace Tests;
44

55
use Contributte\Translation\DI\TranslationExtension;
6-
use Nette\Configurator;
6+
use Nette\Bootstrap\Configurator;
77
use Nette\DI\Container;
88

99
final class Helpers

tests/Tests/PsrLoggerMock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function log(
1414
$level,
1515
$message,
1616
array $context = []
17-
)
17+
): void
1818
{
1919
}
2020

tests/Tests/TestAbstract.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
namespace Tests;
44

5+
use Composer\InstalledVersions;
56
use Nette\DI\Container;
7+
use Nette\Utils\FileSystem;
8+
use Nette\Utils\Json;
69
use Tester\TestCase;
710

811
abstract class TestAbstract extends TestCase
@@ -17,22 +20,26 @@ public function __construct(
1720
)
1821
{
1922
if (class_exists('\Composer\InstalledVersions')) { // Composer 2
20-
$netteUtilsVersion = \Composer\InstalledVersions::getPrettyVersion('nette/utils');
23+
$netteUtilsVersion = InstalledVersions::getPrettyVersion('nette/utils');
2124
} else { // Composer 1
22-
$composerRaw = \Nette\Utils\FileSystem::read(__DIR__ . '/../../composer.lock');
23-
$composerData = \Nette\Utils\Json::decode($composerRaw);
24-
$netteUtilsVersion = '0.0.0';
25-
foreach ($composerData->packages as $package) {
26-
if ($package->name !== 'nette/utils') {
25+
$composerRaw = FileSystem::read(__DIR__ . '/../../composer.lock');
26+
27+
/** @var array{ packages: array<array{ name: string, version: string }> } $composerData */
28+
$composerData = Json::decode($composerRaw, 1);
29+
30+
$netteUtilsVersion = null;
31+
32+
foreach ($composerData['packages'] as $package) {
33+
if ($package['name'] !== 'nette/utils') {
2734
continue;
2835
}
2936

30-
$netteUtilsVersion = ltrim($package->version, 'v');
37+
$netteUtilsVersion = ltrim($package['version'], 'v');
3138
}
3239
}
3340

3441
$this->container = $container;
35-
$this->isNewNetteUtils = version_compare($netteUtilsVersion, '4.0.0', '>=');
42+
$this->isNewNetteUtils = version_compare($netteUtilsVersion ?? '0.0.0', '4.0.0', '>=');
3643
}
3744

3845
}

tests/Tests/TranslatorTest.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ final class TranslatorTest extends TestAbstract
339339
$level,
340340
$message,
341341
array $context = []
342-
)
342+
): void
343343
{
344344
Assert::same(LogLevel::NOTICE, $level);
345345
Assert::same('Missing translation', $message);

tests/Toolkit/Container.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,19 @@ public function withCompiler(callable $cb): Container
8484
public function build(): NetteContainer
8585
{
8686
$loader = new ContainerLoader(Tests::TEMP_PATH, true);
87+
88+
/** @var class-string $class */
8789
$class = $loader->load(function (Compiler $compiler): void {
8890
foreach ($this->onCompile as $cb) {
8991
$cb($compiler);
9092
}
9193
}, $this->key);
9294

93-
return new $class();
95+
$container = new $class();
96+
97+
assert($container instanceof NetteContainer);
98+
99+
return $container;
94100
}
95101

96102
}

tests/Toolkit/Helpers.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ public static function createConfiguration(?callable $callback = null): Configur
2222
{
2323
$container = Container::of()
2424
->withDefaults()
25-
->withCompiler(function (Compiler $compiler) use ($callback): void {
26-
if ($callback) {
25+
->withCompiler(
26+
static function (
27+
Compiler $compiler
28+
) use (
29+
$callback
30+
): void {
31+
if ($callback === null) {
32+
return;
33+
}
34+
2735
$callback($compiler);
2836
}
29-
})
37+
)
3038
->build();
3139

3240
return $container->getByType(Configuration::class);

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require __DIR__ . '/../vendor/autoload.php';
44

5-
use Nette\Configurator;
5+
use Nette\Bootstrap\Configurator;
66
use Tester\Environment;
77

88
Environment::setup();

0 commit comments

Comments
 (0)