From a72b78142756d93a740cd2b70d6d432a794ecd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Mon, 8 May 2023 23:24:12 +0200 Subject: [PATCH 1/4] Upgrade to Psalm 5 (#370) --- composer.json | 2 +- psalm.xml.dist | 14 ++++++++++++++ src/ArrayCollection.php | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 99ec24b0..36ad7f1a 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,7 @@ "phpstan/phpstan": "^1.8", "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.22" + "vimeo/psalm": "^5.11" }, "autoload": { "psr-4": { diff --git a/psalm.xml.dist b/psalm.xml.dist index 27ddd2f6..bf24a173 100644 --- a/psalm.xml.dist +++ b/psalm.xml.dist @@ -4,6 +4,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" + findUnusedBaselineEntry="true" + findUnusedCode="false" > @@ -18,6 +20,18 @@ + + + + + + + + + + + + diff --git a/src/ArrayCollection.php b/src/ArrayCollection.php index d8c569a8..6ec9b540 100644 --- a/src/ArrayCollection.php +++ b/src/ArrayCollection.php @@ -432,6 +432,7 @@ public function partition(Closure $p) * Returns a string representation of this object. * {@inheritDoc} */ + #[ReturnTypeWillChange] public function __toString() { return self::class . '@' . spl_object_hash($this); From 71a25d78cc86eeaab255cb74490254a23c45e306 Mon Sep 17 00:00:00 2001 From: Anner Visser Date: Mon, 8 May 2023 15:33:11 +0200 Subject: [PATCH 2/4] Remove override of template type: causing psalm errors The override of this template type causes Psalm to throw an error whenever contains is called: https://psalm.dev/r/a2f9439bd2 Removing the extra type works as expected: https://psalm.dev/r/de5f58d52f Fixes #368 --- src/AbstractLazyCollection.php | 2 -- src/ArrayCollection.php | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/AbstractLazyCollection.php b/src/AbstractLazyCollection.php index 9ea75ee1..5d309a5d 100644 --- a/src/AbstractLazyCollection.php +++ b/src/AbstractLazyCollection.php @@ -62,8 +62,6 @@ public function clear() /** * {@inheritDoc} - * - * @template TMaybeContained */ public function contains(mixed $element) { diff --git a/src/ArrayCollection.php b/src/ArrayCollection.php index 6ec9b540..2804fd76 100644 --- a/src/ArrayCollection.php +++ b/src/ArrayCollection.php @@ -235,8 +235,6 @@ public function containsKey(string|int $key) /** * {@inheritDoc} - * - * @template TMaybeContained */ public function contains(mixed $element) { From df281b2471536f052cfa471e872d63fec40d9379 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 6 Jul 2023 16:36:24 +0200 Subject: [PATCH 3/4] Applying latest coding standards --- src/ArrayCollection.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ArrayCollection.php b/src/ArrayCollection.php index 2804fd76..59f26e48 100644 --- a/src/ArrayCollection.php +++ b/src/ArrayCollection.php @@ -429,6 +429,8 @@ public function partition(Closure $p) /** * Returns a string representation of this object. * {@inheritDoc} + * + * @return string */ #[ReturnTypeWillChange] public function __toString() From e5a861394d539568c1bf6fe3b9b60af19b94da63 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 6 Jul 2023 14:49:06 +0200 Subject: [PATCH 4/4] Added the documentation.yml to the workflows --- .github/workflows/documentation.yml | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..37d3ae3d --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,47 @@ +name: "Documentation" + +on: + pull_request: + branches: + - "*.x" + paths: + - .github/workflows/documentation.yml + - docs/** + push: + branches: + - "*.x" + paths: + - .github/workflows/documentation.yml + - docs/** + +jobs: + validate-with-guides: + name: "Validate documentation with phpDocumentor/guides" + runs-on: "ubuntu-22.04" + + steps: + - name: "Checkout code" + uses: "actions/checkout@v3" + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "8.2" + + - name: "Remove existing composer file" + run: "rm composer.json" + + - name: "Require phpdocumentor/guides-cli" + run: "composer require --dev phpdocumentor/guides-cli dev-main@dev --no-update" + + - name: "Configure minimum stability" + run: "composer config minimum-stability dev" + + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v2" + with: + dependency-versions: "highest" + + - name: "Run guides-cli" + run: "vendor/bin/guides -vvv --no-progress --fail-on-log docs/en /tmp/test"