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 6c839c6
Browse filesBrowse the repository at this point in the historyBrowse files
Resolve templates of the declaring class in imported type aliases to their bounds
`@phpstan-import-type TList from Coll` with `@phpstan-type TList list<T>`
on a generic Coll used to leak `T of object (class Coll)` into the
importing class, where it means nothing. It is now `list<object>`. Coll
itself keeps its own T.
An imported alias that mentions such a template is reported under
bleeding edge (typeAlias.importedTemplateType).
Amp-Thread-ID: https://ampcode.com/threads/T-01a22307-fb39-7133-a55b-a5cc3cda81e7
@@ -148,6 +150,34 @@ public function checkInTraitDefinitionContext(ClassReflection $reflection): arra
148
150
}
149
151
150
152
$importedAliases[] = $aliasName;
153
+
154
+
if (!$this->reportTemplateInImportedTypeAlias) {
155
+
continue;
156
+
}
157
+
158
+
$templateTypes = [];
159
+
TypeTraverser::map($typeAliases[$importedAlias]->resolve($this->typeNodeResolver), staticfunction (Type$type, callable$traverse) use ($importedFromReflection, &$templateTypes): Type {
'Imported type alias TList refers to template type T of ImportedTypeAliasTemplate\\Coll, which resolves to its bound object in ImportedTypeAliasTemplate\\Importer.',
174
+
19,
175
+
],
176
+
[
177
+
'Imported type alias Renamed refers to template type T of ImportedTypeAliasTemplate\\Coll, which resolves to its bound object in ImportedTypeAliasTemplate\\Importer.',
0 commit comments