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:
parent
8dcb878af4
commit
d17058e7d5
@ -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,
|
||||||
|
@ -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 {});',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user