Skip to content

Commit 1628ea4

Browse files
committed
Remove MixedInferredReturnType as the related issue is more accuratly reported by MixedReturnStatement
1 parent 147505c commit 1628ea4

26 files changed

+25
-165
lines changed

UPGRADING.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
- [BC] The only optional boolean parameter of `TKeyedArray::getGenericArrayType` was removed, and was replaced with a string parameter with a different meaning.
1313

1414
- [BC] The `TDependentListKey` type was removed and replaced with an optional property of the `TIntRange` type.
15+
-
1516
- [BC] `TCallableArray` and `TCallableList` removed and replaced with `TCallableKeyedArray`.
1617

18+
- [BC] Class `Psalm\Issue\MixedInferredReturnType` was removed
19+
1720
- [BC] Value of constant `Psalm\Type\TaintKindGroup::ALL_INPUT` changed to reflect new `TaintKind::INPUT_SLEEP` and `TaintKind::INPUT_XPATH` have been added. Accordingly, default values for `$taint` parameters of `Psalm\Codebase::addTaintSource()` and `Psalm\Codebase::addTaintSink()` have been changed as well.
1821

1922
- [BC] Property `Config::$shepherd_host` was replaced with `Config::$shepherd_endpoint`

config.xsd

-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@
333333
<xs:element name="MixedAssignment" type="IssueHandlerType" minOccurs="0" />
334334
<xs:element name="MixedClone" type="ArgumentIssueHandlerType" minOccurs="0" />
335335
<xs:element name="MixedFunctionCall" type="IssueHandlerType" minOccurs="0" />
336-
<xs:element name="MixedInferredReturnType" type="IssueHandlerType" minOccurs="0" />
337336
<xs:element name="MixedMethodCall" type="IssueHandlerType" minOccurs="0" />
338337
<xs:element name="MixedOperand" type="IssueHandlerType" minOccurs="0" />
339338
<xs:element name="MixedPropertyAssignment" type="IssueHandlerType" minOccurs="0" />

docs/running_psalm/error_levels.md

-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ Level 5 and above allows a more non-verifiable code, and higher levels are even
262262
- [MixedAssignment](issues/MixedAssignment.md)
263263
- [MixedClone](issues/MixedClone.md)
264264
- [MixedFunctionCall](issues/MixedFunctionCall.md)
265-
- [MixedInferredReturnType](issues/MixedInferredReturnType.md)
266265
- [MixedMethodCall](issues/MixedMethodCall.md)
267266
- [MixedOperand](issues/MixedOperand.md)
268267
- [MixedPropertyAssignment](issues/MixedPropertyAssignment.md)

docs/running_psalm/issues.md

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
- [MixedAssignment](issues/MixedAssignment.md)
135135
- [MixedClone](issues/MixedClone.md)
136136
- [MixedFunctionCall](issues/MixedFunctionCall.md)
137-
- [MixedInferredReturnType](issues/MixedInferredReturnType.md)
138137
- [MixedMethodCall](issues/MixedMethodCall.md)
139138
- [MixedOperand](issues/MixedOperand.md)
140139
- [MixedPropertyAssignment](issues/MixedPropertyAssignment.md)

docs/running_psalm/issues/MixedInferredReturnType.md

-11
This file was deleted.

src/Psalm/Config.php

-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ final class Config
156156
'MixedArrayTypeCoercion',
157157
'MixedAssignment',
158158
'MixedFunctionCall',
159-
'MixedInferredReturnType',
160159
'MixedMethodCall',
161160
'MixedOperand',
162161
'MixedPropertyFetch',

src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php

-12
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
use Psalm\Issue\MismatchingDocblockReturnType;
4141
use Psalm\Issue\MissingClosureReturnType;
4242
use Psalm\Issue\MissingReturnType;
43-
use Psalm\Issue\MixedInferredReturnType;
4443
use Psalm\Issue\MixedReturnTypeCoercion;
4544
use Psalm\Issue\MoreSpecificReturnType;
4645
use Psalm\Issue\UnresolvableConstant;
@@ -516,17 +515,6 @@ public static function verifyReturnType(
516515
}
517516

518517
if ($inferred_return_type->hasMixed()) {
519-
if (IssueBuffer::accepts(
520-
new MixedInferredReturnType(
521-
'Could not verify return type \'' . $declared_return_type . '\' for ' .
522-
$cased_method_id,
523-
$return_type_location,
524-
),
525-
$suppressed_issues,
526-
)) {
527-
return false;
528-
}
529-
530518
return null;
531519
}
532520

src/Psalm/Issue/MixedInferredReturnType.php

-13
This file was deleted.

tests/ArrayAssignmentTest.php

-3
Original file line numberDiff line numberDiff line change
@@ -2250,9 +2250,6 @@ function getCachedMixed(array $cache, string $locale) : string {
22502250
],
22512251
'mergeWithDeeplyNestedArray' => [
22522252
'code' => '<?php
2253-
/**
2254-
* @psalm-suppress MixedInferredReturnType
2255-
*/
22562253
function getTwoPartsLocale(array $cache, string $a, string $b) : string
22572254
{
22582255
if (!isset($cache[$b])) {

tests/CallableTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ public function bar($argOne, $argTwo)
19171917
}
19181918
}',
19191919
'error_message' => 'InvalidFunctionCall',
1920-
'ignored_issues' => ['UndefinedClass', 'MixedInferredReturnType'],
1920+
'ignored_issues' => ['UndefinedClass'],
19211921
],
19221922
'undefinedCallableMethodFullString' => [
19231923
'code' => '<?php

tests/ClassTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ function foo() : D {
341341
'assertions' => [],
342342
'ignored_issues' => [
343343
'UndefinedClass',
344-
'MixedInferredReturnType',
345344
'InvalidArgument',
346345
],
347346
],
@@ -356,7 +355,6 @@ function foo() : D {
356355
'assertions' => [],
357356
'ignored_issues' => [
358357
'UndefinedClass',
359-
'MixedInferredReturnType',
360358
'InvalidArgument',
361359
],
362360
],

tests/DocumentationTest.php

-4
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,6 @@ public function providerInvalidCodeParse(): array
288288
$ignored_issues = ['InvalidReturnStatement'];
289289
break;
290290

291-
case 'MixedInferredReturnType':
292-
$ignored_issues = ['MixedReturnStatement'];
293-
break;
294-
295291
case 'MixedStringOffsetAssignment':
296292
$ignored_issues = ['MixedAssignment'];
297293
break;

tests/FunctionCallTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ function portismaybeint(string $s) : ? int {
917917
'$porta' => 'false|int|null',
918918
'$porte' => 'false|int|null',
919919
],
920-
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
920+
'ignored_issues' => ['MixedReturnStatement'],
921921
],
922922
'parseUrlComponent' => [
923923
'code' => '<?php

tests/JsonOutputTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function fooFoo(int $a): string {
9090
function fooFoo(int $a): int {
9191
return $b + 1;
9292
}',
93-
'error_count' => 5,
93+
'error_count' => 4,
9494
'message' => 'Cannot find referenced variable $b',
9595
'line' => 3,
9696
'error' => '$b',
@@ -100,7 +100,7 @@ function fooFoo(int $a): int {
100100
function fooFoo(Badger\Bodger $a): Badger\Bodger {
101101
return $a;
102102
}',
103-
'error_count' => 3,
103+
'error_count' => 2,
104104
'message' => 'Class, interface or enum named Badger\\Bodger does not exist',
105105
'line' => 2,
106106
'error' => 'Badger\\Bodger',

tests/MagicPropertyTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ public function __get(string $name) : string {
398398
}
399399
}',
400400
'assertions' => [],
401-
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
401+
'ignored_issues' => ['MixedReturnStatement'],
402402
],
403403
'overrideInheritedProperty' => [
404404
'code' => '<?php

tests/MethodCallTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ public static function createFromInterface(\DateTimeInterface $datetime): static
11501150
}
11511151
}',
11521152
'assertions' => [],
1153-
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
1153+
'ignored_issues' => ['MixedReturnStatement'],
11541154
'php_version' => '8.0',
11551155
],
11561156
'nullsafeShortCircuit' => [
@@ -1342,7 +1342,7 @@ public function returns_nullable_class() {
13421342
}
13431343
}',
13441344
'error_message' => 'LessSpecificReturnStatement',
1345-
'ignored_issues' => ['MixedInferredReturnType', 'MixedReturnStatement', 'MixedMethodCall'],
1345+
'ignored_issues' => ['MixedReturnStatement', 'MixedMethodCall'],
13461346
],
13471347
'undefinedVariableStaticCall' => [
13481348
'code' => '<?php

tests/ReferenceConstraintTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ function testRef() : array {
8181
'MixedAssignment',
8282
'MixedArrayAccess',
8383
'MixedReturnStatement',
84-
'MixedInferredReturnType',
8584
'MixedOperand',
8685
],
8786
],

0 commit comments

Comments
 (0)