What are the potential pitfalls of using static functions in PHP, especially when transitioning from PHP 5 to PHP 7?
Potential pitfalls of using static functions in PHP include reduced testability, tight coupling, and difficulty in mocking for unit tests. When transitioning from PHP 5 to PHP 7, it's important to refactor static functions to instance methods to improve code maintainability and testability.
class MyClass {
public function myMethod() {
// code here
}
}
// Usage
$myClass = new MyClass();
$myClass->myMethod();