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

Simplify modes, allow stacking them, no tracking by default. Improve README #24

Merged
merged 3 commits into from
Mar 21, 2021

Conversation

beberlei
Copy link
Member

@beberlei beberlei commented Mar 13, 2021

  • By default do not even count the occurrences of deprecations anymore to avoid overhead with triggerIfCalledFromOutside.
  • Remove trigger_error based mode and only use @trigger_error, refactor tests to use a custom error handler for assertions.
  • Allow to combine PSR-3 logger and @trigger_error
  • Improve README and docblocks.
  • Use a userland basename implementation to avoid locale-sensitiviy.


$message .= sprintf(
' (%s:%d called by %s:%d, %s, package %s)',
basename($backtrace[0]['file']),
Copy link
Member

Choose a reason for hiding this comment

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

basename() is potentially slow and locale-sensitive, which means not able to handle all locales.

I'd suggest removing the file+line info from the message altogether, the userland error handler can compute them at will (many already do so.)

Copy link
Member Author

Choose a reason for hiding this comment

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

PHP never ceases to amaze :) i will reimplement the function

I have the stacktrace anyways for outside detection and having this in the message gives a 80/20 useful information.

For example PHPunit bridge requires additional configuration before it Shaws stacktraces.

README.md Outdated
@@ -47,13 +41,35 @@ foreach ($deprecations as $identifier => $count) {
}
```

### Supressing Specifc Deprecations
Copy link
Member

Choose a reason for hiding this comment

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

2 typos in the tile: Suppressing and Specific

README.md Outdated
avoid side effects by deprecations on user error handlers that Doctrine has no
control over.
- no side-effects by default, making it a perfect fit for libraries that don't know how the error handler works they operate under
- options to avoid having to rely on global state entirely with PSR-3 logging
Copy link
Member

Choose a reason for hiding this comment

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

this is misleading. The configured PSR-3 logger is still configured globally.

README.md Outdated
```

Disable triggering about specific deprecations:
If you only want to enable depreaction tracking, without logging or calling `trigger_error` then call:
Copy link
Member

Choose a reason for hiding this comment

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

typo here in deprecation

@beberlei beberlei marked this pull request as ready for review March 21, 2021 11:55
@beberlei beberlei merged commit 816a70b into master Mar 21, 2021
@beberlei beberlei deleted the SimplifyModes branch March 21, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants