Menu

← Back to property.*

Error Identifier: property.staticAsymmetricVisibility

Every error reported by PHPStan has an error identifier. Here’s a list of all error identifiers. In PHPStan Pro you can see the error identifier next to each error and filter errors by their identifiers.

Code example #

<?php declare(strict_types = 1);

class Counter
{

	public protected(set) static int $count = 0;

}

Why is it reported? #

Asymmetric visibility (such as protected(set) or private(set)) is being used on a static property, but this combination is only supported on PHP 8.5 and later. On earlier PHP versions, static properties cannot have different read and write visibility levels.

How to fix it #

Remove the asymmetric visibility from the static property:

 <?php declare(strict_types = 1);
 
 class Counter
 {

-	public protected(set) static int $count = 0;
+	protected static int $count = 0;

 }

Alternatively, upgrade to PHP 8.5 or later where asymmetric visibility for static properties is supported.

How to ignore this error #

You can use the identifier property.staticAsymmetricVisibility to ignore this error using a comment:

// @phpstan-ignore property.staticAsymmetricVisibility
codeThatProducesTheError();

You can also use only the identifier key to ignore all errors of the same type in your configuration file in the ignoreErrors parameter:

parameters:
	ignoreErrors:
		-
			identifier: property.staticAsymmetricVisibility

Rules that report this error #

  • PHPStan\Rules\Properties\PropertyInClassRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.