rspec/rules/S2194/php/rule.adoc
2022-02-04 16:28:24 +00:00

37 lines
669 B
Plaintext

``++include_once++`` and ``++include++`` only generate a warning if an error occurs during the operation. Because of this they should only be used after possible error conditions have been checked.
== Noncompliant Code Example
[source,php]
----
include_once $user.'_history.php'; // Noncompliant
----
== Compliant Solution
[source,php]
----
if (is_member($user)) {
include_once $user.'_history.php';
}
----
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[]