MIR0714
ReadonlyPropertyRedeclarationMismatch
A readonly property in a child class conflicts with the parent’s declaration, such as redeclaring a non-readonly property as readonly or vice versa.
Example
Section titled “Example”<?phpclass Parent { public string $name;}
class Child extends Parent { public readonly string $name; // Error: cannot change readonly modifier}How to fix
Section titled “How to fix”Maintain consistent readonly modifiers across the inheritance hierarchy:
<?phpclass Parent { public readonly string $name;}
class Child extends Parent { // Keep the same readonly modifier public readonly string $name;}