Skip to content

Commit 68b83fa

Browse files
authored
Merge branch 'master' into mo-olsavmic-patch-1
2 parents a261198 + 2d5692c commit 68b83fa

File tree

418 files changed

+8263
-9828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

418 files changed

+8263
-9828
lines changed

.php_cs.dist

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,13 @@ return PhpCsFixer\Config::create()
1010
->setRules(
1111
[
1212
'@Symfony' => true,
13-
'@PHP71Migration' => true,
14-
'@PHP71Migration:risky' => true,
15-
'single_blank_line_before_namespace' => true,
16-
'ordered_imports' => true,
17-
'concat_space' => ['spacing' => 'none'],
18-
'phpdoc_no_alias_tag' => ['type' => 'var'],
19-
'no_mixed_echo_print' => ['use' => 'echo'],
20-
'binary_operator_spaces' => ['align_double_arrow' => false, 'align_equals' => false],
13+
'ordered_imports' => ['imports_order' => ['class', 'function', 'const']],
2114
'general_phpdoc_annotation_remove' => ['author', 'category', 'copyright', 'created', 'license', 'package', 'since', 'subpackage', 'version'],
22-
'native_function_invocation' => true,
2315
'fully_qualified_strict_types' => true,
16+
'single_line_throw' => false,
17+
'phpdoc_to_comment' => false,
18+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
19+
'global_namespace_import' => ['import_functions' => true, 'import_classes' => true, 'import_constants' => true],
2420
]
2521
)
2622
->setFinder($finder)

.travis.yml

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ before_install:
2222
- if [ "${SYMFONY_VERSION}" != "" ]; then perl -pi -e 's#"(symfony/.*)":\s*".*"#"$1":"'"${SYMFONY_VERSION}"'"#' composer.json; fi;
2323
- if [ "${PHPUNIT_VERSION}" != "" ]; then composer req "phpunit/phpunit:${PHPUNIT_VERSION}" --dev --no-update; fi;
2424
- if [ "${VALIDATOR}" = "0" ]; then composer remove "symfony/validator" --dev --no-update; fi;
25-
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || echo "xdebug not available"
2625
- composer selfupdate
2726
- if [ $GRAPHQLPHP_VERSION ]; then composer require "webonyx/graphql-php:${GRAPHQLPHP_VERSION}" --dev --no-update; fi;
2827

@@ -32,45 +31,41 @@ script: composer test
3231

3332
jobs:
3433
include:
35-
- php: 7.2
36-
env: SYMFONY_VERSION=4.3.* PHPUNIT_VERSION=^7.2
37-
- php: 7.3
38-
env: SYMFONY_VERSION=4.3.* VALIDATOR=0
39-
- php: 7.3
40-
env: SYMFONY_VERSION=4.3.* USE_EXPERIMENTAL_EXECUTOR=1
41-
- php: 7.3
42-
env: SYMFONY_VERSION=4.4.* SYMFONY_DEPRECATIONS_HELPER=max[total]=0
43-
- php: 7.3
44-
env: SYMFONY_VERSION=5.0.* SYMFONY_DEPRECATIONS_HELPER=max[total]=0
45-
- php: 7.4snapshot
46-
env: SYMFONY_VERSION=4.3.*
34+
- php: 7.4
35+
env: SYMFONY_VERSION=4.4.*
36+
37+
- php: 7.4
38+
env: SYMFONY_VERSION=5.0.*
39+
40+
- php: 7.4
41+
env: SYMFONY_VERSION=5.1.*
42+
4743
- php: nightly
4844
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
4945

5046
- stage: Code Quality
51-
php: 7.2
47+
php: 7.4
5248
env: COVERAGE SYMFONY_VERSION=4.4.*
5349
before_script:
54-
- mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{.disabled,}
55-
- if [[ ! $(php -m | grep -si xdebug) ]]; then echo "xdebug required for coverage"; exit 1; fi
56-
script: bin/phpunit --color=always -v --debug -d xdebug.max_nesting_level=1000 --coverage-clover=build/logs/clover.xml
50+
- pecl install pcov
51+
script: php -dpcov.enabled=1 bin/phpunit --color=always -v --debug --coverage-clover=build/logs/clover.xml
5752
after_script:
58-
- wget https://scrutinizer-ci.com/ocular.phar && travis_retry php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
59-
- composer require "satooshi/php-coveralls:^1.0" && travis_retry php bin/coveralls -v
53+
- wget https://scrutinizer-ci.com/ocular.phar && travis_retry php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
54+
- composer require "satooshi/php-coveralls:^1.0" && travis_retry php bin/coveralls -v
6055

6156
- stage: Code Quality
62-
php: 7.2
63-
env: STATIC_ANALYSIS SYMFONY_VERSION=4.3.*
57+
php: 7.4
58+
env: STATIC_ANALYSIS SYMFONY_VERSION=4.4.*
6459
install: travis_retry composer install --prefer-dist
6560
script: composer static-analysis
6661

6762
- stage: Code Quality
68-
php: 7.2
63+
php: 7.4
6964
env: CODING_STANDARDS
7065
script: composer check-cs
7166

7267
- stage: Code Quality
73-
php: 7.2
68+
php: 7.4
7469
env: BENCHMARK
7570
script: composer bench
7671

Dockerfile

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,38 @@ COPY composer.json /
55
FROM scratch AS test_source
66

77
COPY benchmarks/ benchmarks/
8-
COPY lib/ /lib/
98
COPY src/ /src/
109
COPY tests/ /tests/
1110
COPY phpunit.xml.* phpstan.neon.* .php_cs.* phpbench.json /
1211

1312
FROM alpine:3.9
1413

14+
ADD https://dl.bintray.com/php-alpine/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub
15+
16+
RUN apk --update add ca-certificates && \
17+
echo "https://dl.bintray.com/php-alpine/v3.9/php-7.4" >> /etc/apk/repositories
18+
1519
# alpine php package does not include default extensions, be explicit
1620
RUN set -eu; \
1721
apk add --no-cache \
18-
php7 \
19-
php7-iconv \
20-
php7-json \
21-
php7-mbstring \
22-
php7-openssl \
23-
php7-phar \
24-
php7-tokenizer \
25-
php7-xml \
26-
php7-xmlwriter \
27-
php7-dom \
28-
php7-pdo \
29-
;
22+
php \
23+
php-iconv \
24+
php-json \
25+
php-mbstring \
26+
php-openssl \
27+
php-phar \
28+
php-xml \
29+
php-dom \
30+
php-pdo \
31+
; ln -s /usr/bin/php7 /usr/bin/php
3032

3133
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
3234

3335
WORKDIR /opt/test
3436

3537
COPY --from=composer_install_requirements / .
3638

37-
RUN composer install
39+
RUN php7 /usr/bin/composer install
3840

3941
COPY --from=test_source / .
4042

README.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
OverblogGraphQLBundle
22
======================
33

4-
[![Build Status](https://travis-ci.org/overblog/GraphQLBundle.svg?branch=master)](https://travis-ci.org/overblog/GraphQLBundle)
5-
[![Build status](https://ci.appveyor.com/api/projects/status/7ksxlcgwt40q74hv/branch/master?svg=true)](https://ci.appveyor.com/project/overblog/graphqlbundle/branch/master)
6-
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/overblog/GraphQLBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/overblog/GraphQLBundle/?branch=master)
7-
[![Coverage Status](https://coveralls.io/repos/github/overblog/GraphQLBundle/badge.svg?branch=master)](https://coveralls.io/github/overblog/GraphQLBundle?branch=master)
4+
[![Build Status](https://travis-ci.org/overblog/GraphQLBundle.svg?branch=0.13)](https://travis-ci.org/overblog/GraphQLBundle)
5+
[![Build status](https://ci.appveyor.com/api/projects/status/7ksxlcgwt40q74hv/branch/0.13?svg=true)](https://ci.appveyor.com/project/overblog/graphqlbundle/branch/0.13)
6+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/overblog/GraphQLBundle/badges/quality-score.png?b=0.13)](https://scrutinizer-ci.com/g/overblog/GraphQLBundle/?branch=0.13)
7+
[![Coverage Status](https://coveralls.io/repos/github/overblog/GraphQLBundle/badge.svg?branch=0.13)](https://coveralls.io/github/overblog/GraphQLBundle?branch=0.13)
88
[![Latest Stable Version](https://poser.pugx.org/overblog/graphql-bundle/version)](https://packagist.org/packages/overblog/graphql-bundle)
99
[![Latest Unstable Version](https://poser.pugx.org/overblog/graphql-bundle/v/unstable)](https://packagist.org/packages/overblog/graphql-bundle)
1010
[![Total Downloads](https://poser.pugx.org/overblog/graphql-bundle/downloads)](https://packagist.org/packages/overblog/graphql-bundle)
@@ -18,12 +18,13 @@ It also supports:
1818

1919
Browse your version documentation:
2020

21-
* [0.8 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.8/README.md)
22-
* [0.9 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.9/README.md)
23-
* [0.10 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.10/README.md)
24-
* [0.11 (STABLE)](https://github.com/overblog/GraphQLBundle/blob/0.11/README.md)
21+
* [1.0 (DEV)](https://github.com/overblog/GraphQLBundle/blob/master/README.md)
22+
* [0.13 (STABLE)](https://github.com/overblog/GraphQLBundle/blob/0.13/README.md)
2523
* [0.12 (STABLE)](https://github.com/overblog/GraphQLBundle/blob/0.12/README.md)
26-
* [0.13 (DEV)](https://github.com/overblog/GraphQLBundle/blob/master/README.md)
24+
* [0.11 (STABLE)](https://github.com/overblog/GraphQLBundle/blob/0.11/README.md)
25+
* [0.10 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.10/README.md)
26+
* [0.9 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.9/README.md)
27+
* [0.8 (OBSOLETE)](https://github.com/overblog/GraphQLBundle/blob/0.8/README.md)
2728

2829
[Versions requirements](docs/index.md#versions-requirements)
2930

@@ -88,6 +89,7 @@ Documentation
8889
- [Disable introspection](docs/security/disable_introspection.md)
8990
- [Errors handling](docs/error-handling/index.md)
9091
- [Events](docs/events/index.md)
92+
- [Profiler](docs/profiler/index.md)
9193

9294
Talks and slides to help you start
9395
----------------------------------
@@ -109,8 +111,9 @@ Talks and slides to help you start
109111
Community
110112
---------
111113

112-
* Get some support on [Symfony devs Slack](https://symfony.com/slack-invite)
114+
* Get support on [Symfony devs Slack](https://symfony.com/slack-invite)
113115
on the dedicated channel **overblog-graphql**.
116+
* Get support in Telegram group [Overblog GraphQL](https://t.me/overblog_graphql)
114117
* Follow us on [GitHub](https://github.com/overblog)
115118

116119
Contributing

UPGRADE-1.0.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
UPGRADE FROM 0.13 to 1.0
2+
=======================
3+
4+
# Table of Contents
5+
6+
- [Customize the cursor encoder of the edges of a connection](#customize-the-cursor-encoder-of-the-edges-of-a-connection)
7+
- [Change arguments of `TypeGenerator`](#change-arguments-of-typegenerator)
8+
- [Add magic `__get` method to `ArgumentInterface` implementors](#add-magic-__get-method-to-argumentinterface-implementors)
9+
10+
### Customize the cursor encoder of the edges of a connection
11+
12+
The connection builder now accepts an optional custom cursor encoder as first argument of the constructor.
13+
14+
```diff
15+
$connectionBuilder = new ConnectionBuilder(
16+
+ new class implements CursorEncoderInterface {
17+
+ public function encode($value): string
18+
+ {
19+
+ ...
20+
+ }
21+
+
22+
+ public function decode(string $cursor)
23+
+ {
24+
+ ...
25+
+ }
26+
+ }
27+
static function (iterable $edges, PageInfoInterface $pageInfo) {
28+
...
29+
},
30+
static function (string $cursor, $value, int $index) {
31+
...
32+
}
33+
);
34+
```
35+
36+
### Change arguments of `TypeGenerator` class
37+
38+
The `Overblog\GraphQLBundle\Generator\TypeGenerator` service is used internally for GraphQL types compilation. If you
39+
overridden the service definition, please take into account the new constructor signature:
40+
41+
```diff
42+
public function __construct(
43+
string $classNamespace,
44+
- array $skeletonDirs,
45+
?string $cacheDir,
46+
array $configs,
47+
+ TypeBuilder $typeBuilder
48+
bool $useClassMap = true,
49+
- callable $configProcessor = null,
50+
?string $baseCacheDir = null,
51+
?int $cacheDirMask = null
52+
) {
53+
```
54+
`TypeBuilder` here is a new service `Overblog\GraphQLBundle\Generator\TypeBuilder`, which is also used internally.
55+
56+
### Add magic `__get` method to `ArgumentInterface` implementors
57+
58+
The interface `Overblog\GraphQLBundle\Definition\ArgumentInterface` as well as implementing it class
59+
`Overblog\GraphQLBundle\Definition\Argument` now have the magic `__get` method:
60+
61+
```diff
62+
interface ArgumentInterface extends ArrayAccess, Countable
63+
{
64+
/**
65+
* @return array the old array
66+
*/
67+
public function exchangeArray(array $array): array;
68+
69+
public function getArrayCopy(): array;
70+
71+
+ /**
72+
+ * @return mixed
73+
+ */
74+
+ public function __get(string $name);
75+
}
76+
77+
class Argument implements ArgumentInterface
78+
{
79+
// ...
80+
81+
+ public function __get(string $name)
82+
+ {
83+
+ return $this->rawArguments[$name] ?? null;
84+
+ }
85+
}
86+
```
87+
If you use your own class for resolver arguments, then it should have a `__get` method as well.

composer.json

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,35 +12,32 @@
1212
],
1313
"autoload": {
1414
"psr-4": {
15-
"Overblog\\GraphQLBundle\\": "src/",
16-
"Overblog\\GraphQLGenerator\\": "lib/generator/src/"
15+
"Overblog\\GraphQLBundle\\": "src/"
1716
}
1817
},
1918
"autoload-dev": {
2019
"psr-4": {
2120
"Overblog\\GraphQLBundle\\Benchmarks\\": "benchmarks/",
22-
"Overblog\\GraphQLBundle\\Tests\\": "tests/",
23-
"Overblog\\GraphQLGenerator\\Tests\\": "lib/generator/tests/"
21+
"Overblog\\GraphQLBundle\\Tests\\": "tests/"
2422
}
2523
},
2624
"config": {
2725
"bin-dir": "bin",
2826
"sort-packages": true
2927
},
3028
"require": {
31-
"php": ">=7.2",
29+
"php": ">=7.4",
3230
"ext-json": "*",
31+
"murtukov/php-code-generator": "^0.1.4",
3332
"psr/log": "^1.0",
34-
"symfony/config": "^4.3 || ^5.0",
35-
"symfony/dependency-injection": "^4.3 || ^5.0",
36-
"symfony/event-dispatcher": "^4.3 || ^5.0",
37-
"symfony/expression-language": "^4.3 || ^5.0",
38-
"symfony/framework-bundle": "^4.3 || ^5.0",
39-
"symfony/options-resolver": "^4.3 || ^5.0",
40-
"webonyx/graphql-php": "^0.13.5"
41-
},
42-
"replace": {
43-
"overblog/graphql-php-generator": "self.version"
33+
"symfony/config": "^4.4 || ^5.0",
34+
"symfony/dependency-injection": "^4.4 || ^5.0",
35+
"symfony/event-dispatcher": "^4.4 || ^5.0",
36+
"symfony/expression-language": "^4.4 || ^5.0",
37+
"symfony/framework-bundle": "^4.4 || ^5.0",
38+
"symfony/options-resolver": "^4.4 || ^5.0",
39+
"symfony/property-access": "^4.4 || ^5.0",
40+
"webonyx/graphql-php": "^14.0.1"
4441
},
4542
"suggest": {
4643
"nelmio/cors-bundle": "For more flexibility when using CORS prefight",
@@ -51,20 +48,22 @@
5148
"require-dev": {
5249
"doctrine/orm": "^2.5",
5350
"phpstan/extension-installer": "^1.0",
54-
"phpstan/phpstan-shim": "^0.11.19",
55-
"phpstan/phpstan-phpunit": "^0.11",
56-
"phpstan/phpstan-symfony": "^0.11",
57-
"phpunit/phpunit": "<8.3",
51+
"phpstan/phpstan": "^0.12.32",
52+
"phpstan/phpstan-phpunit": "^0.12.11",
53+
"phpstan/phpstan-symfony": "^0.12.6",
54+
"phpunit/phpunit": "^9.2",
5855
"react/promise": "^2.5",
59-
"symfony/asset": "^4.3 || ^5.0",
60-
"symfony/browser-kit": "^4.3 || ^5.0",
61-
"symfony/console": "^4.3 || ^5.0",
62-
"symfony/css-selector": "^4.3 || ^5.0",
63-
"symfony/phpunit-bridge": "^4.3 || ^5.0",
64-
"symfony/process": "^4.3 || ^5.0",
65-
"symfony/security-bundle": "^4.3 || ^5.0",
66-
"symfony/validator": "^4.3 || ^5.0",
67-
"symfony/yaml": "^4.3 || ^5.0"
56+
"symfony/asset": "^4.4 || ^5.0",
57+
"symfony/browser-kit": "^4.4 || ^5.0",
58+
"symfony/console": "^4.4 || ^5.0",
59+
"symfony/css-selector": "^4.4 || ^5.0",
60+
"symfony/phpunit-bridge": "^4.4 || ^5.0",
61+
"symfony/process": "^4.4 || ^5.0",
62+
"symfony/security-bundle": "^4.4 || ^5.0",
63+
"symfony/validator": "^4.4 || ^5.0",
64+
"symfony/var-dumper": "^4.4 || ^5.0",
65+
"symfony/yaml": "^4.4 || ^5.0",
66+
"twig/twig": "^2.10|^3.0"
6867
},
6968
"extra": {
7069
"branch-alias": {
@@ -80,16 +79,14 @@
8079
"test -f phpbench.phar || wget https://phpbench.github.io/phpbench/phpbench.phar https://phpbench.github.io/phpbench/phpbench.phar.pubkey",
8180
"@php phpbench.phar run -l dots --ansi -vvv --report='generator: \"table\", cols: [\"benchmark\", \"subject\", \"params\", \"best\", \"mean\", \"mode\", \"worst\", \"diff\"], break: [\"benchmark\"], sort: {mean: \"asc\"}'"
8281
],
83-
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.15.3/php-cs-fixer.phar -O php-cs-fixer.phar",
82+
"install-cs": "test -f php-cs-fixer.phar || wget https://github.com/FriendsOfPHP/PHP-CS-Fixer/releases/download/v2.16.4/php-cs-fixer.phar -O php-cs-fixer.phar",
8483
"fix-cs": [
8584
"@install-cs",
86-
"@php php-cs-fixer.phar fix --diff -v --allow-risky=yes --ansi",
87-
"@php php-cs-fixer.phar fix --config=lib/generator/.php_cs.dist --diff -v --allow-risky=yes --ansi"
85+
"@php php-cs-fixer.phar fix --diff -v --allow-risky=yes --ansi"
8886
],
8987
"check-cs": [
9088
"@install-cs",
91-
"@php php-cs-fixer.phar fix --dry-run --diff -v --allow-risky=yes --ansi",
92-
"@php php-cs-fixer.phar fix --config=lib/generator/.php_cs.dist --dry-run --diff -v --allow-risky=yes --ansi"
89+
"@php php-cs-fixer.phar fix --dry-run --diff -v --allow-risky=yes --ansi"
9390
],
9491
"code-quality": [
9592
"rm composer.lock",

0 commit comments

Comments
 (0)