bugsnag / bugsnag-symfony

BugSnag notifier for the Symfony PHP framework. Monitor and report errors in your Symfony apps.
https://docs.bugsnag.com/platforms/php/symfony
MIT License
43 stars 21 forks source link

Fixed invalid phpDoc #140

Closed iambrosi closed 2 years ago

iambrosi commented 2 years ago

Goal

These fixes allow to prevent errors reported by static analysis tools like psalm or phpstan under certain conditions.

I have a use case where I need to extend the class SymfonyRequest, and override the method getInput, but psalm complains about the return type being incompatible with Symfony\Component\HttpFoundation\ParameterBag from the parent method, even though this method returns an array.

luke-belton commented 2 years ago

Hi @iambrosi - thanks for the PR! We're looking to add a static analysis tool like psalm/phpstan to bugsnag-symfony at some point in the future. We'll review this PR as part of that work when priorities allow 👍

iambrosi commented 2 years ago

@imjoehaines My apologies, I totally missed your comment. I used to have a use case where we needed to apply custom sanitization of the input data, like for example, cleanup parts of strings instead of full strings.

I made a refactor recently to this code, so instead of overriding getInput, I registered a callback into the Bugsnag's client that cleanups the report metadata.