rspec/rules/S1172/php/rule.adoc

59 lines
909 B
Plaintext
Raw Normal View History

== Why is this an issue?
include::../description.adoc[]
2020-06-30 12:47:33 +02:00
=== Exceptions
Functions in classes that override a class or implement interfaces are ignored.
2020-06-30 12:47:33 +02:00
2022-02-04 17:28:24 +01:00
[source,php]
2020-06-30 12:47:33 +02:00
----
class C extends B {
function doSomething($a, $b) { // no issue reported on $b
compute($a);
}
2020-06-30 12:47:33 +02:00
}
----
== How to fix it
2020-06-30 12:47:33 +02:00
include::../how-to-fix-it.adoc[]
=== Code examples
==== Noncompliant code example
[source,php,diff-id=1,diff-type=noncompliant]
2020-06-30 12:47:33 +02:00
----
function doSomething($a, $b) { // "$a" is unused
2020-06-30 12:47:33 +02:00
return compute($b);
}
----
==== Compliant solution
[source,php,diff-id=1,diff-type=compliant]
2020-06-30 12:47:33 +02:00
----
function doSomething($b) {
return compute($b);
2020-06-30 12:47:33 +02:00
}
----
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[]