Skip to content

Commit

Permalink
composer update (#126)
Browse files Browse the repository at this point in the history
* composer update

* fix

* logger mock

* logger test fix

* allow php 8.2 and 8.3 in CI

* Update ruleset.xml
  • Loading branch information
aleswita committed Jan 26, 2024
1 parent cf6fc53 commit ae4ff4e
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,32 @@
],
"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",
"nette/neon": "^3.3.1",
"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": {
Expand Down
3 changes: 3 additions & 0 deletions ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousSuffix" />
<exclude name="SlevomatCodingStandard.Classes.SuperfluousInterfaceNaming.SuperfluousSuffix" />
<exclude name="SlevomatCodingStandard.Classes.RequireMultiLineMethodSignature.RequiredMultiLineSignature" />
<exclude name="Generic.WhiteSpace.ScopeIndent" /><!-- error: Property "spaceIndent" does not exist on sniff Generic.WhiteSpace.ScopeIndent -->
<exclude name="SlevomatCodingStandard.TypeHints.DeclareStrictTypes" /><!-- error: Property "newlinesCountBetweenOpenTagAndDeclare" does not exist on sniff SlevomatCodingStandard.TypeHints.DeclareStrictTypes -->
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing" /><!-- error: Property "tokensToCheck" does not exist on sniff SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing -->
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation">
<exclude name="SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName" />
Expand Down
4 changes: 2 additions & 2 deletions src/Latte/TranslatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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'),
[
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/Tests/PsrLoggerMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function log(
$level,
$message,
array $context = []
)
): void
{
}

Expand Down
23 changes: 15 additions & 8 deletions tests/Tests/TestAbstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<array{ name: string, version: string }> } $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', '>=');
}

}
2 changes: 1 addition & 1 deletion tests/Tests/TranslatorTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ final class TranslatorTest extends TestAbstract
$level,
$message,
array $context = []
)
): void
{
Assert::same(LogLevel::NOTICE, $level);
Assert::same('Missing translation', $message);
Expand Down
8 changes: 7 additions & 1 deletion tests/Toolkit/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

}
14 changes: 11 additions & 3 deletions tests/Toolkit/Helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

use Nette\Configurator;
use Nette\Bootstrap\Configurator;
use Tester\Environment;

Environment::setup();
Expand Down

0 comments on commit ae4ff4e

Please sign in to comment.