Skip to content

Commit 0a002e4

Browse files
authored
Merge remote-tracking branch 'origin/master' into dependabot-composer-doctrine-coding-standard-tw-13.0or-tw-14.0
2 parents aa6e837 + 560339d commit 0a002e4

6 files changed

Lines changed: 19 additions & 14 deletions

File tree

.github/workflows/continuous_integration.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
path: "build"
8484
overwrite: true
8585

86-
- uses: codecov/codecov-action@v6.0.0 # upload the coverage to codecov
86+
- uses: codecov/codecov-action@v7.0.0 # upload the coverage to codecov
8787
with:
8888
fail_ci_if_error: false # optional (default = false) - Need CODECOV_TOKEN
8989
# Do not upload in forks, and only on php8.4, latest deps

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
}
1111
],
1212
"require": {
13+
"composer-runtime-api": "^2.0",
1314
"php": ">=8.2",
1415
"ext-json": "*",
15-
"composer/package-versions-deprecated": "^1.8",
1616
"phpdocumentor/reflection-docblock": "^5.4",
1717
"phpdocumentor/type-resolver": "^1.7",
1818
"psr/container": "^1.1 || ^2",
@@ -64,7 +64,6 @@
6464
},
6565
"config": {
6666
"allow-plugins": {
67-
"composer/package-versions-deprecated": true,
6867
"dealerdirect/phpcodesniffer-composer-installer": true,
6968
"phpstan/extension-installer": true
7069
},

examples/no-framework/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"require": {
88
"thecodingmachine/graphqlite": "@dev",
99
"mouf/picotainer": "^1.1",
10-
"symfony/cache": "^4.3",
11-
"psr/simple-cache": "^1.0"
10+
"symfony/cache": "^7.4",
11+
"psr/simple-cache": "^3.0"
1212
},
1313
"repositories": [
1414
{

src/Http/Psr15GraphQLMiddlewareBuilder.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
use DateInterval;
88
use GraphQL\Error\DebugFlag;
9+
use GraphQL\Language\AST\DocumentNode;
10+
use GraphQL\Server\OperationParams;
911
use GraphQL\Server\ServerConfig;
1012
use GraphQL\Type\Schema;
1113
use GraphQL\Validator\DocumentValidator;
@@ -133,13 +135,17 @@ public function createMiddleware(): MiddlewareInterface
133135
// So if we only added given rule, all of the default rules would not be validated, so we must also provide them.
134136
$originalValidationRules = $this->config->getValidationRules() ?? DocumentValidator::allRules();
135137

136-
$this->config->setValidationRules(function (...$args) use ($originalValidationRules) {
137-
if (is_callable($originalValidationRules)) {
138-
$originalValidationRules = $originalValidationRules(...$args);
139-
}
138+
$this->config->setValidationRules(function (
139+
OperationParams $operation,
140+
DocumentNode $doc,
141+
string $operationType,
142+
) use ($originalValidationRules): array {
143+
$validationRules = is_callable($originalValidationRules)
144+
? $originalValidationRules($operation, $doc, $operationType)
145+
: $originalValidationRules;
140146

141147
return [
142-
...$originalValidationRules,
148+
...$validationRules,
143149
...$this->addedValidationRules,
144150
];
145151
});

src/SchemaFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace TheCodingMachine\GraphQLite;
66

7+
use Composer\InstalledVersions;
78
use GraphQL\Type\SchemaConfig;
89
use Kcs\ClassFinder\FileFinder\CachedFileFinder;
910
use Kcs\ClassFinder\FileFinder\DefaultFileFinder;
1011
use Kcs\ClassFinder\Finder\ComposerFinder;
1112
use Kcs\ClassFinder\Finder\FinderInterface;
12-
use PackageVersions\Versions;
1313
use Psr\Container\ContainerInterface;
1414
use Psr\SimpleCache\CacheInterface;
1515
use Symfony\Component\Cache\Adapter\ArrayAdapter;
@@ -141,7 +141,7 @@ public function __construct(
141141
private readonly ContainerInterface $container,
142142
private ClassBoundCache|null $classBoundCache = null,
143143
) {
144-
$this->cacheNamespace = substr(md5(Versions::getVersion('thecodingmachine/graphqlite')), 0, 8);
144+
$this->cacheNamespace = substr(md5(InstalledVersions::getVersion('thecodingmachine/graphqlite') ?? ''), 0, 8);
145145
}
146146

147147
/**

src/Utils/NamespacedCache.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
namespace TheCodingMachine\GraphQLite\Utils;
66

7+
use Composer\InstalledVersions;
78
use DateInterval;
8-
use PackageVersions\Versions;
99
use Psr\SimpleCache\CacheInterface;
1010
use Psr\SimpleCache\InvalidArgumentException;
1111
use function md5;
@@ -22,7 +22,7 @@ class NamespacedCache implements CacheInterface
2222

2323
public function __construct(private readonly CacheInterface $cache)
2424
{
25-
$this->namespace = substr(md5(Versions::getVersion('thecodingmachine/graphqlite')), 0, 8);
25+
$this->namespace = substr(md5(InstalledVersions::getVersion('thecodingmachine/graphqlite') ?? ''), 0, 8);
2626
}
2727

2828
/**

0 commit comments

Comments
 (0)