Skip to content

Attach the deprecation version to the deprecating call - #277

Open
sirreal wants to merge 1 commit into
masterfrom
fix-deprecation-version
Open

Attach the deprecation version to the deprecating call#277
sirreal wants to merge 1 commit into
masterfrom
fix-deprecation-version

Conversation

@sirreal

Copy link
Copy Markdown
Member

export_uses() writes deprecation_version to $out[ $type ][0] — the first recorded function use — instead of the _deprecated_function() record it belongs to. Any function whose deprecated-call is not the first call in the body exports the version on the wrong record:

functionold_thing() {
do_something_first();
_deprecated_function( __FUNCTION__, '6.1.0', 'new_thing' );
}

exports uses.functions[0] = { name: 'do_something_first', …, deprecation_version: '6.1.0' } while the _deprecated_function record gets none. It only looks correct in existing fixtures because the deprecated-call happens to come first.

Build the record locally, attach the version to it, and append it once — no positional indexing. The test was added first and fails on master with the version on the wrong entry.

Found during the review of #262 and extracted here as a standalone change.

🤖 Generated with Claude Code

`export_uses()` wrote `deprecation_version` to `$out['functions'][0]`, the
first recorded function use, instead of the `_deprecated_*()` call that
carries the version. That only looked correct when the deprecating call
happened to be the first call in the scope, as it is in a deprecated file;
whenever another call precedes it, the version was attached to that
unrelated call and the deprecating call got none.
Build the use record first and attach the version to it before appending.
Found during the review of #262 and extracted here as a standalone change.
Sign up for freeto 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.

1 participant

@sirreal