diff --git a/phpstan-tests.neon b/phpstan-tests.neon index 4b62b22..03e164e 100644 --- a/phpstan-tests.neon +++ b/phpstan-tests.neon @@ -26,3 +26,7 @@ parameters: - ./tests/Guid/*Test.php - ./tests/Nonstandard/*Test.php - ./tests/Rfc4122/*Test.php + - + message: "#^Method Ramsey\\\\Uuid\\\\.+ should return non-empty-string but returns string\\.$#" + paths: + - ./tests/static-analysis/ValidUuidIsNonEmpty.php diff --git a/src/Uuid.php b/src/Uuid.php index ed7093f..c849cfd 100644 --- a/src/Uuid.php +++ b/src/Uuid.php @@ -549,6 +549,8 @@ class Uuid implements UuidInterface * * @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 */ public static function isValid(string $uuid): bool { diff --git a/tests/static-analysis/ValidUuidIsNonEmpty.php b/tests/static-analysis/ValidUuidIsNonEmpty.php new file mode 100644 index 0000000..e1490fb --- /dev/null +++ b/tests/static-analysis/ValidUuidIsNonEmpty.php @@ -0,0 +1,35 @@ +