Skip to content

Handle finally is not correct after update psalm to 3.18 #4368

@b-vadym

Description

@b-vadym

https://psalm.dev/r/560c67d308

   <?php

   function fooFunction (): string
   {
       try{
           $foo = 'foo';
       } finally {
       }
    
       return $foo;
   } 

Expected: No issues
Actual:
INFO: PossiblyUndefinedVariable - 10:12 - Possibly undefined variable $foo defined in try block

ERROR: InvalidReturnStatement - 10:12 - The inferred type 'string(foo)' does not match the declared return type 'string' for fooFunction

ERROR: InvalidReturnType - 3:26 - The declared return type 'string' for fooFunction is incorrect, got 'string(foo)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions