Skip to content

MIR0712

PropertyTypeRedeclarationMismatch

A property type declaration in a child class is incompatible with the parent class declaration. Property types must be compatible across the inheritance hierarchy.

<?php
class Parent {
public string $name;
}
class Child extends Parent {
public int $name; // Error: incompatible type
}

Ensure the child class property type is compatible with the parent:

<?php
class Parent {
public string $name;
}
class Child extends Parent {
// Keep the same type or use a more specific subtype
public string $name;
}