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

fix empty string not quoted in keyed array offset #7309

Merged
merged 2 commits into from
Jan 6, 2022

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Jan 5, 2022

This will fix an error I thought about while looking for another bug.

The error can be seen here but it applies more widely, for example on psalter fixes for MissingReturnType with the same structure

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/3e6d50f022
<?php

class A
{
    function test(): void
    {
        $a = ['' => ''];

        /** @var array<string, mixed> $b */
        $b = [];

        $this->assertSame($a, $b);
    }

    /**
     * @template T
     * @param T      $expected
     * @psalm-assert =T $actual
     */
    public function assertSame(mixed $expected, mixed $actual): void
    {
        return;
    }
}
Psalm output (using commit b8240e2):

ERROR: InvalidDocblock - 12:16 - array{: ""} cannot be used in an assertion

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Jan 5, 2022
@orklah orklah merged commit 18ab5a0 into vimeo:4.x Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants