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

Fix deprecations triggered from code called by native code #53

Merged
merged 1 commit into from
Jun 2, 2023

Conversation

stof
Copy link
Member

@stof stof commented Jun 2, 2023

The debug backtrace does not provide the file key for frames that are not happening in a file, like eval'd code.

Fixes #44

@stof stof added the bug Something isn't working label Jun 2, 2023
@stof stof added this to the v1.1.1 milestone Jun 2, 2023
@stof
Copy link
Member Author

stof commented Jun 2, 2023

The more precise type for the $backtrace argument is taken from the return types in the phpstan source code (as this is the tool having the right one). With that, psalm at the existing level 2 and phpstan at level 7 (we are currently at level 6) are detecting the issues in the delegateTriggerToBackend method that are fixed here. phpstan at level 7 is also able to detect the broken usages in triggerIfCalledFromOutside.
And this also brings us closer to reaching the max level of both tools (actually, with this PR and #52, the phpstan max level only reports false positives)

Copy link
Member

@greg0ire greg0ire left a comment

Choose a reason for hiding this comment

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

Is it possible to come up with a test for this?

@stof
Copy link
Member Author

stof commented Jun 2, 2023

I will try to write a test using eval.

@greg0ire greg0ire changed the base branch from master to 1.1.x June 2, 2023 20:16
@stof stof changed the title Fix deprecations triggered from eval'd code Fix deprecations triggered from code called by native code Jun 2, 2023
The debug backtrace does not provide the file key for frames that are
not happening in native code.
@stof
Copy link
Member Author

stof commented Jun 2, 2023

@greg0ire we now have a test

@stof stof merged commit ed7d767 into doctrine:1.1.x Jun 2, 2023
@stof stof deleted the fix_backtrace branch June 2, 2023 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Undefined array key "file" issue on DoctrineBundle CI
2 participants