Skip to content

Commit 97a644c

Browse files
committed
Keep the callee's templates of a walked closure apart from generic calls in its body
The walk of a closure argument sees the callee's unresolved templates (the T of callable(T): U), and a generic call in the body resolved them as its own templates of the same name - map(['a'], fn ($a) => pair(2, $a)) gave array{2, 2}. The templates of the callable a closure is passed to get a name of the closure's own for the walk and get their name back on the resulting closure type. Amp-Thread-ID: https://ampcode.com/threads/T-01a17eac-1199-74a6-b3f7-dfbd8a084465
1 parent c3874c8 commit 97a644c

7 files changed

Lines changed: 197 additions & 22 deletions

File tree

‎src/Analyser/ExprHandler/Helper/ClosureTypeResolver.php‎

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ public function getClosureType(
142142
?Type $passedToType = null,
143143
): ClosureType
144144
{
145-
[$parameters, $isVariadic, $callableParameters, $nativeCallableParameters, $contextFree] = $this->buildParametersAndAcceptors($scope, $expr, $storage, $passedToType);
145+
$templateSuffix = '@' . spl_object_id($expr);
146+
[$parameters, $isVariadic, $callableParameters, $nativeCallableParameters, $contextFree] = $this->buildParametersAndAcceptors($scope, $expr, $storage, $passedToType, null, $shallow ? null : $templateSuffix);
146147

147148
// A shallow reflection is the closure/arrow function's signature without
148149
// walking its body: parameters plus the DECLARED return type. Used at scope
@@ -163,7 +164,7 @@ public function getClosureType(
163164
$cachedTypes = $this->findCachedTypes($expr);
164165
$cacheKey = $this->closureContextCacheKey($scope, $expr, $callableParameters, $parameters);
165166
if (array_key_exists($cacheKey, $cachedTypes)) {
166-
return $this->createClosureTypeFromCache($scope, $expr, $parameters, $isVariadic, $cachedTypes[$cacheKey], $contextFree);
167+
return ClosureWalkTemplateTypes::restore($this->createClosureTypeFromCache($scope, $expr, $parameters, $isVariadic, $cachedTypes[$cacheKey], $contextFree), $templateSuffix);
167168
}
168169
if (self::$resolveClosureTypeDepth >= 2) {
169170
self::$cappedClosureTypeWalks++;
@@ -229,7 +230,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
229230
// result rather than reading the still-unprocessed body expression
230231
$returnType = $this->resolveArrowFunctionReturnType($scope, $arrowScope, $expr, false, self::readableWalkStorage($walkStorage, $cappedBefore));
231232

232-
return $this->assembleClosureType($scope, $expr, $parameters, $isVariadic, $returnType, $throwPoints, $impurePoints, $invalidateExpressions, [], $cacheKey, $contextFree);
233+
return ClosureWalkTemplateTypes::restore($this->assembleClosureType($scope, $expr, $parameters, $isVariadic, $returnType, $throwPoints, $impurePoints, $invalidateExpressions, [], $cacheKey, $contextFree), $templateSuffix);
233234
}
234235

235236
self::$resolveClosureTypeDepth++;
@@ -290,7 +291,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
290291
$throwPoints = $closureStatementResult->getThrowPoints();
291292
$impurePoints = array_merge($closureImpurePoints, $closureStatementResult->getImpurePoints());
292293

293-
return $this->buildClosureTypeFromClosureWalk(
294+
return ClosureWalkTemplateTypes::restore($this->buildClosureTypeFromClosureWalk(
294295
$scope,
295296
$expr,
296297
$parameters,
@@ -305,7 +306,7 @@ static function (Node $node, Scope $scope) use ($arrowScope, &$arrowFunctionImpu
305306
false,
306307
self::readableWalkStorage($walkStorage, $cappedBefore),
307308
$contextFree,
308-
);
309+
), $templateSuffix);
309310
}
310311

311312
/**
@@ -824,6 +825,9 @@ public function getDeclaredClosureType(MutatingScope $scope, Node\Expr\Closure|A
824825
* written - its signature is then inferred from its usages (see
825826
* ClosureSignatureInference) and the parameters reflect that.
826827
*
828+
* A $templateSuffix renames the templates of the callable the closure is
829+
* passed to for a body walk (see ClosureWalkTemplateTypes).
830+
*
827831
* @return array{list<NativeParameterReflection>, bool, ParameterReflection[]|null, ParameterReflection[]|null, bool}
828832
*/
829833
private function buildParametersAndAcceptors(
@@ -832,6 +836,7 @@ private function buildParametersAndAcceptors(
832836
?ExpressionResultStorage $storage = null,
833837
?Type $passedToType = null,
834838
?Type $nativePassedToType = null,
839+
?string $templateSuffix = null,
835840
): array
836841
{
837842
[$parameters, $isVariadic] = $this->buildDeclaredParameters($scope, $expr);
@@ -843,6 +848,12 @@ private function buildParametersAndAcceptors(
843848
$nativePassedToType = $inParameter instanceof ExtendedParameterReflection ? $inParameter->getNativeType() : $inParameter->getType();
844849
}
845850
}
851+
if ($templateSuffix !== null && $passedToType !== null) {
852+
$passedToType = ClosureWalkTemplateTypes::rename($passedToType, $templateSuffix);
853+
if ($nativePassedToType !== null) {
854+
$nativePassedToType = ClosureWalkTemplateTypes::rename($nativePassedToType, $templateSuffix);
855+
}
856+
}
846857
$parameterTypes = $this->contextualClosureParameterResolver->resolve($scope, $expr, $storage, $passedToType, $nativePassedToType);
847858
$contextFree = $passedToType === null && !$this->contextualClosureParameterResolver->hasOwnContext($expr);
848859
if ($contextFree) {
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace PHPStan\Analyser\ExprHandler\Helper;
4+
5+
use PHPStan\ShouldNotHappenException;
6+
use PHPStan\Turbo\ReferencedByTurboExtension;
7+
use PHPStan\Type\ClosureType;
8+
use PHPStan\Type\Generic\TemplateType;
9+
use PHPStan\Type\Generic\TemplateTypeFactory;
10+
use PHPStan\Type\NarrowedSubjectType;
11+
use PHPStan\Type\Type;
12+
use PHPStan\Type\TypeTraverser;
13+
use function str_ends_with;
14+
use function strlen;
15+
use function substr;
16+
17+
/**
18+
* Gives the templates of the callable a closure is passed to a name of the
19+
* closure's own while ClosureTypeResolver::getClosureType() walks the body.
20+
*
21+
* The walk of a closure argument sees the callee's unresolved templates (the
22+
* `T` of `callable(T): U`), and the callee resolves them in the closure's
23+
* return type afterwards. Templates are resolved by name, so a generic call
24+
* in the body - to the same callee or any other function with a `T` - would
25+
* resolve the outer `T` as its own: `map(['a'], fn ($a) => pair(2, $a))`
26+
* returned `array{2, 2}`. A renamed template is no template of any call in
27+
* the body, and the name is the same for every walk of the closure, so
28+
* walks in the same context still share their cached type.
29+
*/
30+
#[ReferencedByTurboExtension(key: 'closureWalkTemplateTypes')]
31+
final class ClosureWalkTemplateTypes
32+
{
33+
34+
public static function rename(Type $type, string $suffix): Type
35+
{
36+
if (!$type->hasTemplateOrLateResolvableType()) {
37+
return $type;
38+
}
39+
40+
return TypeTraverser::map($type, static function (Type $type, callable $traverse) use ($suffix): Type {
41+
$type = $traverse($type);
42+
if (!self::isCalleeTemplate($type)) {
43+
return $type;
44+
}
45+
46+
return TemplateTypeFactory::create($type->getScope(), $type->getName() . $suffix, $type->getBound(), $type->getVariance(), $type->getStrategy(), $type->getDefault());
47+
});
48+
}
49+
50+
public static function restore(ClosureType $type, string $suffix): ClosureType
51+
{
52+
if (!$type->hasTemplateOrLateResolvableType()) {
53+
return $type;
54+
}
55+
56+
$restored = TypeTraverser::map($type, static function (Type $type, callable $traverse) use ($suffix): Type {
57+
$type = $traverse($type);
58+
if (!self::isCalleeTemplate($type) || !str_ends_with($type->getName(), $suffix)) {
59+
return $type;
60+
}
61+
62+
$name = substr($type->getName(), 0, -strlen($suffix));
63+
if ($name === '') {
64+
return $type;
65+
}
66+
67+
return TemplateTypeFactory::create($type->getScope(), $name, $type->getBound(), $type->getVariance(), $type->getStrategy(), $type->getDefault());
68+
});
69+
if (!$restored instanceof ClosureType) {
70+
throw new ShouldNotHappenException();
71+
}
72+
73+
return $restored;
74+
}
75+
76+
/** @phpstan-assert-if-true TemplateType $type */
77+
private static function isCalleeTemplate(Type $type): bool
78+
{
79+
return $type instanceof TemplateType
80+
&& !$type instanceof NarrowedSubjectType
81+
&& !$type->isArgument()
82+
&& $type->getScope()->getFunctionName() !== null;
83+
}
84+
85+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php declare(strict_types = 1);
2+
3+
namespace NestedGenericCallInClosureArgument;
4+
5+
use function PHPStan\Testing\assertType;
6+
7+
/**
8+
* @template T
9+
* @template U
10+
* @param list<T> $xs
11+
* @param callable(T): U $f
12+
* @return list<U>
13+
*/
14+
function map(array $xs, callable $f): array { return array_map($f, $xs); }
15+
16+
/**
17+
* @template T
18+
* @template X
19+
* @param T $t
20+
* @param X $x
21+
* @return array{T, X}
22+
*/
23+
function pair($t, $x): array { return [$t, $x]; }
24+
25+
/**
26+
* @template T
27+
* @template R
28+
* @param T $x
29+
* @param callable(T): R $f
30+
* @return R
31+
*/
32+
function apply($x, callable $f) { return $f($x); }
33+
34+
function sameTemplateName(): void
35+
{
36+
assertType("list<list<'a'>>", map(['a'], fn ($a) => map([2], fn ($b) => $a)));
37+
assertType('list<list<array{1, 2}>>', map([1], fn ($a) => map([2], fn ($b) => [$a, $b])));
38+
assertType("list<array{2, 'a'}>", map(['a'], fn ($a) => pair(2, $a)));
39+
assertType("list<'a'>", map(['a'], fn ($a) => apply(2, fn ($b) => $a)));
40+
}
41+
42+
function deeplyNested(): void
43+
{
44+
assertType('list<list<list<array{1, 2, 3}>>>', map([1], fn ($a) => map([2], fn ($b) => map([3], fn ($c) => [$a, $b, $c]))));
45+
assertType('list<list<list<list<array{1, 2, 3, 4}>>>>', map([1], fn ($a) => map([2], fn ($b) => map([3], fn ($c) => map([4], fn ($d) => [$a, $b, $c, $d])))));
46+
assertType("list<list<list<list<'x'>>>>", map([1], function ($a) { return map([2], function ($b) { return map([3], function ($c) { return map([4], function ($d) { return 'x'; }); }); }); }));
47+
}

‎turbo-ext/src/ClosureTypeResolver.cpp‎

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ int pt_ctr_capped_closure_type_walks = 0;
7070
pt_method_site pt_ctr_simple_throw_point_explicit_site;
7171
pt_method_site pt_ctr_simple_throw_point_implicit_site;
7272
pt_method_site pt_ctr_stats_increment_site;
73+
pt_method_site pt_ctr_walk_template_types_rename_site;
74+
pt_method_site pt_ctr_walk_template_types_restore_site;
7375

7476
/* $this->initializerExprTypeResolver->getType($expr, InitializerExprContext::fromScope($scope)) */
7577
zv::Val initializerExprType(zval *initializerExprTypeResolver, zval *expr, zval *scope)
@@ -91,6 +93,20 @@ zv::Val simpleThrowPointImplicit()
9193
return pt_call_static_cached(pt_ctr_simple_throw_point_implicit_site, PT_CLASS_SIMPLE_THROW_POINT, PT_LC("createimplicit"), 0, NULL);
9294
}
9395

96+
/* ClosureWalkTemplateTypes::rename($type, $suffix) / ::restore($type, $suffix) */
97+
zv::Val walkTemplateTypesRename(zval *type, zend_string *suffix)
98+
{
99+
zv::Args argv{type, suffix};
100+
return pt_call_static_cached(pt_ctr_walk_template_types_rename_site, PT_CLASS_CLOSURE_WALK_TEMPLATE_TYPES, PT_LC("rename"), 2, argv);
101+
}
102+
103+
zv::Val walkTemplateTypesRestore(zv::Val type, zend_string *suffix)
104+
{
105+
if (UNEXPECTED(type.isUndef())) return type;
106+
zv::Args argv{type.raw(), suffix};
107+
return pt_call_static_cached(pt_ctr_walk_template_types_restore_site, PT_CLASS_CLOSURE_WALK_TEMPLATE_TYPES, PT_LC("restore"), 2, argv);
108+
}
109+
94110
/* TemplateArgumentStats::$enabled && TemplateArgumentStats::increment('closureTypeBodyWalks'); false = pending exception */
95111
[[nodiscard]] bool countClosureTypeBodyWalk()
96112
{
@@ -346,8 +362,9 @@ class ClosureTypeResolver
346362
/* Mirrors getClosureType() ($storage, $passedToType NULL for null) */
347363
zv::Val getClosureType(zval *scope, zval *expr, bool shallow, zval *storage, zval *passedToType = NULL)
348364
{
365+
zv::Str templateSuffix = zv::Str::adopt(zend_strpprintf(0, "@%u", Z_OBJ_HANDLE_P(expr)));
349366
Parameters p;
350-
if (UNEXPECTED(!buildParametersAndAcceptors(scope, expr, storage, passedToType, NULL, p))) return zv::Val();
367+
if (UNEXPECTED(!buildParametersAndAcceptors(scope, expr, storage, passedToType, NULL, p, shallow ? NULL : templateSuffix.get()))) return zv::Val();
351368

352369
// A shallow reflection is the closure/arrow function's signature without
353370
// walking its body: parameters plus the DECLARED return type.
@@ -359,7 +376,7 @@ class ClosureTypeResolver
359376
zval *cached = zend_symtable_find(Z_ARRVAL_P(cachedTypes.raw()), cacheKey.get());
360377
if (cached != NULL) {
361378
ZVAL_DEREF(cached);
362-
return createClosureTypeFromCache(scope, expr, p.parameters.raw(), p.isVariadic, cached, p.contextFree);
379+
return walkTemplateTypesRestore(createClosureTypeFromCache(scope, expr, p.parameters.raw(), p.isVariadic, cached, p.contextFree), templateSuffix.get());
363380
}
364381
if (pt_ctr_resolve_closure_type_depth >= 2) {
365382
pt_ctr_capped_closure_type_walks++;
@@ -369,8 +386,8 @@ class ClosureTypeResolver
369386
if (UNEXPECTED(!countClosureTypeBodyWalk())) return zv::Val();
370387
int isArrowFunction = ptclosure::instanceOf(expr, PT_CLASS_ARROW_FUNCTION);
371388
if (UNEXPECTED(isArrowFunction < 0)) return zv::Val();
372-
if (isArrowFunction) return walkArrowFunction(scope, expr, p, cacheKey.get());
373-
return walkClosure(scope, expr, p, cacheKey.get());
389+
if (isArrowFunction) return walkTemplateTypesRestore(walkArrowFunction(scope, expr, p, cacheKey.get()), templateSuffix.get());
390+
return walkTemplateTypesRestore(walkClosure(scope, expr, p, cacheKey.get()), templateSuffix.get());
374391
}
375392

376393
/* Mirrors buildClosureTypeForClosure() (the nullable ones NULL for null) */
@@ -1075,7 +1092,7 @@ class ClosureTypeResolver
10751092
}
10761093

10771094
/* Mirrors buildParametersAndAcceptors() (the nullable ones NULL for null) */
1078-
[[nodiscard]] bool buildParametersAndAcceptors(zval *scope, zval *expr, zval *storage, zval *passedToType, zval *nativePassedToType, Parameters &p)
1095+
[[nodiscard]] bool buildParametersAndAcceptors(zval *scope, zval *expr, zval *storage, zval *passedToType, zval *nativePassedToType, Parameters &p, zend_string *templateSuffix = NULL)
10791096
{
10801097
if (UNEXPECTED(!buildDeclaredParameters(scope, expr, p.parameters, p.isVariadic))) return false;
10811098
zv::Val passedToTypeHold, nativePassedToTypeHold;
@@ -1106,6 +1123,17 @@ class ClosureTypeResolver
11061123
}
11071124
}
11081125
}
1126+
zv::Val renamedPassedToType, renamedNativePassedToType;
1127+
if (templateSuffix != NULL && passedToType != NULL) {
1128+
renamedPassedToType = walkTemplateTypesRename(passedToType, templateSuffix);
1129+
if (UNEXPECTED(renamedPassedToType.isUndef())) return false;
1130+
passedToType = renamedPassedToType.raw();
1131+
if (nativePassedToType != NULL) {
1132+
renamedNativePassedToType = walkTemplateTypesRename(nativePassedToType, templateSuffix);
1133+
if (UNEXPECTED(renamedNativePassedToType.isUndef())) return false;
1134+
nativePassedToType = renamedNativePassedToType.raw();
1135+
}
1136+
}
11091137
zval *contextualResolver = OBJ_PROP_NUM(self, slots::contextualClosureParameterResolver);
11101138
if (UNEXPECTED(!pt_contextual_closure_parameter_resolver_resolve(contextualResolver, scope, expr, storage, passedToType, nativePassedToType, p.callableParameters, p.nativeCallableParameters))) return false;
11111139
bool hasOwnContext = false;

‎turbo-ext/src/generated/ClosureTypeResolver.h‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ inline constexpr char strings[] =
9494
"deriveOnlyNeverExecutionEnds\0" /* 1114 */
9595
"buildDeclaredParameters\0" /* 1143 */
9696
"getDeclaredClosureType\0" /* 1167 */
97-
"buildParametersAndAcceptors\0" /* 1190 */
98-
"cachedClosureData\0" /* 1218 */
99-
"createClosureTypeFromCache\0" /* 1236 */
100-
"returnType\0" /* 1263 */
101-
"usedVariables\0" /* 1274 */
102-
"assembleClosureType"; /* 1288 */
97+
"templateSuffix\0" /* 1190 */
98+
"buildParametersAndAcceptors\0" /* 1205 */
99+
"cachedClosureData\0" /* 1233 */
100+
"createClosureTypeFromCache\0" /* 1251 */
101+
"returnType\0" /* 1278 */
102+
"usedVariables\0" /* 1289 */
103+
"assembleClosureType"; /* 1303 */
103104
inline constexpr reg::PackedArg args[] = {
104105
reg::packed(0, 0, 18), /* __construct $nodeScopeResolver */
105106
reg::packed(53, 0, 81), /* __construct $initializerExprTypeResolver */
@@ -187,23 +188,24 @@ inline constexpr reg::PackedArg args[] = {
187188
reg::packed(482, MAY_BE_NULL, 490, false, false, 531), /* buildParametersAndAcceptors $storage */
188189
reg::packed(536, MAY_BE_NULL, 549, false, false, 531), /* buildParametersAndAcceptors $passedToType */
189190
reg::packed(781, MAY_BE_NULL, 549, false, false, 531), /* buildParametersAndAcceptors $nativePassedToType */
191+
reg::packed(1190, MAY_BE_NULL | MAY_BE_STRING, reg::NoString, false, false, 531), /* buildParametersAndAcceptors $templateSuffix */
190192
reg::packed(324, MAY_BE_ARRAY), /* buildParametersAndAcceptors return */
191193
reg::packed(431, 0, 437), /* createClosureTypeFromCache $scope */
192194
reg::packed(348, 0, 353), /* createClosureTypeFromCache $expr */
193195
reg::packed(924, MAY_BE_ARRAY), /* createClosureTypeFromCache $parameters */
194196
reg::packed(1019, MAY_BE_BOOL), /* createClosureTypeFromCache $isVariadic */
195-
reg::packed(1218, MAY_BE_ARRAY), /* createClosureTypeFromCache $cachedClosureData */
197+
reg::packed(1233, MAY_BE_ARRAY), /* createClosureTypeFromCache $cachedClosureData */
196198
reg::packed(1039, MAY_BE_BOOL), /* createClosureTypeFromCache $contextFree */
197199
reg::packed(324, 0, 567), /* createClosureTypeFromCache return */
198200
reg::packed(431, 0, 437), /* assembleClosureType $scope */
199201
reg::packed(348, 0, 353), /* assembleClosureType $expr */
200202
reg::packed(924, MAY_BE_ARRAY), /* assembleClosureType $parameters */
201203
reg::packed(1019, MAY_BE_BOOL), /* assembleClosureType $isVariadic */
202-
reg::packed(1263, 0, 549), /* assembleClosureType $returnType */
204+
reg::packed(1278, 0, 549), /* assembleClosureType $returnType */
203205
reg::packed(727, MAY_BE_ARRAY), /* assembleClosureType $throwPoints */
204206
reg::packed(739, MAY_BE_ARRAY), /* assembleClosureType $impurePoints */
205207
reg::packed(752, MAY_BE_ARRAY), /* assembleClosureType $invalidateExpressions */
206-
reg::packed(1274, MAY_BE_ARRAY), /* assembleClosureType $usedVariables */
208+
reg::packed(1289, MAY_BE_ARRAY), /* assembleClosureType $usedVariables */
207209
reg::packed(1030, MAY_BE_NULL | MAY_BE_STRING, reg::NoString, false, false, 531), /* assembleClosureType $cacheKey */
208210
reg::packed(1039, MAY_BE_BOOL, reg::NoString, false, false, 476), /* assembleClosureType $contextFree */
209211
reg::packed(324, 0, 567), /* assembleClosureType return */
@@ -228,9 +230,9 @@ inline constexpr sigtab::Sig resolveArrowFunctionReturnType = { { 1083 /* resolv
228230
inline constexpr sigtab::Sig deriveOnlyNeverExecutionEnds = { { 1114 /* deriveOnlyNeverExecutionEnds */, 1, 73, 1, 74, ZEND_ACC_PRIVATE } };
229231
inline constexpr sigtab::Sig buildDeclaredParameters = { { 1143 /* buildDeclaredParameters */, 2, 75, 2, 77, ZEND_ACC_PRIVATE } };
230232
inline constexpr sigtab::Sig getDeclaredClosureType = { { 1167 /* getDeclaredClosureType */, 2, 78, 2, 80, ZEND_ACC_PUBLIC } };
231-
inline constexpr sigtab::Sig buildParametersAndAcceptors = { { 1190 /* buildParametersAndAcceptors */, 2, 81, 5, 86, ZEND_ACC_PRIVATE } };
232-
inline constexpr sigtab::Sig createClosureTypeFromCache = { { 1236 /* createClosureTypeFromCache */, 6, 87, 6, 93, ZEND_ACC_PRIVATE } };
233-
inline constexpr sigtab::Sig assembleClosureType = { { 1288 /* assembleClosureType */, 9, 94, 11, 105, ZEND_ACC_PRIVATE } };
233+
inline constexpr sigtab::Sig buildParametersAndAcceptors = { { 1205 /* buildParametersAndAcceptors */, 2, 81, 6, 87, ZEND_ACC_PRIVATE } };
234+
inline constexpr sigtab::Sig createClosureTypeFromCache = { { 1251 /* createClosureTypeFromCache */, 6, 88, 6, 94, ZEND_ACC_PRIVATE } };
235+
inline constexpr sigtab::Sig assembleClosureType = { { 1303 /* assembleClosureType */, 9, 95, 11, 106, ZEND_ACC_PRIVATE } };
234236
} // namespace sig
235237

236238
} // namespace ptdecl::ClosureTypeResolver

‎turbo-ext/src/support.cpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ static const pt_class_template pt_class_templates[PT_CLASS_COUNT] = {
265265
/* PT_CLASS_VAR_TAG_CHANGED_EXPRESSION_TYPE_NODE */ {"varTagChangedExpressionTypeNode", "PHPStan\\Node\\VarTagChangedExpressionTypeNode"},
266266
/* PT_CLASS_PROPERTY_HOOK_STATEMENT_NODE */ {"propertyHookStatementNode", "PHPStan\\Node\\PropertyHookStatementNode"},
267267
/* PT_CLASS_TEMPLATE_ARGUMENT_STATS */ {"templateArgumentStats", "PHPStan\\Analyser\\Generics\\TemplateArgumentStats"},
268+
/* PT_CLASS_CLOSURE_WALK_TEMPLATE_TYPES */ {"closureWalkTemplateTypes", "PHPStan\\Analyser\\ExprHandler\\Helper\\ClosureWalkTemplateTypes"},
268269
/* PT_CLASS_INVALIDATE_EXPR_NODE */ {"invalidateExprNode", "PHPStan\\Node\\InvalidateExprNode"},
269270
/* PT_CLASS_TERNARY_EXPR */ {"ternaryExpr", "PhpParser\\Node\\Expr\\Ternary"},
270271
/* PT_CLASS_BINARY_OP_MINUS */ {"binaryOpMinus", "PhpParser\\Node\\Expr\\BinaryOp\\Minus"},

‎turbo-ext/src/support.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ enum {
354354
PT_CLASS_VAR_TAG_CHANGED_EXPRESSION_TYPE_NODE,
355355
PT_CLASS_PROPERTY_HOOK_STATEMENT_NODE,
356356
PT_CLASS_TEMPLATE_ARGUMENT_STATS,
357+
PT_CLASS_CLOSURE_WALK_TEMPLATE_TYPES,
357358
PT_CLASS_INVALIDATE_EXPR_NODE,
358359
/* the assignment handlers (AssignHandler.cpp, AssignOpHandler.cpp) */
359360
PT_CLASS_TERNARY_EXPR,

0 commit comments

Comments
 (0)