What is the best practice for passing parameters to functions or methods in PHP classes?

When passing parameters to functions or methods in PHP classes, it is best practice to use type hinting to ensure that the correct data type is passed. This helps prevent errors and makes the code more readable and maintainable. Additionally, providing default parameter values can make the code more flexible and easier to use.

class MyClass {
    public function myMethod(string $param1, int $param2 = 0) {
        // Method implementation here
    }
}

$instance = new MyClass();
$instance->myMethod('Hello', 5);