mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
parent
f189b25b99
commit
ea0a670230
@ -573,6 +573,14 @@ class FunctionCallAnalyzer extends \Psalm\Internal\Analyzer\Statements\Expressio
|
||||
);
|
||||
}
|
||||
|
||||
$return_type = ExpressionAnalyzer::fleshOutType(
|
||||
$codebase,
|
||||
$return_type,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
||||
$return_type_location = $function_storage->return_type_location;
|
||||
|
||||
if ($config->after_function_checks) {
|
||||
|
@ -660,6 +660,29 @@ class ValueTest extends TestCase
|
||||
|
||||
consumeNumeric("12.34");'
|
||||
],
|
||||
'resolveScalarClassConstant' => [
|
||||
'<?php
|
||||
class PaymentFailure {
|
||||
const NO_CLIENT = "no_client";
|
||||
const NO_CARD = "no_card";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PaymentFailure::NO_CARD|PaymentFailure::NO_CLIENT
|
||||
*/
|
||||
function something() {
|
||||
if (rand(0, 1)) {
|
||||
return PaymentFailure::NO_CARD;
|
||||
}
|
||||
|
||||
return PaymentFailure::NO_CLIENT;
|
||||
}
|
||||
|
||||
function blah(): void {
|
||||
$test = something();
|
||||
if ($test === PaymentFailure::NO_CLIENT) {}
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user