mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Add support for doubly-extended non-template params
This commit is contained in:
parent
9d998bf3ac
commit
5cb6fe14d7
@ -732,6 +732,11 @@ class StaticCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expression\
|
|||||||
$found_generic_params[$type_key][$template_fq_class_name] = [
|
$found_generic_params[$type_key][$template_fq_class_name] = [
|
||||||
$found_generic_params[$t->param_name][$t->defining_class ?: ''][0]
|
$found_generic_params[$t->param_name][$t->defining_class ?: ''][0]
|
||||||
];
|
];
|
||||||
|
} else {
|
||||||
|
$found_generic_params[$type_key][$template_fq_class_name] = [
|
||||||
|
clone $extended_type
|
||||||
|
];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2170,6 +2170,31 @@ class TemplateExtendsTest extends TestCase
|
|||||||
}
|
}
|
||||||
}',
|
}',
|
||||||
],
|
],
|
||||||
|
'extendsArryObjectGetIterator' => [
|
||||||
|
'<?php
|
||||||
|
class Obj {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template T1
|
||||||
|
* @template-extends ArrayObject<int, T1>
|
||||||
|
*/
|
||||||
|
class Collection extends ArrayObject {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @template T2 as Obj
|
||||||
|
* @template-extends Collection<T2>
|
||||||
|
*/
|
||||||
|
class Collection2 extends Collection {
|
||||||
|
/**
|
||||||
|
* called to get the collection ready when we go to loop through it
|
||||||
|
*
|
||||||
|
* @return \ArrayIterator<int, T2>
|
||||||
|
*/
|
||||||
|
public function getIterator() {
|
||||||
|
return parent::getIterator();
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user