Skip to content
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

Fixed PHP 8.2 deprecated dynamic property creation #606

Merged
merged 5 commits into from
Feb 23, 2023

Conversation

danielmorell
Copy link
Collaborator

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 a Response instance). Adding the argument removes the need to dynamically declare the isUncaught property as we had before.

A few things to note:

  • The only reason this is considered a breaking change is because we are removing the public RollbarLogger::isUncaughtLogData() method since it is no longer needed.
  • At every instance where we pass in the $isUncaught argument I use a named argument, so it is explicitly clear what the true is for.
  • I did not add the $isUncaught argument to the Rollbar::report() method since we call RollbarLogger::report() directly, and the purpose of the argument is primarily for internal use. However, this does mean that the two report() methods are no longer the same. I am curious what the thoughts are on this.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

Related issues

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers assigned
  • Issue from task tracker has a link to this pull request
  • Changes have been reviewed by at least one other engineer

@danielmorell danielmorell added the Type: Maintenance General up-keep, or changes that tidy an existing component or process. label Feb 22, 2023
@danielmorell danielmorell added this to the v4.0.0 milestone Feb 22, 2023
Copy link

@anler anler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@danielmorell danielmorell merged commit 3626cdc into master Feb 23, 2023
@danielmorell danielmorell deleted the fixed/php8.2-dynamic-property-creation branch February 23, 2023 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance General up-keep, or changes that tidy an existing component or process.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP 8.2 Compatibility
2 participants