Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @psalm-check-type and @psalm-check-type-exact. #7686

Merged
merged 1 commit into from Feb 17, 2022

Commits on Feb 17, 2022

  1. Add @psalm-check-type and @psalm-check-type-exact.

    I initially added these as part of my TryAnalyzer rewrite to allow testing complicated `finally` types like this:
    ```
    $foo = 1;
    try {
            $foo = 2;
    } catch (Exception $_) {
            $foo = 3;
    } finally {
            $bar = $foo;
            /** @psalm-check-type-exact $bar = 1|2|3 */;
    }
    /** @psalm-check-type-exact $bar = 2|3 */;
    ```
    Using the `'assertions'` in tests doesn't work since the type is different inside the `finally`.
    
    I decided to extract the new annotation from the rest of my changes and do a separate pull request since I think others may find it useful, and it should be much easier to review than the entire TryAnalyzer rewrite.
    AndrolGenhald committed Feb 17, 2022
    Copy the full SHA
    d09e420 View commit details
    Browse the repository at this point in the history