You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5d0872e
Browse filesBrowse the repository at this point in the historyBrowse files
Count a property bound by reference as read when the other side can read it
A private property bound by reference - a by-ref promoted parameter,
$this->prop = &$var, $this->prop['k'] = &$var, self::$prop = &$var - was
only written, so it was reported as never read although whatever is written
to it can be read through the variable it is bound to.
PropertyWrite::isByReference() marks these writes, and
UnusedPrivatePropertyRule counts them as reads. No PropertyRead is recorded,
so the uninitialized-property checks see no read before the assignment.
A binding to a local variable of a method waits for the method's
VariableWritesNode and counts only when the method also reads the variable
or lets it escape apart from the binding, or the variable is a by-ref or
promoted parameter: a binding to a throwaway local is still reported.
VariableWritesNode::getObservingAccessCount() gives the number of read and
escape sites per variable for that.
Closesphpstan/phpstan#15886Closesphpstan/phpstan#10068
Amp-Thread-ID: https://ampcode.com/threads/T-01a22bbf-fbea-7343-93fe-fd2c23d22096
0 commit comments