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

Cannot process colon without parent #6309

Closed
davidbyoung opened this issue Aug 15, 2021 · 2 comments · Fixed by #6311
Closed

Cannot process colon without parent #6309

davidbyoung opened this issue Aug 15, 2021 · 2 comments · Fixed by #6311

Comments

@davidbyoung
Copy link

This broke with as of 4.9.3, and was working properly in 4.9.2.

https://psalm.dev/r/d76feed5ec

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/d76feed5ec
<?php

declare(strict_types=1);

/**
 * @template T
 */
class Set
{
    /** @var array<string, T> */
    private array $values = [];
    
    /**
     * @param array<string, T> $values
     */
    public function intersect(array $values): array
    {
        $intersectedValues = [];
        
        foreach ($this->values as $value) {
            if (\in_array($value, $values, true)) {
                $intersectedValues[] = $value;
            }
        }
        
        return $intersectedValues;
    }
}
Psalm encountered an internal error:

/vendor/vimeo/psalm/src/Psalm/Internal/Type/ParseTreeCreator.php: Cannot process colon without parent

@orklah
Copy link
Collaborator

orklah commented Aug 15, 2021

@supersmile2009 it appears we're trying to parse the assertion string "in-array-T:Set as mixed". I think templates should have a special handling for in_array. Can you check if you can tweak your PR?

For reference: #6233

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants