1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00
This commit is contained in:
Brown 2020-08-28 14:07:01 -04:00
parent 1825e30752
commit 5980ef58dc

View File

@ -1241,10 +1241,7 @@ class ReturnTypeTest extends TestCase
return function($iter) use ($predicate): int {
return 1;
};
}
$res = map(function(int $i): string { return (string) $i; })([1,2,3]);
',
}',
'error_message' => 'InvalidReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:9:28 - The inferred type \'pure-Closure(iterable<mixed, T:fn-map as mixed>):int(1)\' does not match the declared return type \'callable(iterable<mixed, T:fn-map as mixed>):iterable<mixed, U:fn-map as mixed>\' for map',
],
'cannotInferReturnClosureWithDifferentTypes' => [
@ -1256,11 +1253,8 @@ class ReturnTypeTest extends TestCase
*/
function map(): callable {
return function(B $v): void {};
}
$res = map(function(int $i): string { return (string) $i; })([1,2,3]);
',
'error_message' => 'InvalidReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:28 - The inferred type \'Closure(B):void\' does not match the declared return type \'callable(A):void\' for map',
}',
'error_message' => 'InvalidReturnStatement - src' . DIRECTORY_SEPARATOR . 'somefile.php:8:28 - The inferred type \'impure-Closure(B):void\' does not match the declared return type \'callable(A):void\' for map',
],
'compareObjectLikeToAlwaysFilledArray' => [
'<?php