Skip to content

Commit

Permalink
fix acquia#4437 - If custom environment detector returns FALSE, ensur…
Browse files Browse the repository at this point in the history
…e false is returned.
  • Loading branch information
Reuben Moes committed Jan 28, 2022
1 parent 0ac0e0e commit d5f9e06
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/Robo/Common/EnvironmentDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public static function isPantheonProdEnv() {
*/
public static function isLocalEnv() {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;
if ( !empty($results) ) {
return !in_array(FALSE, $results);
}

return parent::isLocalEnv() && !self::isPantheonEnv() && !self::isCiEnv();
Expand All @@ -116,8 +116,8 @@ public static function isLocalEnv() {
*/
public static function isDevEnv() {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;
if ( !empty($results) ) {
return !in_array(FALSE, $results);
}

return self::isAhDevEnv() || self::isPantheonDevEnv();
Expand All @@ -128,8 +128,8 @@ public static function isDevEnv() {
*/
public static function isStageEnv() {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;
if ( !empty($results) ) {
return !in_array(FALSE, $results);
}

return self::isAhStageEnv() || self::isPantheonStageEnv();
Expand All @@ -140,8 +140,8 @@ public static function isStageEnv() {
*/
public static function isProdEnv() {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;
if ( !empty($results) ) {
return in_array(TRUE, $results);
}

return self::isAhProdEnv() || self::isPantheonProdEnv();
Expand Down Expand Up @@ -339,7 +339,7 @@ private static function getSubclassResults($functionName) {
$results[] = call_user_func([$detector, $functionName]);
}
}
return array_filter($results);
return $results;
}

}

0 comments on commit d5f9e06

Please sign in to comment.