File tree Expand file tree Collapse file tree 2 files changed +21
-5
lines changed
rules-tests/DeadCode/Rector/Property/RemoveUselessVarTagRector/Fixture
rules/TypeDeclaration/PHPStan Expand file tree Collapse file tree 2 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Rector \Tests \DeadCode \Rector \Property \RemoveUselessVarTagRector \Fixture ;
4+
5+ use Rector \Tests \DeadCode \Rector \Property \RemoveUselessVarTagRector \Source \Properties ;
6+
7+ /**
8+ * @template TProperties of Properties|null
9+ * @template TCategories of object
10+ */
11+ final class SkipTemplateTagWithMultipleTemplates
12+ {
13+ /** @var TCategories */
14+ private object $ categories ;
15+
16+ /** @var TProperties */
17+ private Properties |null $ properties ;
18+ }
Original file line number Diff line number Diff line change 1111use PhpParser \Node \Stmt \Use_ ;
1212use PhpParser \Node \Stmt \UseUse ;
1313use PHPStan \Analyser \Scope ;
14- use PHPStan \PhpDoc \Tag \TemplateTag ;
1514use PHPStan \Reflection \ClassReflection ;
1615use PHPStan \Reflection \ReflectionProvider ;
1716use PHPStan \Type \Generic \GenericObjectType ;
@@ -85,14 +84,13 @@ public function narrowToFullyQualifiedOrAliasedObjectType(
8584 return new NonExistingObjectType ($ className );
8685 }
8786
88- // only support single @template for now
89- if (count ($ templateTags ) !== 1 ) {
87+ $ currentTemplateTag = $ templateTags [$ className ] ?? null ;
88+
89+ if ($ currentTemplateTag === null ) {
9090 // invalid type
9191 return new NonExistingObjectType ($ className );
9292 }
9393
94- /** @var TemplateTag $currentTemplateTag */
95- $ currentTemplateTag = current ($ templateTags );
9694 return TemplateTypeFactory::create (
9795 $ templateTypeScope ,
9896 $ currentTemplateTag ->getName (),
You can’t perform that action at this time.
0 commit comments