From 50fcda260aadbb221fc52f1160d7845d2041af40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 26 Aug 2022 13:10:48 +0200 Subject: [PATCH 1/6] Improve documentation about contributing --- docs/en/reference/index.rst | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/docs/en/reference/index.rst b/docs/en/reference/index.rst index b09d2824..01400f6c 100644 --- a/docs/en/reference/index.rst +++ b/docs/en/reference/index.rst @@ -123,6 +123,13 @@ Versioning This library follows semantic versioning, and additions to the code ruleset are only performed in major releases. +The patch branch can receive internal changes, such as CI pipeline +improvements, test workflow improvements, and can receive bugfixes. For +instance, such as removing rules that were not meant to be added. + +The minor branch can receive refactorings, and dependency updates that +do not affect the code ruleset. + Testing ======= @@ -136,13 +143,21 @@ need to execute the ``test`` GNU make target: Sometimes you are enabling a sniff that enforces some features for a specific PHP version, that will probably cause our build pipeline to fail when running on such versions. -We have created the ``update-compatibility-patch`` GNU make target to help you with that: +We have created the ``update-compatibility-patch-*`` GNU make targets to +help you with that. For instance, for PHP 6.0, you would run .. code-block:: bash - $ make update-compatibility-patch + $ make update-compatibility-patch-60 + +That target will attempt to apply the latest version of our +compatibility patch for that version of PHP and ask you to adjust the +code in ``tests/fixed`` and ``tests/expected_report.txt`` using the +editor of your preference. + +If the patch does not apply cleanly, you can edit it to edit or remove +hunks that relate to files you changed in your PR. -That target will apply the latest version of our compatibility patch and ask you to adjust the code in ``tests/fixed`` and -``tests/expected_report.txt`` using the editor of your preference. -Once you are done, please type "y" to resume the command, which will update the compatibility patch and create a commit -with your changes for you to push to your remote branch. +Once you are done, please type "y" to resume the command, which will +update the compatibility patch and create a commit with your changes for +you to push to your remote branch. From d6906253ce7a538d8f1cc39c2c2cdc49cd15aa24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 26 Aug 2022 14:10:48 +0200 Subject: [PATCH 2/6] Regroup versioning and testing and link to it People will be more likely to read this guide. --- CONTRIBUTING.md | 3 +++ docs/en/reference/index.rst | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..55eaba12 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing + +See https://www.doctrine-project.org/projects/doctrine-coding-standard/en/stable/reference/index.html#contributing diff --git a/docs/en/reference/index.rst b/docs/en/reference/index.rst index 01400f6c..7a01910f 100644 --- a/docs/en/reference/index.rst +++ b/docs/en/reference/index.rst @@ -117,8 +117,11 @@ and `the list of configuration options Date: Fri, 26 Aug 2022 15:17:07 +0200 Subject: [PATCH 3/6] Reuse shared workflow --- .../workflows/release-on-milestone-closed.yml | 41 +++---------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release-on-milestone-closed.yml b/.github/workflows/release-on-milestone-closed.yml index b7a56f71..a0c4e1d0 100644 --- a/.github/workflows/release-on-milestone-closed.yml +++ b/.github/workflows/release-on-milestone-closed.yml @@ -8,38 +8,9 @@ on: jobs: release: name: "Git tag, release & create merge-up PR" - runs-on: "ubuntu-20.04" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Release" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:release" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - - - name: "Create Merge-Up Pull Request" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:create-merge-up-pull-request" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} - - - name: "Create new milestones" - uses: "laminas/automatic-releases@v1" - with: - command-name: "laminas:automatic-releases:create-milestones" - env: - "GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }} - "SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }} - "GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }} - "GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }} + uses: "doctrine/.github/.github/workflows/release-on-milestone-closed.yml@2.0.0" + secrets: + GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }} + GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }} + ORGANIZATION_ADMIN_TOKEN: ${{ secrets.ORGANIZATION_ADMIN_TOKEN }} + SIGNING_SECRET_KEY: ${{ secrets.SIGNING_SECRET_KEY }} From 3af760a05671cac150c6e7bdfdf40afa215e0c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Fri, 26 Aug 2022 15:22:05 +0200 Subject: [PATCH 4/6] Update branch metadata --- .doctrine-project.json | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.doctrine-project.json b/.doctrine-project.json index 3dc73bed..05348903 100644 --- a/.doctrine-project.json +++ b/.doctrine-project.json @@ -5,21 +5,33 @@ "docsSlug": "doctrine-coding-standard", "versions": [ { - "name": "9.0", - "branchName": "9.0.x", - "slug": "9.0", + "name": "11.0", + "branchName": "11.0.x", + "slug": "11.0", "upcoming": true }, { - "name": "8.2", - "branchName": "8.2.x", - "slug": "8.2", + "name": "10.0", + "branchName": "10.0.x", + "slug": "10.0", "current": true, "aliases": [ "current", "stable" ] }, + { + "name": "9.0", + "branchName": "9.0.x", + "slug": "9.0", + "maintained": false + }, + { + "name": "8.2", + "branchName": "8.2.x", + "slug": "8.2", + "maintained": false + }, { "name": "8.1", "branchName": "8.1.x", From 13fce08952e2156adfd2c9d46d57ba81b18f7239 Mon Sep 17 00:00:00 2001 From: Gary Jones Date: Sun, 4 Sep 2022 15:18:26 +0100 Subject: [PATCH 5/6] Add "dev" Composer keyword As per https://getcomposer.org/doc/04-schema.md#keywords by including "dev" as a keyword in the `composer.json` file, Composer 2.4.0-RC1 and later will prompt users if the package is installed with `composer require` instead of `composer require --dev`. See https://github.com/composer/composer/pull/10960 for more info. --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 10247259..67db4065 100644 --- a/composer.json +++ b/composer.json @@ -6,6 +6,7 @@ "doctrine", "coding", "standard", + "dev", "cs", "code", "style", From 4e455303e8097fcd9a4b2b382f577bf3daf603d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 27 Oct 2022 20:26:01 +0200 Subject: [PATCH 6/6] Adjust expectations Upstream package has fixed a false positive with self::CONSTANT Here is how the false positive looked like > 9 | ERROR | [ ] Invalid inline documentation comment format "@var int", expected "@var type $variable Optional description". > | | (SlevomatCodingStandard.Commenting.InlineDocCommentDeclaration.InvalidFormat) It was about these lines: > /** @var int */ > const FOO = 123; --- composer.json | 2 +- tests/expected_report.txt | 4 ++-- tests/php72-compatibility.patch | 6 +++--- tests/php73-compatibility.patch | 6 +++--- tests/php74-compatibility.patch | 6 +++--- tests/php80-compatibility.patch | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index 10247259..870476a4 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "require": { "php": "^7.2 || ^8.0", "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", - "slevomat/coding-standard": "^8.2", + "slevomat/coding-standard": "^8.6.2", "squizlabs/php_codesniffer": "^3.7" }, "config": { diff --git a/tests/expected_report.txt b/tests/expected_report.txt index 5110131a..d9f181f3 100644 --- a/tests/expected_report.txt +++ b/tests/expected_report.txt @@ -10,7 +10,7 @@ tests/input/binary_operators.php 9 0 tests/input/class-references.php 10 0 tests/input/concatenation_spacing.php 49 0 tests/input/constants-no-lsb.php 2 0 -tests/input/constants-var.php 7 0 +tests/input/constants-var.php 6 0 tests/input/ControlStructures.php 28 0 tests/input/doc-comment-spacing.php 11 0 tests/input/duplicate-assignment-variable.php 1 0 @@ -50,7 +50,7 @@ tests/input/use-ordering.php 1 0 tests/input/useless-semicolon.php 2 0 tests/input/UselessConditions.php 21 0 ---------------------------------------------------------------------- -A TOTAL OF 429 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES +A TOTAL OF 428 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES ---------------------------------------------------------------------- PHPCBF CAN FIX 364 OF THESE SNIFF VIOLATIONS AUTOMATICALLY ---------------------------------------------------------------------- diff --git a/tests/php72-compatibility.patch b/tests/php72-compatibility.patch index 4e18afe4..2798b17d 100644 --- a/tests/php72-compatibility.patch +++ b/tests/php72-compatibility.patch @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt index 5110131..53dada5 100644 --- a/tests/expected_report.txt +++ b/tests/expected_report.txt -@@ -14,26 +14,23 @@ tests/input/constants-var.php 7 0 +@@ -14,26 +14,23 @@ tests/input/constants-var.php 6 0 tests/input/ControlStructures.php 28 0 tests/input/doc-comment-spacing.php 11 0 tests/input/duplicate-assignment-variable.php 1 0 @@ -51,8 +51,8 @@ index 5110131..53dada5 100644 -tests/input/UselessConditions.php 21 0 +tests/input/UselessConditions.php 20 0 ---------------------------------------------------------------------- --A TOTAL OF 429 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES -+A TOTAL OF 382 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES +-A TOTAL OF 428 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES ++A TOTAL OF 381 ERRORS AND 0 WARNINGS WERE FOUND IN 42 FILES ---------------------------------------------------------------------- -PHPCBF CAN FIX 364 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +PHPCBF CAN FIX 317 OF THESE SNIFF VIOLATIONS AUTOMATICALLY diff --git a/tests/php73-compatibility.patch b/tests/php73-compatibility.patch index c3ba0d18..4a87f0ad 100644 --- a/tests/php73-compatibility.patch +++ b/tests/php73-compatibility.patch @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt index 5110131..5616fdf 100644 --- a/tests/expected_report.txt +++ b/tests/expected_report.txt -@@ -14,26 +14,23 @@ tests/input/constants-var.php 7 0 +@@ -14,26 +14,23 @@ tests/input/constants-var.php 6 0 tests/input/ControlStructures.php 28 0 tests/input/doc-comment-spacing.php 11 0 tests/input/duplicate-assignment-variable.php 1 0 @@ -52,8 +52,8 @@ index 5110131..5616fdf 100644 -tests/input/UselessConditions.php 21 0 +tests/input/UselessConditions.php 20 0 ---------------------------------------------------------------------- --A TOTAL OF 429 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES -+A TOTAL OF 384 ERRORS AND 0 WARNINGS WERE FOUND IN 43 FILES +-A TOTAL OF 428 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES ++A TOTAL OF 383 ERRORS AND 0 WARNINGS WERE FOUND IN 43 FILES ---------------------------------------------------------------------- -PHPCBF CAN FIX 364 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +PHPCBF CAN FIX 319 OF THESE SNIFF VIOLATIONS AUTOMATICALLY diff --git a/tests/php74-compatibility.patch b/tests/php74-compatibility.patch index 52455e52..f03c2325 100644 --- a/tests/php74-compatibility.patch +++ b/tests/php74-compatibility.patch @@ -2,7 +2,7 @@ diff --git a/tests/expected_report.txt b/tests/expected_report.txt index 5110131..dc2cf18 100644 --- a/tests/expected_report.txt +++ b/tests/expected_report.txt -@@ -14,26 +14,23 @@ tests/input/constants-var.php 7 0 +@@ -14,26 +14,23 @@ tests/input/constants-var.php 6 0 tests/input/ControlStructures.php 28 0 tests/input/doc-comment-spacing.php 11 0 tests/input/duplicate-assignment-variable.php 1 0 @@ -50,8 +50,8 @@ index 5110131..dc2cf18 100644 -tests/input/UselessConditions.php 21 0 +tests/input/UselessConditions.php 20 0 ---------------------------------------------------------------------- --A TOTAL OF 429 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES -+A TOTAL OF 393 ERRORS AND 0 WARNINGS WERE FOUND IN 43 FILES +-A TOTAL OF 428 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES ++A TOTAL OF 392 ERRORS AND 0 WARNINGS WERE FOUND IN 43 FILES ---------------------------------------------------------------------- -PHPCBF CAN FIX 364 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +PHPCBF CAN FIX 328 OF THESE SNIFF VIOLATIONS AUTOMATICALLY diff --git a/tests/php80-compatibility.patch b/tests/php80-compatibility.patch index f85948eb..0815fae9 100644 --- a/tests/php80-compatibility.patch +++ b/tests/php80-compatibility.patch @@ -23,8 +23,8 @@ index 5110131..f0a3fc9 100644 tests/input/useless-semicolon.php 2 0 tests/input/UselessConditions.php 21 0 ---------------------------------------------------------------------- --A TOTAL OF 429 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES -+A TOTAL OF 423 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES +-A TOTAL OF 428 ERRORS AND 0 WARNINGS WERE FOUND IN 46 FILES ++A TOTAL OF 422 ERRORS AND 0 WARNINGS WERE FOUND IN 45 FILES ---------------------------------------------------------------------- -PHPCBF CAN FIX 364 OF THESE SNIFF VIOLATIONS AUTOMATICALLY +PHPCBF CAN FIX 358 OF THESE SNIFF VIOLATIONS AUTOMATICALLY