Skip to content

Commit

Permalink
Remove MixedInferredReturnType as the related issue is more accuratly…
Browse files Browse the repository at this point in the history
… reported by MixedReturnStatement
  • Loading branch information
robchett committed Oct 26, 2023
1 parent 147505c commit 1628ea4
Show file tree
Hide file tree
Showing 26 changed files with 25 additions and 165 deletions.
3 changes: 3 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
- [BC] The only optional boolean parameter of `TKeyedArray::getGenericArrayType` was removed, and was replaced with a string parameter with a different meaning.

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

- [BC] Class `Psalm\Issue\MixedInferredReturnType` was removed

- [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.

- [BC] Property `Config::$shepherd_host` was replaced with `Config::$shepherd_endpoint`
Expand Down
1 change: 0 additions & 1 deletion config.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@
<xs:element name="MixedAssignment" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedClone" type="ArgumentIssueHandlerType" minOccurs="0" />
<xs:element name="MixedFunctionCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedInferredReturnType" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedMethodCall" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedOperand" type="IssueHandlerType" minOccurs="0" />
<xs:element name="MixedPropertyAssignment" type="IssueHandlerType" minOccurs="0" />
Expand Down
1 change: 0 additions & 1 deletion docs/running_psalm/error_levels.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ Level 5 and above allows a more non-verifiable code, and higher levels are even
- [MixedAssignment](issues/MixedAssignment.md)
- [MixedClone](issues/MixedClone.md)
- [MixedFunctionCall](issues/MixedFunctionCall.md)
- [MixedInferredReturnType](issues/MixedInferredReturnType.md)
- [MixedMethodCall](issues/MixedMethodCall.md)
- [MixedOperand](issues/MixedOperand.md)
- [MixedPropertyAssignment](issues/MixedPropertyAssignment.md)
Expand Down
1 change: 0 additions & 1 deletion docs/running_psalm/issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@
- [MixedAssignment](issues/MixedAssignment.md)
- [MixedClone](issues/MixedClone.md)
- [MixedFunctionCall](issues/MixedFunctionCall.md)
- [MixedInferredReturnType](issues/MixedInferredReturnType.md)
- [MixedMethodCall](issues/MixedMethodCall.md)
- [MixedOperand](issues/MixedOperand.md)
- [MixedPropertyAssignment](issues/MixedPropertyAssignment.md)
Expand Down
11 changes: 0 additions & 11 deletions docs/running_psalm/issues/MixedInferredReturnType.md

This file was deleted.

1 change: 0 additions & 1 deletion src/Psalm/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ final class Config
'MixedArrayTypeCoercion',
'MixedAssignment',
'MixedFunctionCall',
'MixedInferredReturnType',
'MixedMethodCall',
'MixedOperand',
'MixedPropertyFetch',
Expand Down
12 changes: 0 additions & 12 deletions src/Psalm/Internal/Analyzer/FunctionLike/ReturnTypeAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
use Psalm\Issue\MismatchingDocblockReturnType;
use Psalm\Issue\MissingClosureReturnType;
use Psalm\Issue\MissingReturnType;
use Psalm\Issue\MixedInferredReturnType;
use Psalm\Issue\MixedReturnTypeCoercion;
use Psalm\Issue\MoreSpecificReturnType;
use Psalm\Issue\UnresolvableConstant;
Expand Down Expand Up @@ -516,17 +515,6 @@ public static function verifyReturnType(
}

if ($inferred_return_type->hasMixed()) {
if (IssueBuffer::accepts(
new MixedInferredReturnType(
'Could not verify return type \'' . $declared_return_type . '\' for ' .
$cased_method_id,
$return_type_location,
),
$suppressed_issues,
)) {
return false;
}

return null;
}

Expand Down
13 changes: 0 additions & 13 deletions src/Psalm/Issue/MixedInferredReturnType.php

This file was deleted.

3 changes: 0 additions & 3 deletions tests/ArrayAssignmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2250,9 +2250,6 @@ function getCachedMixed(array $cache, string $locale) : string {
],
'mergeWithDeeplyNestedArray' => [
'code' => '<?php
/**
* @psalm-suppress MixedInferredReturnType
*/
function getTwoPartsLocale(array $cache, string $a, string $b) : string
{
if (!isset($cache[$b])) {
Expand Down
2 changes: 1 addition & 1 deletion tests/CallableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ public function bar($argOne, $argTwo)
}
}',
'error_message' => 'InvalidFunctionCall',
'ignored_issues' => ['UndefinedClass', 'MixedInferredReturnType'],
'ignored_issues' => ['UndefinedClass'],
],
'undefinedCallableMethodFullString' => [
'code' => '<?php
Expand Down
2 changes: 0 additions & 2 deletions tests/ClassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ function foo() : D {
'assertions' => [],
'ignored_issues' => [
'UndefinedClass',
'MixedInferredReturnType',
'InvalidArgument',
],
],
Expand All @@ -356,7 +355,6 @@ function foo() : D {
'assertions' => [],
'ignored_issues' => [
'UndefinedClass',
'MixedInferredReturnType',
'InvalidArgument',
],
],
Expand Down
4 changes: 0 additions & 4 deletions tests/DocumentationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ public function providerInvalidCodeParse(): array
$ignored_issues = ['InvalidReturnStatement'];
break;

case 'MixedInferredReturnType':
$ignored_issues = ['MixedReturnStatement'];
break;

case 'MixedStringOffsetAssignment':
$ignored_issues = ['MixedAssignment'];
break;
Expand Down
2 changes: 1 addition & 1 deletion tests/FunctionCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ function portismaybeint(string $s) : ? int {
'$porta' => 'false|int|null',
'$porte' => 'false|int|null',
],
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
'ignored_issues' => ['MixedReturnStatement'],
],
'parseUrlComponent' => [
'code' => '<?php
Expand Down
4 changes: 2 additions & 2 deletions tests/JsonOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function fooFoo(int $a): string {
function fooFoo(int $a): int {
return $b + 1;
}',
'error_count' => 5,
'error_count' => 4,
'message' => 'Cannot find referenced variable $b',
'line' => 3,
'error' => '$b',
Expand All @@ -100,7 +100,7 @@ function fooFoo(int $a): int {
function fooFoo(Badger\Bodger $a): Badger\Bodger {
return $a;
}',
'error_count' => 3,
'error_count' => 2,
'message' => 'Class, interface or enum named Badger\\Bodger does not exist',
'line' => 2,
'error' => 'Badger\\Bodger',
Expand Down
2 changes: 1 addition & 1 deletion tests/MagicPropertyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public function __get(string $name) : string {
}
}',
'assertions' => [],
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
'ignored_issues' => ['MixedReturnStatement'],
],
'overrideInheritedProperty' => [
'code' => '<?php
Expand Down
4 changes: 2 additions & 2 deletions tests/MethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ public static function createFromInterface(\DateTimeInterface $datetime): static
}
}',
'assertions' => [],
'ignored_issues' => ['MixedReturnStatement', 'MixedInferredReturnType'],
'ignored_issues' => ['MixedReturnStatement'],
'php_version' => '8.0',
],
'nullsafeShortCircuit' => [
Expand Down Expand Up @@ -1342,7 +1342,7 @@ public function returns_nullable_class() {
}
}',
'error_message' => 'LessSpecificReturnStatement',
'ignored_issues' => ['MixedInferredReturnType', 'MixedReturnStatement', 'MixedMethodCall'],
'ignored_issues' => ['MixedReturnStatement', 'MixedMethodCall'],
],
'undefinedVariableStaticCall' => [
'code' => '<?php
Expand Down
1 change: 0 additions & 1 deletion tests/ReferenceConstraintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function testRef() : array {
'MixedAssignment',
'MixedArrayAccess',
'MixedReturnStatement',
'MixedInferredReturnType',
'MixedOperand',
],
],
Expand Down
Loading

0 comments on commit 1628ea4

Please sign in to comment.