Skip to content

Commit

Permalink
updates environment detector to use actual result of subclass
Browse files Browse the repository at this point in the history
  • Loading branch information
shelane committed Apr 1, 2024
1 parent 1d94ad0 commit 5450a4c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/Robo/Common/EnvironmentDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,21 @@ public static function isPantheonProdEnv(): bool {
*/
public static function isLocalEnv(): bool {
$results = self::getSubclassResults(__FUNCTION__);
if ($results) {
return TRUE;

// If subclass results are found, return them directly.
if ($results !== null) {
// If it's not an array, return it directly.
if (!is_array($results)) {
return $results;
}
// If it's an array, check if it contains true.
if (in_array(true, $results, true)) {
return true;
}
// If it contains only false, return false.
if (!in_array(true, $results, true) && in_array(false, $results, true)) {
return false;
}
}

return parent::isLocalEnv() && !self::isPantheonEnv() && !self::isCiEnv();
Expand Down

0 comments on commit 5450a4c

Please sign in to comment.