What best practices should be followed when extending classes in PHP to avoid errors like "Undefined class constant"?

When extending classes in PHP, it is important to ensure that all class constants used in the parent class are also defined in the child class to avoid errors like "Undefined class constant". To solve this issue, simply define the missing class constants in the child class with the same values as in the parent class.

class ParentClass {
    const CONSTANT_ONE = 'Value One';
    const CONSTANT_TWO = 'Value Two';
}

class ChildClass extends ParentClass {
    const CONSTANT_ONE = 'Value One';
    const CONSTANT_TWO = 'Value Two';
}