diff --git a/.github/workflows/merge-dependabot-upgrades.yml b/.github/workflows/merge-dependabot-upgrades.yml index cf1cb90..ee57e4b 100644 --- a/.github/workflows/merge-dependabot-upgrades.yml +++ b/.github/workflows/merge-dependabot-upgrades.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Auto-Merge if: ${{ github.event.workflow_run.conclusion == 'success' }} - uses: ridedott/merge-me-action@v2.10.39 + uses: ridedott/merge-me-action@v2.10.42 with: # This must be used as GitHub Actions token does not support pushing # to protected branches. diff --git a/CHANGELOG.md b/CHANGELOG.md index 85e485a..a570e3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -72,6 +72,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * Remove dependency on ramsey/collection package. +## 4.7.2 - 2023-01-11 + +### Fixed + +* Amend Psalm assertion syntax on `Uuid::isValid()` to prevent incorrect type + inference ([#486](https://github.com/ramsey/uuid/pull/486)). + + ## 4.7.1 - 2022-12-31 ### Fixed diff --git a/src/Uuid.php b/src/Uuid.php index 9676906..b42850b 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -456,7 +456,7 @@ class Uuid implements Rfc4122UuidInterface * @psalm-pure note: changing the internal factory is an edge case not covered by purity invariants, * but under constant factory setups, this method operates in functionally pure manners * - * @psalm-assert-if-true non-empty-string $uuid + * @psalm-assert-if-true =non-empty-string $uuid */ public static function isValid(string $uuid): bool { diff --git a/tests/static-analysis/ValidUuidIsNonEmpty.php b/tests/static-analysis/ValidUuidIsNonEmpty.php index e1490fb..8c7d6b6 100644 --- a/tests/static-analysis/ValidUuidIsNonEmpty.php +++ b/tests/static-analysis/ValidUuidIsNonEmpty.php @@ -32,4 +32,13 @@ final class ValidUuidIsNonEmpty throw new InvalidArgumentException('Not a UUID'); } + + public function givenInvalidInputValueRemainsAString(string $input): string + { + if (Uuid::isValid($input)) { + return 'It Worked!'; + } + + return $input; + } }