rspec/rules/S2166/php/rule.adoc

49 lines
982 B
Plaintext
Raw Normal View History

2020-06-30 12:48:07 +02:00
include::../description.adoc[]
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,php]
2020-06-30 12:48:07 +02:00
----
class FruitException { // Noncompliant; this has nothing to do with Exception
private $expected;
private $unusualCharacteristics;
private $appropriateForCommercialExploitation;
// ...
}
class CarException { // Noncompliant; the extends clause was forgotten?
public function __construct(string message, Throwable cause) {
// ...
----
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,php]
2020-06-30 12:48:07 +02:00
----
class FruitSport {
private $expected;
private $unusualCharacteristics;
private $appropriateForCommercialExploitation;
// ...
}
class CarException extends Exception {
public function __construct(string message, Throwable cause) {
// ...
----
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[]