rspec/rules/S2194/php/rule.adoc

37 lines
669 B
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++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.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
include_once $user.'_history.php'; // Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
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[]