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

Refactor BacktraceIgnoreMatcher #304

Merged
merged 5 commits into from
Jan 21, 2025
Merged

Refactor BacktraceIgnoreMatcher #304

merged 5 commits into from
Jan 21, 2025

Conversation

vjik
Copy link
Member

@vjik vjik commented Jan 19, 2025

Q A
Is bugfix?
New feature?
Breaks BC? ✔️

@vjik vjik requested a review from a team January 19, 2025 14:14
@vjik vjik added the status:code review The pull request needs review. label Jan 19, 2025
@@ -105,8 +105,8 @@ public static function unregister(): void
private function isIgnored(): bool
{
$backtrace = debug_backtrace();
return BacktraceIgnoreMatcher::isIgnoredByClass($backtrace, self::$ignoredClasses)
|| BacktraceIgnoreMatcher::isIgnoredByFile($backtrace, self::$ignoredPathPatterns);
return BacktraceMatcher::byClass($backtrace[3], self::$ignoredClasses)
Copy link
Member

Choose a reason for hiding this comment

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

What could either byClass or byFile method mean?
Can't see any improvements here

Copy link
Member Author

Choose a reason for hiding this comment

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

Backtrace match (class name) by file/class (method name).

"Ignore" doesn't matter here.

Copy link
Member

Choose a reason for hiding this comment

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

  • if you rename a class rename it instead of removing and adding a new one
  • a class method must be a verb
  • better name for the methods should contain contains / includes / intersects 'cause it contains searching operation
  • the matcher now depends on the proxy implementation, which was independent before and could be used in any other flows

Copy link
Member Author

Choose a reason for hiding this comment

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

  • if you rename a class rename it instead of removing and adding a new one

That is what GitHub decided, not me :)

  • a class method must be a verb
  • better name for the methods should contain contains / includes / intersects 'cause it contains searching operation

I don't think it makes sense in this case, because all methods perform single action. But it doesn't matter to me. Is "matchByFile()“ OK?

  • the matcher now depends on the proxy implementation, which was independent before and could be used in any other flows

On the contrary, now the matcher could be used in any other flows, because it not depends from internal structure of calling class (It depends on which item of backtrace to use for matching).

Copy link
Member Author

Choose a reason for hiding this comment

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

Methods are renamed.

@vjik vjik force-pushed the backtrace-matcher branch from 3384c86 to 9ccf813 Compare January 21, 2025 12:04
@vjik vjik requested a review from xepozz January 21, 2025 14:20
@vjik vjik merged commit c578957 into master Jan 21, 2025
16 checks passed
@vjik vjik deleted the backtrace-matcher branch January 21, 2025 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:code review The pull request needs review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants