Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is used #38013

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

Merged
merged 1 commit into from
Sep 2, 2020

Conversation

l-vo
Copy link
Contributor

@l-vo l-vo commented Aug 31, 2020

Q A
Branch? 5.1
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

when trigger_deprecation is used, the deprecation types (self, direct, indirect) are not properly detected because the file where the deprecation come from is always deprecation-contracts/functions.php. This PR aims to fix that.

@l-vo l-vo marked this pull request as ready for review August 31, 2020 16:39
@l-vo l-vo changed the title [WIP][PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is user [PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is user Aug 31, 2020
@l-vo l-vo changed the title [PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is user [PHPUnitBridge] Fix deprecation type detection when trigger_deprecation is used Aug 31, 2020
@nicolas-grekas nicolas-grekas added this to the 5.1 milestone Aug 31, 2020
src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php Outdated Show resolved Hide resolved
@l-vo l-vo force-pushed the fix_deprecations_type_detection branch 3 times, most recently from 5750b22 to 92d4a84 Compare August 31, 2020 20:00
$backtraceTriggerDeprecation = $trace[2] ?? null;
if ($backtraceTriggerDeprecation && 'trigger_deprecation' === $backtraceTriggerDeprecation['function']) {
$file = $backtraceTriggerDeprecation['file'];
unset($trace[1]);
Copy link
Member

Choose a reason for hiding this comment

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

can be removed if array_values() is removed below, isn't it? that would save some memcopies.

Copy link
Contributor Author

@l-vo l-vo Aug 31, 2020

Choose a reason for hiding this comment

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

I'm not sure to understand properly. unset is not here because of array_values, it's array_values that is needed because of unset. And unset is needed since if I keep the trace of deprecations-contracts/functions.php file, deprecations-contracts/functions.php is considered to determine direct and indirect deprecations instead of the file that call trigger_deprecation.

@nicolas-grekas nicolas-grekas force-pushed the fix_deprecations_type_detection branch from 92d4a84 to fd39961 Compare September 2, 2020 15:22
@nicolas-grekas
Copy link
Member

Thank you @l-vo.

@nicolas-grekas nicolas-grekas merged commit a8726df into symfony:5.1 Sep 2, 2020
@fabpot fabpot mentioned this pull request Sep 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.