mirror of
https://github.com/danog/psalm.git
synced 2024-12-12 09:19:40 +01:00
foreach on list gives a positive|0 offset
This commit is contained in:
parent
d8f42d7281
commit
a7c4f0052b
@ -347,7 +347,7 @@ class ForeachAnalyzer
|
|||||||
* @param PhpParser\Node\Stmt\Foreach_|PhpParser\Node\Expr\YieldFrom $stmt
|
* @param PhpParser\Node\Stmt\Foreach_|PhpParser\Node\Expr\YieldFrom $stmt
|
||||||
* @return false|null
|
* @return false|null
|
||||||
*/
|
*/
|
||||||
public static function checkIteratorType(
|
public static function checkIteratorType(
|
||||||
StatementsAnalyzer $statements_analyzer,
|
StatementsAnalyzer $statements_analyzer,
|
||||||
PhpParser\NodeAbstract $stmt,
|
PhpParser\NodeAbstract $stmt,
|
||||||
PhpParser\Node\Expr $expr,
|
PhpParser\Node\Expr $expr,
|
||||||
@ -449,7 +449,7 @@ class ForeachAnalyzer
|
|||||||
? new Type\Union([
|
? new Type\Union([
|
||||||
new Type\Atomic\TDependentListKey($list_var_id)
|
new Type\Atomic\TDependentListKey($list_var_id)
|
||||||
])
|
])
|
||||||
: Type::getInt(),
|
: new Type\Union([new Type\Atomic\TIntRange(0, null)]),
|
||||||
$iterator_atomic_type->type_param
|
$iterator_atomic_type->type_param
|
||||||
]);
|
]);
|
||||||
} elseif (!$iterator_atomic_type instanceof Type\Atomic\TNonEmptyArray) {
|
} elseif (!$iterator_atomic_type instanceof Type\Atomic\TNonEmptyArray) {
|
||||||
|
Loading…
Reference in New Issue
Block a user