Menu

← Back to property.*

Error Identifier: property.static

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 Base
{
	public int $count = 0;
}

class Child extends Base
{
	public static int $count = 0;
}

Why is it reported? #

The child class declares a static property that overrides a non-static (instance) property in the parent class. A property cannot change between static and non-static when overriding, as they represent fundamentally different kinds of storage – static properties are shared across all instances while instance properties are unique to each object.

This is a PHP language-level restriction.

How to fix it #

Match the parent property’s static/non-static declaration:

 class Child extends Base
 {
-	public static int $count = 0;
+	public int $count = 0;
 }

If a separate static counter is needed, use a different property name:

 class Child extends Base
 {
-	public static int $count = 0;
+	public static int $totalCount = 0;
 }

Non-ignorable error #

This error cannot be ignored using @phpstan-ignore or the ignoreErrors configuration. Non-ignorable errors indicate code that would cause a crash or a fatal error at runtime, or a fundamental problem in the analysed code that must be addressed.

Rules that report this error #

  • PHPStan\Rules\Properties\OverridingPropertyRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.