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

Default value of allow-private-mutation property warns #8701

Closed
zonuexe opened this issue Jan 12, 2023 · 1 comment · Fixed by phpstan/phpstan-src#2178
Closed

Default value of allow-private-mutation property warns #8701

zonuexe opened this issue Jan 12, 2023 · 1 comment · Fixed by phpstan/phpstan-src#2178

Comments

@zonuexe
Copy link
Contributor

zonuexe commented Jan 12, 2023

Bug report

We expect the @phpstan-readonly-allow-private-mutation property array to be appended for the following use cases.

refs #7778, phpstan/phpstan-src#1391
https://psalm.dev/docs/annotating_code/supported_annotations/#psalm-allow-private-mutation

Code snippet that reproduces the problem

<?php declare(strict_types = 1);

class ArrayLogger
{
	/**
	 * @phpstan-readonly-allow-private-mutation
	 * @var list<mixed>
	 */
	public array $logs = [];

	public function log(mixed $data): void
	{
		$this->logs[] = $data;
	}
}

https://phpstan.org/r/a7a757b2-c0cf-48a1-8402-125db9b4a37f

Expected output

No errors.

Did PHPStan help you today? Did it make you happy in any way?

Your fastest merge and release made me happy 😄

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant