Skip to content

Allow assertMatchesJsonSnapshot to accept any JSON-serializable value #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

LuckyWindsck
Copy link
Contributor

This PR removes the strict type annotation from the $actual parameter in assertMatchesJsonSnapshot() to allow any JSON-serializable value, including JsonSerializable objects.

The underlying JsonDriver already accepts mixed input, so this change relaxes the input constraint to better reflect its capabilities. It also improves consistency with other assertMatches*Snapshot methods, which do not restrict input types.

@LuckyWindsck
Copy link
Contributor Author

Related commits for parameter types:

  1. 04b9f69: $actual -> array|string $actual
  2. d1ebc83: array|string $actual -> array|string|null|int|float|bool $actual

Related Issues / PRs:

@freekmurze freekmurze merged commit 4d35654 into spatie:main Jul 2, 2025
17 checks passed
@freekmurze
Copy link
Member

Thanks!

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