From a6c1c829221e40d43328b6ee900d925df5942dca Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Wed, 12 Mar 2025 10:52:17 +0100 Subject: [PATCH 1/4] ci: setup autofix --- .github/workflows/autofix.yml | 33 ++++++++++++++ .github/workflows/autoformat.yml | 76 -------------------------------- CHANGELOG.md | 13 ++++-- src/Server/ServerConfig.php | 14 ++++-- 4 files changed, 52 insertions(+), 84 deletions(-) create mode 100644 .github/workflows/autofix.yml delete mode 100644 .github/workflows/autoformat.yml diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 000000000..691ab3452 --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,33 @@ +name: autofix.ci # needed to securely identify the workflow by the action + +on: + pull_request: + push: + branches: + - master + +jobs: + autofix: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + + - uses: shivammathur/setup-php@v2 + with: + coverage: none + extensions: mbstring + php-version: 8.3 + + - uses: ramsey/composer-install@v2 + + - run: composer normalize + + - run: composer docs + - run: npx prettier --write --tab-width=2 *.md **/*.md + - run: vendor/bin/php-cs-fixer fix + + - uses: autofix-ci/action@v1 + with: + commit-message: Autofix diff --git a/.github/workflows/autoformat.yml b/.github/workflows/autoformat.yml deleted file mode 100644 index 041a86ba1..000000000 --- a/.github/workflows/autoformat.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Autoformat - -on: - push: - -jobs: - composer-normalize: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - uses: shivammathur/setup-php@v2 - with: - coverage: none - extensions: mbstring - php-version: 8.3 - - - uses: ramsey/composer-install@v2 - - - run: composer normalize - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Normalize composer.json - - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - token: ${{ secrets.GA_PAT == '' && secrets.GA_PAT || secrets.GITHUB_TOKEN }} - - - uses: shivammathur/setup-php@v2 - with: - coverage: none - extensions: mbstring - php-version: 8.3 - - - uses: ramsey/composer-install@v2 - - - run: composer docs - - - uses: creyD/prettier_action@v4.3 - with: - prettier_options: --write --tab-width=2 *.md **/*.md - commit_message: Prettify docs - - php-cs-fixer: - runs-on: ubuntu-latest - - permissions: - # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. - contents: write - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - token: ${{ secrets.GA_PAT == '' && secrets.GA_PAT || secrets.GITHUB_TOKEN }} - - - uses: shivammathur/setup-php@v2 - with: - coverage: none - extensions: mbstring - php-version: 8.3 - - - uses: ramsey/composer-install@v2 - - - run: vendor/bin/php-cs-fixer fix - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit_message: Apply php-cs-fixer changes diff --git a/CHANGELOG.md b/CHANGELOG.md index 7afd0b453..84a163309 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,13 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) + + + +break docs You can find and compare releases at the [GitHub release page](https://github.com/webonyx/graphql-php/releases). ## Unreleased @@ -19,7 +23,8 @@ You can find and compare releases at the [GitHub release page](https://github.co ### Fixed -- Handle fields that return lists in `ResolveInfo::getFieldSelectionWithAliases` https://github.com/webonyx/graphql-php/pull/1664 + - Handle fields that return lists in `ResolveInfo::getFieldSelectionWithAliases` https://github.com/webonyx/graphql-php/pull/1664 + ## v15.19.0 @@ -63,7 +68,7 @@ You can find and compare releases at the [GitHub release page](https://github.co - Add field config decorator when building schema from SDL https://github.com/webonyx/graphql-php/pull/1590 -## v15.14.3 +## v15.14.3 ### Fixed diff --git a/src/Server/ServerConfig.php b/src/Server/ServerConfig.php index 08d7517ee..db9e7356a 100644 --- a/src/Server/ServerConfig.php +++ b/src/Server/ServerConfig.php @@ -47,12 +47,15 @@ class ServerConfig * * @throws InvariantViolation */ - public static function create(array $config = []): self + public static function create( + array $config = []): self { $instance = new static(); foreach ($config as $key => $value) { - switch ($key) { + switch ($key ) { case 'schema': + + $instance->setSchema($value); break; case 'rootValue': @@ -62,13 +65,16 @@ public static function create(array $config = []): self $instance->setContext($value); break; case 'fieldResolver': - $instance->setFieldResolver($value); + $instance->setFieldResolver($value + ); break; case 'validationRules': $instance->setValidationRules($value); break; case 'queryBatching': - $instance->setQueryBatching($value); + + $instance->setQueryBatching( + $value); break; case 'debugFlag': $instance->setDebugFlag($value); From 9a96a20a7505358ee40d414a30b216bac15bcc49 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:13:17 +0000 Subject: [PATCH 2/4] Autofix --- CHANGELOG.md | 6 +----- src/Server/ServerConfig.php | 15 +++++++-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84a163309..fefb8e374 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,9 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) - - - break docs You can find and compare releases at the [GitHub release page](https://github.com/webonyx/graphql-php/releases). @@ -25,7 +22,6 @@ You can find and compare releases at the [GitHub release page](https://github.co - Handle fields that return lists in `ResolveInfo::getFieldSelectionWithAliases` https://github.com/webonyx/graphql-php/pull/1664 - ## v15.19.0 ### Added @@ -68,7 +64,7 @@ You can find and compare releases at the [GitHub release page](https://github.co - Add field config decorator when building schema from SDL https://github.com/webonyx/graphql-php/pull/1590 -## v15.14.3 +## v15.14.3 ### Fixed diff --git a/src/Server/ServerConfig.php b/src/Server/ServerConfig.php index db9e7356a..74c5010a9 100644 --- a/src/Server/ServerConfig.php +++ b/src/Server/ServerConfig.php @@ -48,14 +48,12 @@ class ServerConfig * @throws InvariantViolation */ public static function create( - array $config = []): self - { + array $config = [] + ): self { $instance = new static(); foreach ($config as $key => $value) { - switch ($key ) { + switch ($key) { case 'schema': - - $instance->setSchema($value); break; case 'rootValue': @@ -65,16 +63,17 @@ public static function create( $instance->setContext($value); break; case 'fieldResolver': - $instance->setFieldResolver($value + $instance->setFieldResolver( + $value ); break; case 'validationRules': $instance->setValidationRules($value); break; case 'queryBatching': - $instance->setQueryBatching( - $value); + $value + ); break; case 'debugFlag': $instance->setDebugFlag($value); From d2bfc8f99cad28f071b0791dc6b3b5b77b83bdb5 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Fri, 4 Apr 2025 16:43:35 +0200 Subject: [PATCH 3/4] style --- .github/workflows/autofix.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 691ab3452..d68bc6f88 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -26,6 +26,7 @@ jobs: - run: composer docs - run: npx prettier --write --tab-width=2 *.md **/*.md + - run: vendor/bin/php-cs-fixer fix - uses: autofix-ci/action@v1 From 184a68bb8fa8961b9cbd4c3a5024a421cdd93ba9 Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Fri, 4 Apr 2025 16:43:50 +0200 Subject: [PATCH 4/4] revert changes --- CHANGELOG.md | 7 +++---- src/Server/ServerConfig.php | 13 ++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fefb8e374..7afd0b453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,9 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0) -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -break docs You can find and compare releases at the [GitHub release page](https://github.com/webonyx/graphql-php/releases). ## Unreleased @@ -20,7 +19,7 @@ You can find and compare releases at the [GitHub release page](https://github.co ### Fixed - - Handle fields that return lists in `ResolveInfo::getFieldSelectionWithAliases` https://github.com/webonyx/graphql-php/pull/1664 +- Handle fields that return lists in `ResolveInfo::getFieldSelectionWithAliases` https://github.com/webonyx/graphql-php/pull/1664 ## v15.19.0 diff --git a/src/Server/ServerConfig.php b/src/Server/ServerConfig.php index 74c5010a9..08d7517ee 100644 --- a/src/Server/ServerConfig.php +++ b/src/Server/ServerConfig.php @@ -47,9 +47,8 @@ class ServerConfig * * @throws InvariantViolation */ - public static function create( - array $config = [] - ): self { + public static function create(array $config = []): self + { $instance = new static(); foreach ($config as $key => $value) { switch ($key) { @@ -63,17 +62,13 @@ public static function create( $instance->setContext($value); break; case 'fieldResolver': - $instance->setFieldResolver( - $value - ); + $instance->setFieldResolver($value); break; case 'validationRules': $instance->setValidationRules($value); break; case 'queryBatching': - $instance->setQueryBatching( - $value - ); + $instance->setQueryBatching($value); break; case 'debugFlag': $instance->setDebugFlag($value);