mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Detect function in array access op
This commit is contained in:
parent
da230bc9f1
commit
0468d11158
@ -721,10 +721,6 @@ class AssignmentAnalyzer
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$was_in_assignment) {
|
||||
$context->inside_assignment = false;
|
||||
}
|
||||
|
||||
$array_var_id = ExpressionAnalyzer::getArrayVarId(
|
||||
$stmt->var,
|
||||
$statements_analyzer->getFQCLN(),
|
||||
@ -831,6 +827,10 @@ class AssignmentAnalyzer
|
||||
}
|
||||
}
|
||||
|
||||
if (!$was_in_assignment) {
|
||||
$context->inside_assignment = false;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1046,6 +1046,16 @@ class UnusedVariableTest extends TestCase
|
||||
return $last;
|
||||
}'
|
||||
],
|
||||
'usedStrtolowerInArray' => [
|
||||
'<?php
|
||||
/**
|
||||
* @param array<string, int> $row
|
||||
*/
|
||||
function foo(array $row, string $s) : array {
|
||||
$row["a" . strtolower($s)] += 1;
|
||||
return $row;
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user