Details
-
Improvement
-
Resolution: Fixed
-
Medium
-
2017.08
Description
Due to eZ Publish's history, most of the classes use PHP4 style constructors in the form
class MyClass { function MyClass() { // Constructor $this->MyParentClass(); // More code } }
instead of
class MyClass { public function __construct() { // Constructor parent::__construct(); // More code } }
This is problematic due to the following reasons:
- If you want to use the parent's constructor, you have to call it explicitely
- Derived classes call the parent constructor by its name instead of parent::__construct() which makes the refactoring of class names cumbersome
- We don't know if and when a future version of PHP will stop supporting the PHP4 constructor methods
- PHP 7 logs deprecation errors unless they are turned off
Attachments
Issue Links
- relates to
-
EZP-13846 Use the PHP 5 __construct() method
- Closed