Skip to content

Conversation

EmilMassey
Copy link
Contributor

Fixes this:

function assertJson(string $value): void
{
  Assert::that($value)->isJsonString(); // Call to method Assert\AssertionChain::isJsonString() will always evaluate to true.
}

Also narrows type to non-empty-string, because the assertion fails if empty string is provided.

I based this implementation on phpstan/phpstan-webmozart-assert#143

@ondrejmirtes ondrejmirtes merged commit 24bd4c7 into phpstan:2.0.x May 5, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants