include::../description.adoc[]

== Noncompliant Code Example

----
function get_readable_status($is_running, $has_errors) {
  return $is_running ? "Running" : ($has_errors ? "Failure" : "Succeeded");  // Noncompliant
}
----

== Compliant Solution

----
function get_readable_status($is_running, $has_errors) {
  if ($is_running) {
    return "Running";
  }
  return $has_errors ? "Failure. " : "Succeeded ";
}
----

== Exceptions

Exclusively chained shorthand ternary operators ``++?:++`` are excluded from this rule.

----
$result = $option1 ?: $option2 ?: 'default';
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

include::../highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
