What potential pitfalls should be considered when designing PHP classes with constructors?

One potential pitfall when designing PHP classes with constructors is not properly handling default parameter values. To avoid this issue, it is important to set default values for parameters in the constructor to prevent errors when creating instances of the class without providing all required arguments.

class MyClass {
    private $name;

    public function __construct($name = 'Default Name') {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

// Creating an instance of MyClass without providing a name
$myObject = new MyClass();
echo $myObject->getName(); // Output: Default Name