Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
522c52e
[WIP] Annotations refactoring & PHP 8 Attributes
Vincz Jan 2, 2021
64a2b57
Add Doc Block type guesser & fix cs
Vincz Jan 4, 2021
a70e57c
Add @FieldBuilder & @ArgsBuilder & deprecated @Field properties
Vincz Jan 4, 2021
2dc3e51
Handle annotation shortcuts & fix stan
Vincz Jan 6, 2021
2084fb2
Fix type hint
Vincz Jan 8, 2021
7fc2d4f
Update documentation
Vincz Jan 10, 2021
77bcfd7
Merge branch 'master' into master
Vincz Jan 12, 2021
03204c5
Add PHP 8.0 to Ci
Vincz Jan 12, 2021
2303d65
Update php-code-generator dependency
Vincz Jan 12, 2021
6e1e146
Update AccessTest.php
murtukov Jan 12, 2021
6444177
Fix tests & static analysis
Vincz Jan 12, 2021
c7b8cab
Fix doc & code quality
Vincz Jan 13, 2021
7224b18
Revert short syntax for @annotation and better deprecation handling
Vincz Jan 13, 2021
0940112
Test deprecated enum value & remove check for short syntax
Vincz Jan 13, 2021
c8d2ba7
Add more tests for doctrine type guesser
Vincz Jan 14, 2021
712b141
Fix phpstan
Vincz Jan 14, 2021
96e841b
Merge branch 'master' into master
Vincz Jan 14, 2021
c32acb4
CI - Run coverage in php8
Vincz Jan 14, 2021
8603e24
Merge branch 'master' of github.com:Vincz/GraphQLBundle
Vincz Jan 14, 2021
253bd30
Update ci.yml
murtukov Jan 15, 2021
ba0d62f
CI - Install Ocular with composer
Vincz Jan 15, 2021
0559855
Merge branch 'master' of github.com:Vincz/GraphQLBundle
Vincz Jan 15, 2021
a47ffc1
Fix command syntax
Vincz Jan 15, 2021
fc07090
Ci - Syntax update
Vincz Jan 15, 2021
805bd21
Update ci.yml
murtukov Jan 15, 2021
f4c1d69
Exclude missing annotations from coverage
Vincz Jan 15, 2021
a93a003
Remove legacy class
Vincz Jan 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- php-version: 7.4
symfony-version: "5.2.*"

- php-version: 8.0
symfony-version: "5.2.*"

name: "PHP ${{ matrix.php-version }} / Symfony ${{ matrix.symfony-version }} Test"

steps:
Expand Down Expand Up @@ -187,7 +190,7 @@ jobs:
- name: "Install PHP with coverage"
uses: "shivammathur/setup-php@v2"
with:
php-version: "7.4"
php-version: "8.0"
ini-values: pcov.directory=.
coverage: "pcov"

Expand All @@ -198,16 +201,17 @@ jobs:
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"

- name: "Install Ocular as depencies"
run: composer req "scrutinizer/ocular" --dev --no-update

- name: "Install dependencies"
run: composer update --no-interaction --no-progress

- name: "Run tests with coverage"
run: bin/phpunit --color=always -v --debug --coverage-clover=build/logs/clover.xml

- name: "Upload coverage results to Scrutinizer"
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
run: vendor/scrutinizer/ocular/bin/ocular code-coverage:upload --format=php-clover build/logs/clover.xml

- name: "Upload coverage results to Coveralls"
env:
Expand Down
2 changes: 2 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ return PhpCsFixer\Config::create()
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'global_namespace_import' => ['import_functions' => true, 'import_classes' => true, 'import_constants' => true],
'phpdoc_summary' => false,
'hash_to_slash_comment' => false,
'single_line_comment_style' => false
]
)
->setFinder($finder)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Documentation
- [Data fetching](docs/data-fetching/index.md)
- [Query batching](docs/data-fetching/batching.md)
- [Promise](docs/data-fetching/promise.md)
- [Annotations](docs/annotations/index.md)
- [Annotations & PHP 8 Attributes](docs/annotations/index.md)
- [Validation](docs/validation/index.md)
- [Security](docs/security/index.md)
- [Handle CORS](docs/security/handle-cors.md)
Expand Down
74 changes: 71 additions & 3 deletions UPGRADE-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ UPGRADE FROM 0.13 to 1.0

# Table of Contents

- [Customize the cursor encoder of the edges of a connection](#customize-the-cursor-encoder-of-the-edges-of-a-connection)
- [Change arguments of `TypeGenerator`](#change-arguments-of-typegenerator)
- [Add magic `__get` method to `ArgumentInterface` implementors](#add-magic-__get-method-to-argumentinterface-implementors)
- [UPGRADE FROM 0.13 to 1.0](#upgrade-from-013-to-10)
- [Table of Contents](#table-of-contents)
- [Customize the cursor encoder of the edges of a connection](#customize-the-cursor-encoder-of-the-edges-of-a-connection)
- [Change arguments of `TypeGenerator` class](#change-arguments-of-typegenerator-class)
- [Add magic `__get` method to `ArgumentInterface` implementors](#add-magic-__get-method-to-argumentinterface-implementors)
- [Annotations - Flattened annotations](#annotations---flattened-annotations)
- [Annotations - Attributes changed](#annotations---attributes-changed)

### Customize the cursor encoder of the edges of a connection

Expand Down Expand Up @@ -86,3 +90,67 @@ class Argument implements ArgumentInterface
}
```
If you use your own class for resolver arguments, then it should have a `__get` method as well.


### Annotations - Flattened annotations

In order to prepare to PHP 8 attributes (they don't support nested attributes at the moment. @see https://github.com/symfony/symfony/issues/38503), the following annotations have been flattened: `@FieldsBuilder`, `@FieldBuilder`, `@ArgsBuilder`, `@Arg` and `@EnumValue`.

Before:
```php
/**
* @GQL\Type
*/
class MyType {
/**
* @GQL\Field(args={
* @GQL\Arg(name="arg1", type="String"),
* @GQL\Arg(name="arg2", type="Int")
* })
*/
public function myFields(?string $arg1, ?int $arg2) {..}
}

```

After:
```php
/**
* @GQL\Type
*/
class MyType {
/**
* @GQL\Field
* @GQL\Arg(name="arg1", type="String"),
* @GQL\Arg(name="arg2", type="Int")
*/
public function myFields(?string $arg1, ?int $arg2) {..}
}

```

### Annotations - Attributes changed

Change the attributes name of `@FieldsBuilder` annotation from `builder` and `builderConfig` to `value` and `config`.

Before:
```php
/**
* @GQL\Type(name="MyType", builders={@GQL\FieldsBuilder(builder="Timestamped", builderConfig={opt1: "val1"})})
*/
class MyType {

}
```

After:
```php
/**
* @GQL\Type("MyType")
* @GQL\FieldsBuilder(value="Timestamped", config={opt1: "val1"})
*/
class MyType {

}
```

3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"require": {
"php": ">=7.4",
"ext-json": "*",
"murtukov/php-code-generator": "^0.1.4",
"murtukov/php-code-generator": "^0.1.5",
"phpdocumentor/reflection-docblock": "^5.2",
"psr/log": "^1.0",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
Expand Down
Loading