Skip to content

MIR0708

InvalidOverride

A method is annotated with the #[Override] attribute (introduced in PHP 8.3), signalling that it is intended to override a method from a parent class or interface. However, no matching method exists in any ancestor, so the annotation is incorrect.

<?php
class Base {}
class Child extends Base {
#[Override]
public function process(): void {} // Base has no process() method
}

Either remove the #[Override] attribute if the method is not intended to override anything, or fix the method name / add the method to the parent class.