What potential pitfalls should be avoided when creating methods within a class that implements an interface in PHP?
When creating methods within a class that implements an interface in PHP, a potential pitfall to avoid is not properly implementing all the methods specified in the interface. To solve this issue, make sure to include all the methods defined in the interface within the class. This ensures that the class adheres to the contract specified by the interface.
interface Logger {
public function log($message);
}
class FileLogger implements Logger {
public function log($message) {
// implementation of log method
}
}