mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Add more specific return type better messages
This commit is contained in:
parent
f0969cb3bb
commit
29aff6e088
@ -523,10 +523,10 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
|
|||||||
if ($type_coerced) {
|
if ($type_coerced) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new LessSpecificImplementedReturnType(
|
new LessSpecificImplementedReturnType(
|
||||||
'The return type \'' . $guide_method_storage->return_type
|
'The return type \'' . $guide_method_storage->return_type->getId()
|
||||||
. '\' for ' . $cased_guide_method_id . ' is more specific than the implemented '
|
. '\' for ' . $cased_guide_method_id . ' is more specific than the implemented '
|
||||||
. 'return type for ' . $implementer_declaring_method_id . ' \''
|
. 'return type for ' . $implementer_declaring_method_id . ' \''
|
||||||
. $implementer_method_storage->return_type . '\'',
|
. $implementer_method_storage->return_type->getId() . '\'',
|
||||||
$implementer_method_storage->return_type_location ?: $code_location
|
$implementer_method_storage->return_type_location ?: $code_location
|
||||||
),
|
),
|
||||||
$suppressed_issues
|
$suppressed_issues
|
||||||
@ -536,10 +536,10 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
|
|||||||
} else {
|
} else {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new ImplementedReturnTypeMismatch(
|
new ImplementedReturnTypeMismatch(
|
||||||
'The return type \'' . $guide_method_storage->return_type
|
'The return type \'' . $guide_method_storage->return_type->getId()
|
||||||
. '\' for ' . $cased_guide_method_id . ' is different to the implemented '
|
. '\' for ' . $cased_guide_method_id . ' is different to the implemented '
|
||||||
. 'return type for ' . $implementer_declaring_method_id . ' \''
|
. 'return type for ' . $implementer_declaring_method_id . ' \''
|
||||||
. $implementer_method_storage->return_type . '\'',
|
. $implementer_method_storage->return_type->getId() . '\'',
|
||||||
$implementer_method_storage->return_type_location ?: $code_location
|
$implementer_method_storage->return_type_location ?: $code_location
|
||||||
),
|
),
|
||||||
$suppressed_issues
|
$suppressed_issues
|
||||||
@ -607,8 +607,8 @@ class MethodAnalyzer extends FunctionLikeAnalyzer
|
|||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
new MoreSpecificImplementedParamType(
|
new MoreSpecificImplementedParamType(
|
||||||
'Argument ' . ($i + 1) . ' of ' . $cased_implementer_method_id . ' has wrong type \'' .
|
'Argument ' . ($i + 1) . ' of ' . $cased_implementer_method_id . ' has wrong type \'' .
|
||||||
$implementer_param->type . '\', expecting \'' .
|
$implementer_param->type->getId() . '\', expecting \'' .
|
||||||
$guide_param->type . '\' as defined by ' .
|
$guide_param->type->getId() . '\' as defined by ' .
|
||||||
$cased_guide_method_id,
|
$cased_guide_method_id,
|
||||||
$implementer_method_storage->params[$i]->location
|
$implementer_method_storage->params[$i]->location
|
||||||
?: $code_location
|
?: $code_location
|
||||||
|
Loading…
x
Reference in New Issue
Block a user