Fixed PHP 8.2 deprecated dynamic property creation #606
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.
This PR is an alternative to #604 and fixes the PHP 8.2 deprecated dynamic property creation warning issue #590.
Description of the change
This adds a new optional argument to the
RollbarLogger::report()
method,bool $isUncaught = false
as proposed by @anler #604 (comment). I created this as a new branch to keep our git history cleaner and then cherry picked the relevant commits from #604.Because our internal
report()
method is not defined by the PSR log interface we are free to differ from the standard logging methods (as we already have done by returning aResponse
instance). Adding the argument removes the need to dynamically declare theisUncaught
property as we had before.A few things to note:
RollbarLogger::isUncaughtLogData()
method since it is no longer needed.$isUncaught
argument I use a named argument, so it is explicitly clear what thetrue
is for.$isUncaught
argument to theRollbar::report()
method since we callRollbarLogger::report()
directly, and the purpose of the argument is primarily for internal use. However, this does mean that the tworeport()
methods are no longer the same. I am curious what the thoughts are on this.Type of change
Related issues
Checklists
Development
Code review