Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@orklah
Copy link
Collaborator

@orklah orklah commented Dec 3, 2021

This will fix #6933

The message is a little weird because it says Cannot access value on variable ARR when it's a constant, but it's not a big deal.

Didn't add test because this is just a wording issue

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Dec 3, 2021
@orklah
Copy link
Collaborator Author

orklah commented Dec 4, 2021

This revealed a deeper bug where, if a constant have a varId, it is affected by assertions a weird way and this snippet https://psalm.dev/r/8c26aa0e98 produce an error because DIRECTORY_SEPARATOR somehow became mixed

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/8c26aa0e98
<?php


class A
{
    public static function analyze(): void
    {
        $is_path_relative= false;
        if (DIRECTORY_SEPARATOR === '/') {
            $is_path_relative = true;
        }

        if ($is_path_relative) {
            echo 'a' . DIRECTORY_SEPARATOR;
        }
    }

}
Psalm output (using commit 16a61a7):

No issues!

@orklah
Copy link
Collaborator Author

orklah commented Dec 9, 2021

Well, this is working. I'm not sure I like the fact that I had to call an Analyzer inside the Reconciler though, but I couldn't see a cache of global constants and I'm not sure we're supposed to create one...

@orklah
Copy link
Collaborator Author

orklah commented Dec 9, 2021

Do you have thoughts about that @weirdan ?

@weirdan
Copy link
Collaborator

weirdan commented Dec 9, 2021

Looks good to me.

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.

Missing constant name in the error message

2 participants