What are some potential pitfalls of using inheritance in PHP object-oriented programming?

One potential pitfall of using inheritance in PHP object-oriented programming is the issue of tightly coupled classes, where changes in the parent class can have unintended effects on child classes. To solve this, consider using composition over inheritance, which involves creating separate classes that contain instances of other classes rather than inheriting from them directly.

class ParentClass {
    // Parent class implementation
}

class ChildClass {
    private $parent;

    public function __construct(ParentClass $parent) {
        $this->parent = $parent;
    }

    // Child class implementation using $this->parent
}