Skip to content

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

@zonuexe

Description

@zonuexe

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 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions