Menu

← Back to property.*

Error Identifier: property.abstract

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 Foo // ERROR: Non-abstract classes cannot include abstract properties.
{
	abstract public int $value { get; }
}

Why is it reported? #

PHP does not allow abstract properties in non-abstract classes. An abstract property declares a hook (like get or set) without providing an implementation, which means subclasses must provide the implementation. This only makes sense in abstract classes, where subclasses are required to implement the missing parts.

This is a PHP language-level restriction enforced since PHP 8.4, which introduced property hooks.

How to fix it #

Either make the class abstract:

 <?php declare(strict_types = 1);
 
-class Foo
+abstract class Foo
 {
 	abstract public int $value { get; }
 }

Or provide a body for the property hook:

 <?php declare(strict_types = 1);
 
 class Foo
 {
-	abstract public int $value { get; }
+	public int $value {
+		get => $this->value;
+	}
 }

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\PropertyInClassRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.