In what scenarios is it justified to use interfaces for method hints in PHP, and when is it more practical to rely on concrete classes?

When you want to provide method hints without enforcing a specific implementation, it is justified to use interfaces in PHP. This allows for flexibility in implementing the methods in different classes while still ensuring that certain methods are present. On the other hand, when you have a specific implementation that you want to enforce across multiple classes, it is more practical to rely on concrete classes.

// Using an interface for method hints
interface Logger {
    public function log($message);
}

class FileLogger implements Logger {
    public function log($message) {
        // Log message to a file
    }
}

class DatabaseLogger implements Logger {
    public function log($message) {
        // Log message to a database
    }
}

// Using a concrete class for method hints
class Car {
    public function drive() {
        // Drive the car
    }
}

class Motorcycle extends Car {
    public function drive() {
        // Drive the motorcycle
    }
}