Resolve PHP Deprecation Notice in PHP 8.2: Creation of dynamic property #32
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In PHP 8.2, the creation of dynamic properties will emit a deprecation notice. For more information see https://php.watch/versions/8.2/dynamic-properties-deprecated
By default the existing behavior was a public variable so adding this public declaration is in line with existing functionality.
WePay PHP SDK Version
v0.3.1
Behavior before this change
Deprecated: Creation of dynamic property WePayRequestException::$response is deprecated in /vendor/wepay/php-sdk/wepay.php on line 370
Behavior after this change
No deprecation notice
Additional Notes
I don't see this variable used anywhere but since it was dynamically created, it was created as a public variable so other developers could have technically used this in their projects. Removing line 370 would also resolve the deprecation notice but it would break anyone currently referencing this variable. This is why I selected to use a public variable to be consistent with existing functionality.