rspec/rules/S1605/php/rule.adoc

22 lines
503 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
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();
}
}
----