diff --git a/UPGRADING.md b/UPGRADING.md index 40251bc89e3..8dafd844e3b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -196,4 +196,4 @@ - [BC] Method `Psalm\Issue\CodeIssue::getMessage()` was removed - [BC] Method `Psalm\DocComment::parse()` was removed - [BC] Class `Psalm\Type\Atomic\THtmlEscapedString` has been removed - - [BC] Property `Psalm\Context::$vars_from_global` has been removed + - [BC] Property `Psalm\Context::$vars_from_global` has been renamed to `$referenced_globals` diff --git a/docs/running_psalm/issues.md b/docs/running_psalm/issues.md index a57d76b9e4f..a06d6349e7e 100644 --- a/docs/running_psalm/issues.md +++ b/docs/running_psalm/issues.md @@ -216,6 +216,7 @@ - [RedundantIdentityWithTrue](issues/RedundantIdentityWithTrue.md) - [RedundantPropertyInitializationCheck](issues/RedundantPropertyInitializationCheck.md) - [ReferenceConstraintViolation](issues/ReferenceConstraintViolation.md) + - [ReferenceReusedFromConfusingScope](issues/ReferenceReusedFromConfusingScope.md) - [ReservedWord](issues/ReservedWord.md) - [StringIncrement](issues/StringIncrement.md) - [TaintedCallable](issues/TaintedCallable.md) diff --git a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php index 7099db0f9ba..a04e72d9740 100644 --- a/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/GlobalAnalyzer.php @@ -8,7 +8,6 @@ use Psalm\Internal\Analyzer\FunctionLikeAnalyzer; use Psalm\Internal\Analyzer\Statements\Expression\Fetch\VariableFetchAnalyzer; use Psalm\Internal\Analyzer\StatementsAnalyzer; -use Psalm\Internal\Codebase\VariableUseGraph; use Psalm\Internal\DataFlow\DataFlowNode; use Psalm\Internal\ReferenceConstraint; use Psalm\Issue\InvalidGlobal; @@ -93,10 +92,8 @@ public static function analyze( $var_id ); - if ($statements_analyzer->data_flow_graph instanceof VariableUseGraph) { - if ($global_context !== null && $global_context->hasVariable($var_id)) { - $global_context->referenced_globals[$var_id] = true; - } + if ($global_context !== null && $global_context->hasVariable($var_id)) { + $global_context->referenced_globals[$var_id] = true; } } } diff --git a/src/Psalm/Internal/Type/TypeExpander.php b/src/Psalm/Internal/Type/TypeExpander.php index 5901ced6e19..97c1a8854a8 100644 --- a/src/Psalm/Internal/Type/TypeExpander.php +++ b/src/Psalm/Internal/Type/TypeExpander.php @@ -125,6 +125,8 @@ public static function expandUnion( * @param string|TNamedObject|TTemplateParam|null $static_class_type * * @return non-empty-list + * + * @psalm-suppress ComplexMethod */ public static function expandAtomic( Codebase $codebase, diff --git a/src/Psalm/Issue/ReferenceReusedFromConfusingScope.php b/src/Psalm/Issue/ReferenceReusedFromConfusingScope.php index 31332b98bc0..6c88cf67b26 100644 --- a/src/Psalm/Issue/ReferenceReusedFromConfusingScope.php +++ b/src/Psalm/Issue/ReferenceReusedFromConfusingScope.php @@ -5,5 +5,5 @@ class ReferenceReusedFromConfusingScope extends CodeIssue { public const ERROR_LEVEL = 4; - public const SHORTCODE = 303; + public const SHORTCODE = 308; } diff --git a/src/Psalm/Type/Reconciler.php b/src/Psalm/Type/Reconciler.php index 22c137320ec..b4002e597a4 100644 --- a/src/Psalm/Type/Reconciler.php +++ b/src/Psalm/Type/Reconciler.php @@ -95,8 +95,6 @@ class Reconciler * @param array> $template_type_map * * @return array - * - * @psalm-suppress ComplexMethod */ public static function reconcileKeyedTypes( array $new_types,