Menu

← Back to property.*

Error Identifier: property.missingOverride

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);

abstract class Base
{
	public string $name {
		get => 'base';
	}
}

class Child extends Base
{
	public string $name { // ERROR: Property Child::$name overrides property Base::$name but is missing the #[\Override] attribute.
		get => 'child';
	}
}

Why is it reported? #

When a child class overrides a property from a parent class, adding the #[\Override] attribute documents the intent and provides safety. If the parent property is later renamed or removed, PHP will report an error, preventing silent bugs where the child property no longer overrides anything.

This check is controlled by the checkMissingOverrideMethodAttribute configuration option.

How to fix it #

Add the #[\Override] attribute to the overriding property:

 <?php declare(strict_types = 1);
 
 abstract class Base
 {
 	public string $name {
 		get => 'base';
 	}
 }

 class Child extends Base
 {
+	#[\Override]
 	public string $name {
 		get => 'child';
 	}
 }

How to ignore this error #

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

// @phpstan-ignore property.missingOverride
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.missingOverride

Rules that report this error #

  • PHPStan\Rules\Properties\OverridingPropertyRule [1]

Edit this page on GitHub

Theme
A
© 2026 PHPStan s.r.o.