What are the potential drawbacks of passing values directly to a method in PHP classes?

Passing values directly to a method in PHP classes can lead to tight coupling between the caller and the method, making the code harder to maintain and test. To solve this issue, it's recommended to use dependency injection, where the dependencies are injected into the class rather than being passed directly to the method.

class MyClass {
    private $dependency;

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

    public function myMethod() {
        // Use $this->dependency here
    }
}

$dependency = new Dependency();
$myClass = new MyClass($dependency);
$myClass->myMethod();