25 lines
506 B
Plaintext
25 lines
506 B
Plaintext
In PHP 5 both the way to declare a constructor and the way to make a call to a parent constructor have evolved. When declaring constructors with the PHP5 ``++__construct++`` name, nested calls to parent constructors should also use the new ``++__constructor++`` name.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
----
|
|
class Foo extends Bar {
|
|
function __construct() {
|
|
parent::Bar();
|
|
}
|
|
}
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
----
|
|
class Foo extends Bar {
|
|
function __construct() {
|
|
parent::__construct();
|
|
}
|
|
}
|
|
----
|
|
|