Skip to content

MIR0710

OverriddenPropertyAccess

A child class declares a property with the same name as a parent property but with a more restrictive visibility. PHP does not allow reducing the visibility of a property when overriding.

<?php
class Base {
public string $name = '';
}
class Child extends Base {
protected string $name = ''; // reduces visibility from public to protected
}

Keep the visibility at least as permissive as the parent property, or rename the property in the child class.