diff --git a/src/Psalm/Internal/Analyzer/MethodComparator.php b/src/Psalm/Internal/Analyzer/MethodComparator.php index 16ff2d9d98b..c4644cd3184 100644 --- a/src/Psalm/Internal/Analyzer/MethodComparator.php +++ b/src/Psalm/Internal/Analyzer/MethodComparator.php @@ -113,6 +113,20 @@ public static function compare( ); } + if (!$guide_classlike_storage->user_defined + && $implementer_classlike_storage->user_defined + && $codebase->analysis_php_version_id >= 8_01_00 + && !$implementer_method_storage->signature_return_type + ) { + IssueBuffer::maybeAdd( + new MethodSignatureMismatch( + 'Method ' . $cased_implementer_method_id . ' is missing a return type signature!', + $implementer_method_storage->location + ), + $suppressed_issues + $implementer_classlike_storage->suppressed_issues + ); + } + if ($guide_method_storage->return_type && $implementer_method_storage->return_type && !$implementer_method_storage->inherited_return_type @@ -516,6 +530,20 @@ private static function compareMethodParams( $suppressed_issues + $implementer_classlike_storage->suppressed_issues ); } + + if (!$guide_classlike_storage->user_defined + && $implementer_classlike_storage->user_defined + && $codebase->analysis_php_version_id >= 8_01_00 + && !$implementer_param->signature_type + ) { + IssueBuffer::maybeAdd( + new MethodSignatureMismatch( + 'Argument ' . ($i + 1) . ' of ' . $cased_implementer_method_id . ' is missing a type signature!', + $implementer_param->location + ), + $suppressed_issues + $implementer_classlike_storage->suppressed_issues + ); + } } /** diff --git a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php index c997199d650..0a48fb08e81 100644 --- a/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php +++ b/src/Psalm/Internal/Type/Comparator/UnionTypeComparator.php @@ -303,7 +303,7 @@ public static function isContainedByInPhp( Union $container_type ): bool { if ($container_type->isMixed()) { - return true; + return !!$input_type; } if (!$input_type) {