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 9a0bcab
Browse filesBrowse the repository at this point in the historyBrowse files
Keep the template-argument constraints of a static variable's default and resolve the markers in inferred static variable types
- StaticVariableHandler: carry the template-argument constraints of the
scope the default expression returned onto the statement's scope, the way
CoalesceHandler carries those of its conditionally evaluated right side.
Before this, the `new` / generic call sites in `static $x = new Foo(...)`
recorded no facts, so their template arguments were never resolved.
- TemplateArgumentFrame::withStaticVariableTypes(): on a resolved frame,
replace the UnresolvedTemplateArgumentType markers in the inferred types
(collected by the observation walks) with the frame's resolution, the
initial type, or the unconstrained default/bound - the same order
GenericTypeTemplateTraverser uses at the site. Closure-signature markers are
left alone.
- Ported both changes to the turbo-ext mirrors (StaticVariableHandler.cpp,
TemplateArgumentFrame.cpp).
- Analogous cases covered by the regression test: a site created in the
body (`static $c = null; $c = new ...`), a generic function call as the
default, a run of two `static` variables, a send to a typed parameter
instead of a return, a function, and a closure body. A closure stored in a
`static` variable was probed too: it stays `Closure(mixed): mixed` with no
marker leak, so it is unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zv::Val name = pt_unresolved_template_argument_type_get_template_name(type);
630
+
if (UNEXPECTED(name.isUndef())) return;
631
+
if (UNEXPECTED(Z_TYPE_P(name.raw()) != IS_STRING)) {
632
+
zend_type_error("%s::resolve(): Argument #2 ($templateName) must be of type string, %s given", ZSTR_VAL(Z_OBJCE_P(frame)->name), zend_zval_value_name(name.raw()));
0 commit comments