1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #608 - only check callable type if string/array is not also there

This commit is contained in:
Matthew Brown 2018-03-20 08:58:05 -04:00
parent 8dcb878af4
commit d17058e7d5
2 changed files with 11 additions and 2 deletions

View File

@ -1481,7 +1481,7 @@ class CallChecker
} }
} }
if (!$has_valid_method) { if (!$has_valid_method && !$param_type->hasString() && !$param_type->hasArray()) {
if (MethodChecker::checkMethodExists( if (MethodChecker::checkMethodExists(
$project_checker, $project_checker,
$non_existent_method_ids[0], $non_existent_method_ids[0],
@ -1493,7 +1493,7 @@ class CallChecker
} }
} }
} else { } else {
if (self::checkFunctionExists( if (!$param_type->hasString() && !$param_type->hasArray() && self::checkFunctionExists(
$statements_checker, $statements_checker,
$function_id, $function_id,
$code_location, $code_location,

View File

@ -206,6 +206,15 @@ class ClosureTest extends TestCase
new A([new A, new A]);', new A([new A, new A]);',
], ],
'possiblyUndefinedFunction' => [
'<?php
/**
* @param string|callable $middlewareOrPath
*/
function pipe($middlewareOrPath, ?callable $middleware = null): void { }
pipe("zzzz", function() : void {});',
],
]; ];
} }