Skip to content

Hooks: add input validation to all methods - #573

Merged
schlessera merged 1 commit into
developfrom
feature/hooks-add-input-validation
Oct 29, 2021
Merged

Hooks: add input validation to all methods#573
schlessera merged 1 commit into
developfrom
feature/hooks-add-input-validation

Conversation

@jrfnl

@jrfnl jrfnl commented Oct 11, 2021

Copy link
Copy Markdown
Member

Neither of the methods in the WpOrg\Requests\Hooks class did any input validation. This could lead to various PHP errors and becomes all the more relevant due to the new "passing null to non-nullable" deprecation notice on PHP 8.1.

This commit adds simple input validation to all methods within the WpOrg\Requests\Hooks class and will throw an WpOrg\Requests\Exception\InvalidArgument exception if a parameter does not comply with the expectations.

Includes adding tests for the new exceptions and a test to safeguard that closures are accepted.

Neither of the methods in the `WpOrg\Requests\Hooks` class did any input validation. This could lead to various PHP errors and becomes all the more relevant due to the new "passing null to non-nullable" deprecation notice on PHP 8.1.

This commit adds simple input validation to all methods within the `WpOrg\Requests\Hooks` class and will throw an `WpOrg\Requests\Exception\InvalidArgument` exception if a parameter does not comply with the expectations.

Includes adding tests for the new exceptions and a test to safeguard that closures are accepted
@jrfnl jrfnl added this to the 2.0.0 milestone Oct 11, 2021
@jrfnl
jrfnl requested a review from schlessera October 11, 2021 16:00
@schlessera
schlessera merged commit 2d600fb into develop Oct 29, 2021
@schlessera
schlessera deleted the feature/hooks-add-input-validation branch October 29, 2021 13:08
@jrfnl jrfnl mentioned this pull request Nov 6, 2021
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants