rspec/rules/S1603/php/rule.adoc

39 lines
839 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
In PHP 4, any function with the same name as the nesting class was considered a class constructor. In PHP 5, this mechanism has been deprecated and the ``++__construct++`` method name should be used instead. If both styles are present in the same class, PHP 5 will treat the function named ``++__construct++`` as the class constructor.
This rule rule raises an issue for each method with the same name as the enclosing class.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
class Foo {
function Foo(){...}
}
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
class Foo {
function __construct(){...}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]