Skip to content

Distinguish backing store access from hook call in property hooks#311

Merged
janedbal merged 4 commits intomasterfrom
property-hook-backing-store-access
Mar 6, 2026
Merged

Distinguish backing store access from hook call in property hooks#311
janedbal merged 4 commits intomasterfrom
property-hook-backing-store-access

Conversation

@janedbal
Copy link
Copy Markdown
Member

@janedbal janedbal commented Mar 5, 2026

Closes #308

ruudk and others added 4 commits March 5, 2026 17:52
This produces:
> Property PropertyHooks13\MemoizedProperty::$id is never written

But it's not true. It's written, on read.
Self-referencing property access inside a hook accesses the backing
store directly without calling the corresponding hook. Previously
such usages were skipped entirely, which caused false positives for
memoizing patterns like `$this->id ??= ...`.

Now these usages are recorded with a non-propagating flag: the
property is marked as used, but the graph walk does not continue
into the hook body. This correctly models the difference between
accessing the property (backing store) and calling a hook.
@janedbal janedbal force-pushed the property-hook-backing-store-access branch from abeb0f0 to 4e2b50c Compare March 5, 2026 16:52
@janedbal janedbal merged commit 598cdd1 into master Mar 6, 2026
45 of 51 checks passed
@janedbal janedbal deleted the property-hook-backing-store-access branch March 6, 2026 08:25
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.

2 participants