How can a PHP developer ensure proper usage of method chaining to call multiple sub-classes within a class?

To ensure proper usage of method chaining to call multiple sub-classes within a class in PHP, the developer should return `$this` at the end of each method in the class that needs to be chained. This allows the methods to be called in a sequential manner on the same object instance.

class ParentClass {
    public function method1() {
        // do something
        return $this;
    }

    public function method2() {
        // do something
        return $this;
    }
}

$object = new ParentClass();
$object->method1()->method2();