rspec/rules/S3772/php/rule.adoc

34 lines
765 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
When a function parameter has a nullable type, e.g., parameter ``++param++`` in ``++f(?int param)++``, it must be explicitly provided in every function call. A nullable-type parameter has no default value.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
function f(?int param) {}
f();
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
function f(?int param) {}
f(0);
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== on 2 Nov 2016, 13:31:50 Ann Campbell wrote:
\[~yves.duboispelerin] what "bad thing" will happen if you violate this rule? We need to show the justification for making this a Bug, and also need to know that when evaluating severity.
endif::env-github,rspecator-view[]