1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Prevent crashes on array_map(...)

Fixes vimeo/psalm#7305
This commit is contained in:
Bruce Weirdan 2022-01-06 10:38:58 +02:00
parent 513b263d38
commit fe036d4db0
No known key found for this signature in database
GPG Key ID: CFC3AAB181751B0D
2 changed files with 11 additions and 2 deletions

View File

@ -125,6 +125,10 @@ class ExpressionScanner
}
}
if ($node->isFirstClassCallable()) {
return;
}
if ($function_id === 'define') {
$first_arg_value = isset($node->getArgs()[0]) ? $node->getArgs()[0]->value : null;
$second_arg_value = isset($node->getArgs()[1]) ? $node->getArgs()[1]->value : null;

View File

@ -729,6 +729,12 @@ class ClosureTest extends TestCase
[],
'8.1'
],
'FirstClassCallable:array_map' => [
'<?php call_user_func(array_map(...), intval(...), ["1"]);',
'assertions' => [],
[],
'8.1',
],
];
}
@ -1171,9 +1177,8 @@ class ClosureTest extends TestCase
'error_message' => 'MixedAssignment',
[],
false,
'8.1'
'8.1',
],
];
}
}