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

ImpureArgument is not spotted when values are given in an array #2946

Closed
LeSuisse opened this issue Mar 9, 2020 · 1 comment
Closed

ImpureArgument is not spotted when values are given in an array #2946

LeSuisse opened this issue Mar 9, 2020 · 1 comment
Labels

Comments

@LeSuisse
Copy link
Contributor

LeSuisse commented Mar 9, 2020

I would expect that Psalm complains about an ImpureArgument in this situation: https://psalm.dev/r/32d15575cf

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/32d15575cf
<?php

class Item {
}
  
/** 
 * @psalm-immutable
 */
class Immutable {
    /**
     * @var Item[]
     */
  	private $items;
  
    /**
     * @param Item[] $items
     */
  	public function __construct(array $items)
  	{
    	$this->items = $items;
  	}
}
$item = new Item();
new Immutable([$item]);
Psalm output (using commit a0da735):

No issues!

@muglug muglug added the bug label Mar 9, 2020
@muglug muglug closed this as completed in 2c0cf40 Mar 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants