Skip to content

Commit 1c0f579

Browse files
authored
Merge pull request #1008 from mcg-web/support-symfony-6-and-stable-graphql-php
Support Symfony 6 and stable GraphQL PHP
2 parents 40f4ec7 + a7818db commit 1c0f579

File tree

32 files changed

+144
-135
lines changed

32 files changed

+144
-135
lines changed

.appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ init:
1111

1212
install:
1313
- ps: Set-Service wuauserv -StartupType Manual
14-
- cinst -y php --version=7.4
14+
- cinst -y php --version=8.0
1515
- cinst -y composer
1616
- refreshenv
17-
- cd c:\tools\php74
17+
- cd c:\tools\php80
1818
- copy php.ini-production php.ini /Y
1919
- echo date.timezone="UTC" >> php.ini
2020
- echo extension_dir=ext >> php.ini

.github/workflows/ci.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,23 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
php-version:
20-
- '7.4'
2120
- '8.0'
2221
- '8.1'
2322
symfony-version:
24-
- '4.4.*'
25-
- '5.3.*'
2623
- '5.4.*'
24+
- '6.0.*'
2725
dependencies:
2826
- 'lowest'
2927
- 'highest'
3028
remove-dependencies: [ '' ]
3129
coverage: [ 'none' ]
3230
include:
3331
- php-version: '8.0'
34-
symfony-version: '5.3.*'
32+
symfony-version: '5.4.*'
3533
dependencies: 'lowest'
3634
remove-dependencies: '--dev symfony/validator doctrine/orm doctrine/annotations'
3735
- php-version: '8.0'
38-
symfony-version: '5.3.*'
36+
symfony-version: '5.4.*'
3937
dependencies: 'lowest'
4038
coverage: "pcov"
4139
steps:
@@ -89,7 +87,7 @@ jobs:
8987
uses: "shivammathur/setup-php@v2"
9088
with:
9189
tools: flex
92-
php-version: "7.4"
90+
php-version: "8.0"
9391

9492
- name: "Install dependencies"
9593
uses: ramsey/[email protected]
@@ -107,7 +105,7 @@ jobs:
107105
- name: "Install PHP"
108106
uses: "shivammathur/setup-php@v2"
109107
with:
110-
php-version: "7.4"
108+
php-version: "8.0"
111109

112110
- name: "Install dependencies"
113111
uses: ramsey/[email protected]

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ phpunit.xml
55
/bin
66
composer.lock
77
composer.phar
8-
.php_cs.cache
9-
.php_cs
10-
.phpunit.result.cache
8+
/.php-cs-fixer.php
9+
/*.cache
1110

1211
phpbench.phar
1312
phpbench.phar.*

.php_cs.dist renamed to .php-cs-fixer.dist.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,37 @@
66
->in([__DIR__.'/src', __DIR__.'/tests'])
77
;
88

9-
return PhpCsFixer\Config::create()
9+
return (new PhpCsFixer\Config())
1010
->setRules(
1111
[
1212
'@Symfony' => true,
13-
'@PHP74Migration' => true,
14-
'@PHP74Migration:risky' => true,
13+
'@PHP80Migration' => true,
14+
'@PHP80Migration:risky' => true,
1515
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
16-
'general_phpdoc_annotation_remove' => ['author', 'category', 'copyright', 'created', 'license', 'package', 'since', 'subpackage', 'version'],
16+
'general_phpdoc_annotation_remove' => [
17+
'annotations' => [
18+
'author',
19+
'category',
20+
'copyright',
21+
'created',
22+
'license',
23+
'package',
24+
'since',
25+
'subpackage',
26+
'version',
27+
],
28+
],
1729
'fully_qualified_strict_types' => true,
1830
'single_line_throw' => false,
1931
'phpdoc_to_comment' => false,
2032
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
2133
'global_namespace_import' => ['import_functions' => true, 'import_classes' => true, 'import_constants' => true],
2234
'phpdoc_summary' => false,
23-
'hash_to_slash_comment' => false,
2435
'single_line_comment_style' => false,
25-
'phpdoc_no_alias_tag' => ['type' => 'var'],
36+
'phpdoc_no_alias_tag' => ['replacements' => ['type' => 'var']],
2637
'no_mixed_echo_print' => ['use' => 'echo'],
2738
]
2839
)
2940
->setFinder($finder)
3041
->setUsingCache(true)
31-
;
42+
;

composer.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,21 @@
2525
"sort-packages": true
2626
},
2727
"require": {
28-
"php": ">=7.4",
28+
"php": "^8.0",
2929
"ext-json": "*",
3030
"murtukov/php-code-generator": "^0.1.5",
3131
"phpdocumentor/reflection-docblock": "^5.2",
3232
"phpdocumentor/type-resolver": ">1.4.0,<1.6.0",
3333
"psr/log": "^1.0 || ^2.0 || ^3.0",
34-
"symfony/config": "^4.4.30 || ^5.3.7",
35-
"symfony/dependency-injection": "^4.4.30 || ^5.3.7",
36-
"symfony/event-dispatcher": "^4.4 || ^5.3",
37-
"symfony/expression-language": "^4.4 || ^5.3",
38-
"symfony/framework-bundle": "^4.4.30 || ^5.3.7",
39-
"symfony/http-foundation": "^4.4.30 || ^5.3.7",
40-
"symfony/http-kernel": "^4.4 || ^5.3",
41-
"symfony/options-resolver": "^4.4 || ^5.3",
42-
"symfony/property-access": "^4.4 || ^5.3",
34+
"symfony/config": "^5.4 || ^6.0",
35+
"symfony/dependency-injection": "^5.4 || ^6.0",
36+
"symfony/event-dispatcher": "^5.4 || ^6.0",
37+
"symfony/expression-language": "^5.4 || ^6.0",
38+
"symfony/framework-bundle": "^5.4 || ^6.0",
39+
"symfony/http-foundation": "^5.4 || ^6.0",
40+
"symfony/http-kernel": "^5.4 || ^6.0",
41+
"symfony/options-resolver": "^5.4 || ^6.0",
42+
"symfony/property-access": "^5.4 || ^6.0",
4343
"webonyx/graphql-php": ">=14.5"
4444
},
4545
"suggest": {
@@ -58,36 +58,36 @@
5858
"phpstan/phpstan-symfony": "^0.12.6",
5959
"phpunit/phpunit": "^9.5.10",
6060
"react/promise": "^2.5",
61-
"symfony/asset": "^4.4 || ^5.3",
62-
"symfony/browser-kit": "^4.4 || ^5.3",
63-
"symfony/css-selector": "^4.4 || ^5.3",
64-
"symfony/console": "^4.4.30 || ^5.3",
65-
"symfony/dom-crawler": "^4.4.30 || ^5.3.7",
66-
"symfony/finder": "^4.4.30 || ^5.3.7",
61+
"symfony/asset": "^5.4 || ^6.0",
62+
"symfony/browser-kit": "^5.4 || ^6.0",
63+
"symfony/css-selector": "^5.4 || ^6.0",
64+
"symfony/console": "^5.4 || ^6.0",
65+
"symfony/dom-crawler": "^5.4 || ^6.0",
66+
"symfony/finder": "^5.4 || ^6.0",
6767
"symfony/monolog-bundle": "^3.7",
6868
"symfony/phpunit-bridge": "^6.0",
69-
"symfony/process": "^4.4.30 || ^5.3.7",
70-
"symfony/routing": "^4.4 || ^5.3.7",
71-
"symfony/security-bundle": "^4.4 || ^5.3",
72-
"symfony/validator": "^4.4.30 || ^5.3.7",
73-
"symfony/var-dumper": "^4.4.30 || ^5.3.7",
74-
"symfony/yaml": "^4.4 || ^5.3",
69+
"symfony/process": "^5.4 || ^6.0",
70+
"symfony/routing": "^5.4 || ^6.0",
71+
"symfony/security-bundle": "^5.4 || ^6.0",
72+
"symfony/validator": "^5.4 || ^6.0",
73+
"symfony/var-dumper": "^5.4 || ^6.0",
74+
"symfony/yaml": "^5.4 || ^6.0",
7575
"twig/twig": "^2.10|^3.0"
7676
},
7777
"conflict": {
7878
"react/promise": "<2.8"
7979
},
8080
"extra": {
8181
"branch-alias": {
82-
"dev-master": "0.14-dev"
82+
"dev-master": "0.15-dev"
8383
}
8484
},
8585
"scripts": {
8686
"test": "bin/phpunit --color=always --coverage-clover=build/logs/clover.xml",
8787
"static-analysis": [
8888
"phpstan analyse --ansi --memory-limit=1G"
8989
],
90-
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.18.7/php-cs-fixer.phar -O php-cs-fixer.phar",
90+
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v3.3.2/php-cs-fixer.phar -O php-cs-fixer.phar",
9191
"fix-cs": [
9292
"@install-cs",
9393
"@php php-cs-fixer.phar fix --diff -v --allow-risky=yes --ansi"

phpstan-baseline.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ parameters:
486486
path: tests/Relay/Connection/AbstractConnectionBuilderTest.php
487487

488488
-
489-
message: "#^Parameter \\#1 \\$var of function count expects array\\|Countable, iterable\\<Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\EdgeInterface\\> given\\.$#"
489+
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\<Overblog\\\\GraphQLBundle\\\\Relay\\\\Connection\\\\EdgeInterface\\> given\\.$#"
490490
count: 1
491491
path: tests/Relay/Connection/AbstractConnectionBuilderTest.php
492492

phpunit.xml.dist

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

2626
<php>
2727
<ini name="error_reporting" value="-1" />
28-
<env name="SYMFONY_DEPRECATIONS_HELPER" value="999999" />
28+
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=999999" />
2929
<env name="USE_EXPERIMENTAL_EXECUTOR" value="0" />
3030
</php>
3131
<listeners>

src/Config/Parser/MetadataParser/TypeGuesser/DoctrineTypeGuesser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private function getAnnotation(Reflector $reflector, string $annotationClass): ?
126126
*/
127127
public function fullyQualifiedClassName(string $className, string $namespace): string
128128
{
129-
if (false === strpos($className, '\\') && $namespace) {
129+
if (!str_contains($className, '\\') && $namespace) {
130130
return $namespace.'\\'.$className;
131131
}
132132

src/Definition/Type/CustomScalarType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class CustomScalarType extends BaseCustomScalarType
1717
{
1818
public function __construct(array $config = [])
1919
{
20-
$config['name'] = $config['name'] ?? uniqid('CustomScalar');
20+
$config['name'] ??= uniqid('CustomScalar');
2121
parent::__construct($config);
2222

23-
$this->config['scalarType'] = $this->config['scalarType'] ?? null;
23+
$this->config['scalarType'] ??= null;
2424
}
2525

2626
/**

src/ExpressionLanguage/ExpressionLanguage.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
use Symfony\Component\ExpressionLanguage\Token;
1212
use function array_merge;
1313
use function strlen;
14-
use function strpos;
1514
use function substr;
1615

17-
class ExpressionLanguage extends BaseExpressionLanguage
16+
final class ExpressionLanguage extends BaseExpressionLanguage
1817
{
1918
// TODO (murtukov): make names conditional
2019
public const KNOWN_NAMES = ['value', 'args', 'context', 'info', 'object', 'validator', 'errors', 'childrenComplexity', 'typeName', 'fieldName'];
@@ -35,10 +34,8 @@ public function getGlobalNames(): array
3534
/**
3635
* @param string|Expression $expression
3736
* @param array $names
38-
*
39-
* @return string
4037
*/
41-
public function compile($expression, $names = [])
38+
public function compile($expression, $names = []): string
4239
{
4340
return parent::compile($expression, array_merge($names, $this->globalNames));
4441
}
@@ -126,7 +123,7 @@ public static function isStringWithTrigger($value): bool
126123
*/
127124
public static function stringHasTrigger(string $maybeExpression): bool
128125
{
129-
return 0 === strpos($maybeExpression, self::EXPRESSION_TRIGGER);
126+
return str_starts_with($maybeExpression, self::EXPRESSION_TRIGGER);
130127
}
131128

132129
/**

0 commit comments

Comments
 (0)