diff --git a/app/Cfnpp/Expression/Token/OperatorBinary.php b/app/Cfnpp/Expression/Token/OperatorBinary.php index 3510438..a0b82fb 100644 --- a/app/Cfnpp/Expression/Token/OperatorBinary.php +++ b/app/Cfnpp/Expression/Token/OperatorBinary.php @@ -102,18 +102,18 @@ class OperatorBinary extends TokenBinary implements ICloudformationNative } elseif (is_scalar($value1)) { - return $value1 ? $value2 : false; + return $value1 ? $arguments[1] : false; } elseif (is_scalar($value2)) { - return $value2 ? $value1 : false; + return $value2 ? $arguments[0] : false; } elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName()) { return $value1; } - return null; + return null; case 'or': if (is_scalar($value1) && is_scalar($value2)) @@ -122,18 +122,18 @@ class OperatorBinary extends TokenBinary implements ICloudformationNative } elseif (is_scalar($value1)) { - return $value1 ? true : $value1; + return $value1 ? true : $arguments[1]; } elseif (is_scalar($value2)) { - return $value2 ? true : $value1; + return $value2 ? true : $arguments[0]; } elseif ($value1 instanceof Parameter && $value2 instanceof Parameter && $value1->getName() == $value2->getName()) { return $value1; } - return null; + return null; case 'eq': if (is_scalar($value1) && is_scalar($value2)) @@ -145,7 +145,7 @@ class OperatorBinary extends TokenBinary implements ICloudformationNative return true; } - return null; + return null; default: throw new \Exception('Missing implementation for unary operator: '.$this->getOperator());