1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-02 09:37:59 +01:00
This commit is contained in:
Daniil Gentili 2022-12-02 18:28:43 +01:00
parent c80221344b
commit 59ab73fa91
4 changed files with 5 additions and 7 deletions

View File

@ -957,7 +957,8 @@ class ForeachAnalyzer
): void {
if ($iterator_atomic_type instanceof TIterable
|| ($iterator_atomic_type instanceof TGenericObject
&& strtolower($iterator_atomic_type->value) === 'traversable')
&& strtolower($iterator_atomic_type->value) === 'traversable'
&& isset($iterator_atomic_type->type_params[1]))
) {
$value_type = Type::combineUnionTypes($value_type, $iterator_atomic_type->type_params[1]);
$key_type = Type::combineUnionTypes($key_type, $iterator_atomic_type->type_params[0]);

View File

@ -1246,7 +1246,6 @@ class ArgumentAnalyzer
$function_id_parts = explode('&', $function_id);
$non_existent_method_ids = [];
$has_valid_method = false;
foreach ($function_id_parts as $function_id_part) {
[$callable_fq_class_name, $method_name] = explode('::', $function_id_part);
@ -1299,12 +1298,10 @@ class ArgumentAnalyzer
&& !$codebase->methods->methodExists($call_method_id)
) {
$non_existent_method_ids[] = $function_id_part;
} else {
$has_valid_method = true;
}
}
if (!$has_valid_method && !$param_type->hasString() && !$param_type->hasArray()) {
if ($non_existent_method_ids && !$param_type->hasString() && !$param_type->hasArray()) {
if (MethodAnalyzer::checkMethodExists(
$codebase,
$non_existent_method_ids[0],

View File

@ -1116,7 +1116,7 @@ class Analyzer
}
/**
* @param array{0:int, 1:int} $mixed_counts
* @param list{int, int} $mixed_counts
*
*/
public function setMixedCountsForFile(string $file_path, array $mixed_counts): void

View File

@ -29,7 +29,7 @@ use const PREG_SET_ORDER;
*/
class PartialParserVisitor extends PhpParser\NodeVisitorAbstract
{
/** @var array<int, array{int, int, int, int, int, string}> */
/** @var array<int, array{0: int, 1: int, 2: int, 3: int, 4: int, 5: string}> */
private $offset_map;
/** @var bool */