Skip to content

Commit 8afe4c0

Browse files
committed
Update for Graphpinator version 2
1 parent 64842bd commit 8afe4c0

15 files changed

Lines changed: 1197 additions & 596 deletions

.github/workflows/php.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ on:
1313
jobs:
1414
tests:
1515
runs-on: ubuntu-latest
16-
1716
steps:
1817
- uses: actions/checkout@v2
1918

2019
- name: Setup PHP
2120
uses: shivammathur/setup-php@v2
2221
with:
23-
php-version: '8.3'
22+
php-version: '8.5'
2423
ini-values: zend.assertions=1, assert.exception=1
2524
coverage: xdebug
2625
env:
@@ -43,14 +42,13 @@ jobs:
4342
mutation:
4443
runs-on: ubuntu-latest
4544
needs: [tests]
46-
4745
steps:
4846
- uses: actions/checkout@v2
4947

5048
- name: Setup PHP
5149
uses: shivammathur/setup-php@v2
5250
with:
53-
php-version: '8.3'
51+
php-version: '8.5'
5452
ini-values: zend.assertions=1, assert.exception=1
5553
coverage: xdebug
5654
env:
@@ -67,14 +65,13 @@ jobs:
6765

6866
phpstan:
6967
runs-on: ubuntu-latest
70-
7168
steps:
7269
- uses: actions/checkout@v2
7370

7471
- name: Setup PHP
7572
uses: shivammathur/setup-php@v2
7673
with:
77-
php-version: '8.3'
74+
php-version: '8.5'
7875
ini-values: zend.assertions=1, assert.exception=1
7976
env:
8077
update: true
@@ -90,14 +87,13 @@ jobs:
9087

9188
codestyle:
9289
runs-on: ubuntu-latest
93-
9490
steps:
9591
- uses: actions/checkout@v2
9692

9793
- name: Setup PHP
9894
uses: shivammathur/setup-php@v2
9995
with:
100-
php-version: '8.3'
96+
php-version: '8.5'
10197
env:
10298
update: true
10399

@@ -108,4 +104,25 @@ jobs:
108104
run: composer install --prefer-dist --no-progress --no-suggest
109105

110106
- name: Codestyle
111-
run: composer run-script codestyle
107+
run: composer run-script codestyle
108+
109+
dependencies:
110+
runs-on: ubuntu-latest
111+
steps:
112+
- uses: actions/checkout@v2
113+
114+
- name: Setup PHP
115+
uses: shivammathur/setup-php@v2
116+
with:
117+
php-version: '8.5'
118+
env:
119+
update: true
120+
121+
- name: Validate composer.json and composer.lock
122+
run: composer validate
123+
124+
- name: Install dependencies
125+
run: composer install --prefer-dist --no-progress --no-suggest
126+
127+
- name: Dependencies
128+
run: composer run-script dependencies

bench/BenchType.php

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44

55
namespace Graphpinator\PersistedQueries\Bench;
66

7-
class BenchType extends \Graphpinator\Typesystem\Type
7+
use Graphpinator\PersistedQueries\Tests\VariableTest;
8+
use Graphpinator\Typesystem\Argument\Argument;
9+
use Graphpinator\Typesystem\Argument\ArgumentSet;
10+
use Graphpinator\Typesystem\Container;
11+
use Graphpinator\Typesystem\Field\ResolvableField;
12+
use Graphpinator\Typesystem\Field\ResolvableFieldSet;
13+
use Graphpinator\Typesystem\Type;
14+
15+
class BenchType extends Type
816
{
917
protected const NAME = 'type';
1018

@@ -13,83 +21,83 @@ public function validateNonNullValue(mixed $rawValue) : bool
1321
return true;
1422
}
1523

16-
protected function getFieldDefinition() : \Graphpinator\Typesystem\Field\ResolvableFieldSet
24+
protected function getFieldDefinition() : ResolvableFieldSet
1725
{
18-
return new \Graphpinator\Typesystem\Field\ResolvableFieldSet([
19-
\Graphpinator\Typesystem\Field\ResolvableField::create(
26+
return new ResolvableFieldSet([
27+
ResolvableField::create(
2028
'fieldArg',
21-
\Graphpinator\Typesystem\Container::Int()->notNull(),
29+
Container::Int()->notNull(),
2230
static function (int $parent, int $arg1) : int {
2331
return 1;
2432
},
25-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
26-
\Graphpinator\Typesystem\Argument\Argument::create('arg1', \Graphpinator\Typesystem\Container::Int())
33+
)->setArguments(new ArgumentSet([
34+
Argument::create('arg1', Container::Int())
2735
->setDefaultValue(123),
2836
])),
29-
\Graphpinator\Typesystem\Field\ResolvableField::create(
37+
ResolvableField::create(
3038
'fieldArg1',
31-
\Graphpinator\Typesystem\Container::Int()->notNull(),
39+
Container::Int()->notNull(),
3240
static function (int $parent, ?int $arg1 = null) : int {
3341
return 1;
3442
},
35-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
36-
\Graphpinator\Typesystem\Argument\Argument::create('arg1', \Graphpinator\Typesystem\Container::Int())
43+
)->setArguments(new ArgumentSet([
44+
Argument::create('arg1', Container::Int())
3745
->setDefaultValue(null),
3846
])),
39-
\Graphpinator\Typesystem\Field\ResolvableField::create(
47+
ResolvableField::create(
4048
'fieldArg2',
41-
\Graphpinator\Typesystem\Container::Int()->notNull(),
49+
Container::Int()->notNull(),
4250
static function (int $parent, ?array $arg1 = null) : int {
4351
return $arg1[0];
4452
},
45-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
46-
\Graphpinator\Typesystem\Argument\Argument::create('arg1', \Graphpinator\Typesystem\Container::Int()->list())
53+
)->setArguments(new ArgumentSet([
54+
Argument::create('arg1', Container::Int()->list())
4755
->setDefaultValue(null),
4856
])),
49-
\Graphpinator\Typesystem\Field\ResolvableField::create(
57+
ResolvableField::create(
5058
'fieldArg3',
51-
\Graphpinator\PersistedQueries\Tests\VariableTest::getSimpleEnum()->notNull(),
59+
VariableTest::getSimpleEnum()->notNull(),
5260
static function ($parent, string $val) : string {
5361
return $val;
5462
},
55-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
56-
new \Graphpinator\Typesystem\Argument\Argument(
63+
)->setArguments(new ArgumentSet([
64+
new Argument(
5765
'val',
58-
\Graphpinator\PersistedQueries\Tests\VariableTest::getSimpleEnum()->notNull(),
66+
VariableTest::getSimpleEnum()->notNull(),
5967
),
6068
])),
61-
\Graphpinator\Typesystem\Field\ResolvableField::create(
69+
ResolvableField::create(
6270
'fieldArg4',
63-
\Graphpinator\Typesystem\Container::Int()->notNull(),
71+
Container::Int()->notNull(),
6472
static function ($parent, \stdClass $val) : int {
6573
return $val->number;
6674
},
67-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
68-
new \Graphpinator\Typesystem\Argument\Argument(
75+
)->setArguments(new ArgumentSet([
76+
new Argument(
6977
'val',
70-
\Graphpinator\PersistedQueries\Tests\VariableTest::getSimpleInput()->notNull(),
78+
VariableTest::getSimpleInput()->notNull(),
7179
),
7280
])),
73-
\Graphpinator\Typesystem\Field\ResolvableField::create(
81+
ResolvableField::create(
7482
'fieldArg5',
75-
\Graphpinator\Typesystem\Container::String()->notNull(),
83+
Container::String()->notNull(),
7684
static function (int $parent, string $arg1) : string {
7785
return $arg1;
7886
},
79-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
80-
\Graphpinator\Typesystem\Argument\Argument::create('arg1', \Graphpinator\Typesystem\Container::String()->notNull())
87+
)->setArguments(new ArgumentSet([
88+
Argument::create('arg1', Container::String()->notNull())
8189
->setDefaultValue('abc'),
8290
])),
83-
\Graphpinator\Typesystem\Field\ResolvableField::create(
91+
ResolvableField::create(
8492
'fieldArg6',
85-
\Graphpinator\Typesystem\Container::String()->notNull(),
93+
Container::String()->notNull(),
8694
static function (int $parent, ?string $arg1, ?int $arg2, ?bool $arg3) : string {
8795
return 'abc';
8896
},
89-
)->setArguments(new \Graphpinator\Typesystem\Argument\ArgumentSet([
90-
\Graphpinator\Typesystem\Argument\Argument::create('arg1', \Graphpinator\Typesystem\Container::String()),
91-
\Graphpinator\Typesystem\Argument\Argument::create('arg2', \Graphpinator\Typesystem\Container::Int()),
92-
\Graphpinator\Typesystem\Argument\Argument::create('arg3', \Graphpinator\Typesystem\Container::Boolean()),
97+
)->setArguments(new ArgumentSet([
98+
Argument::create('arg1', Container::String()),
99+
Argument::create('arg2', Container::Int()),
100+
Argument::create('arg3', Container::Boolean()),
93101
])),
94102
]);
95103
}

bench/RedisCache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
namespace Graphpinator\PersistedQueries\Bench;
66

7-
class RedisCache implements \Psr\SimpleCache\CacheInterface {
7+
use Psr\SimpleCache\CacheInterface;
8+
9+
class RedisCache implements CacheInterface {
810

911
protected \Redis $redis;
1012

composer.json

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@
1313
],
1414
"require": {
1515
"php": ">=8.1",
16-
"infinityloop-dev/graphpinator": "^1.6",
16+
"infinityloop-dev/graphpinator": "^2.0",
1717
"infinityloop-dev/utils": "^2.3",
18-
"psr/simple-cache": "^3.0.0"
18+
"psr/simple-cache": "^3.0.0",
19+
"infinityloop-dev/graphpinator-parser": "^2.0"
1920
},
2021
"require-dev": {
2122
"phpunit/phpunit": "^11.4",
2223
"infection/infection": "^0.29",
24+
"phpstan/extension-installer": "^1.4",
2325
"phpstan/phpstan": "^2.0",
26+
"phpstan/phpstan-deprecation-rules": "^2.0",
27+
"phpstan/phpstan-strict-rules": "^2.0",
28+
"shipmonk/composer-dependency-analyser": "^1.8",
29+
"thecodingmachine/phpstan-safe-rule": "^1.4",
2430
"webthinx/codestyle": "^v1.0"
2531
},
2632
"scripts": {
@@ -29,11 +35,12 @@
2935
"Composer\\Config::disableProcessTimeout",
3036
"infection -j$(nproc)"
3137
],
32-
"phpstan": "phpstan analyze --level 3 src",
33-
"phpstan-next": "phpstan analyze --level 4 src",
38+
"phpstan": "phpstan analyze --level 4 src",
39+
"phpstan-next": "phpstan analyze --level 5 src",
3440
"phpstan-max": "phpstan analyze --level max src",
35-
"codestyle": "phpcs --standard=vendor/webthinx/codestyle/phpcs.xml --extensions=php src tests",
36-
"codestyle-fix": "phpcbf --standard=vendor/webthinx/codestyle/phpcs.xml --extensions=php src tests"
41+
"codestyle": "phpcs --extensions=php src tests",
42+
"codestyle-fix": "phpcbf --extensions=php src tests",
43+
"dependencies": "composer-dependency-analyser"
3744
},
3845
"autoload": {
3946
"psr-4": {
@@ -46,10 +53,12 @@
4653
"Graphpinator\\PersistedQueries\\Bench\\": "bench/"
4754
}
4855
},
56+
"minimum-stability": "rc",
4957
"config": {
5058
"allow-plugins": {
5159
"dealerdirect/phpcodesniffer-composer-installer": true,
52-
"infection/extension-installer": true
60+
"infection/extension-installer": true,
61+
"phpstan/extension-installer": true
5362
}
5463
}
5564
}

0 commit comments

Comments
 (0)