Skip to content

Correct PHPStan findings in validator #808

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
merged 3 commits into from
Mar 25, 2025

Conversation

DannyvdSluijs
Copy link
Collaborator

This pull request includes several changes to the JsonSchema library, focusing on adding type hints and improving code documentation. The most important changes include removing certain entries from phpstan-baseline.neon, adding type hints to methods in Validator.php, and updating deprecation notices.

Improvements to type hints and code documentation:

  • src/JsonSchema/Validator.php: Added type hints to the validate, check, and coerce methods, specifying the return type as int and including detailed parameter documentation. [1] [2]

Updates to phpstan-baseline.neon:

  • phpstan-baseline.neon: Removed multiple entries related to the JsonSchema\Validator class, which were previously indicating missing type hints. These entries are no longer needed due to the added type hints in the code.

@DannyvdSluijs DannyvdSluijs force-pushed the correct-phpstan-findings-in-validator branch from eac9e23 to 9ffc75e Compare March 25, 2025 12:21
@DannyvdSluijs DannyvdSluijs force-pushed the correct-phpstan-findings-in-validator branch from 9ffc75e to e8124cd Compare March 25, 2025 12:43
@DannyvdSluijs DannyvdSluijs merged commit 60b095b into master Mar 25, 2025
15 checks passed
@DannyvdSluijs DannyvdSluijs deleted the correct-phpstan-findings-in-validator branch March 25, 2025 15:24
DannyvdSluijs added a commit that referenced this pull request Mar 25, 2025
This pull request includes several changes to the `JsonSchema` library,
focusing on adding type hints and improving code documentation. The most
important changes include removing certain entries from
`phpstan-baseline.neon`, adding type hints to methods in
`Validator.php`, and updating deprecation notices.

Improvements to type hints and code documentation:

*
[`src/JsonSchema/Validator.php`](diffhunk://#diff-41de454e04e08a0284513e682c94d3f01f9c4a2a6b2faa51b5868bdd0826e42eL44-R48):
Added type hints to the `validate`, `check`, and `coerce` methods,
specifying the return type as `int` and including detailed parameter
documentation.
[[1]](diffhunk://#diff-41de454e04e08a0284513e682c94d3f01f9c4a2a6b2faa51b5868bdd0826e42eL44-R48)
[[2]](diffhunk://#diff-41de454e04e08a0284513e682c94d3f01f9c4a2a6b2faa51b5868bdd0826e42eL85-R104)

Updates to `phpstan-baseline.neon`:

*
[`phpstan-baseline.neon`](diffhunk://#diff-995edee38ad4f8387e58ebd52c31bcc04c56cc2448d331b1cf5e0b35c57b9efaL903-L932):
Removed multiple entries related to the `JsonSchema\Validator` class,
which were previously indicating missing type hints. These entries are
no longer needed due to the added type hints in the code.
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