diff --git a/Library/Backend/Backend.php b/Library/Backend/Backend.php index e9845001b..c37867a6d 100644 --- a/Library/Backend/Backend.php +++ b/Library/Backend/Backend.php @@ -250,15 +250,15 @@ public function getTypeofCondition( $variableName = $this->getVariableCode($variableVariable); return match ($value) { - 'array' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_ARRAY', - 'object' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_OBJECT', - 'null' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_NULL', - 'string' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_STRING', - 'int', 'long', 'integer' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_LONG', - 'double', 'float' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_DOUBLE', - 'boolean', 'bool' => '((Z_TYPE_P(' . $variableName . ') == IS_TRUE || Z_TYPE_P(' . $variableName . ') == IS_FALSE) ' . $operator . ' 1)', - 'resource' => 'Z_TYPE_P(' . $variableName . ') ' . $operator . ' IS_RESOURCE', - 'callable' => 'zephir_is_callable(' . $variableName . ') ' . $operator . ' 1', + 'array' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_ARRAY', + 'object' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_OBJECT', + 'null' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_NULL', + 'string' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_STRING', + 'int', 'long', 'integer' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_LONG', + 'double', 'float' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_DOUBLE', + 'boolean', 'bool' => '((Z_TYPE_P('.$variableName.') == IS_TRUE || Z_TYPE_P('.$variableName.') == IS_FALSE) '.$operator.' 1)', + 'resource' => 'Z_TYPE_P('.$variableName.') '.$operator.' IS_RESOURCE', + 'callable' => 'zephir_is_callable('.$variableName.') '.$operator.' 1', default => throw new CompilerException(sprintf('Unknown type: "%s" in typeof comparison', $value)), }; } @@ -304,11 +304,12 @@ public function generateInitCode(&$groupVariables, $type, $pointer, Variable $va if ($isComplex && !$variable->isDoublePointer()) { $groupVariables[] = $variable->getName(); + return match ($variable->getRealname()) { - '__$null' => "\t" . 'ZVAL_NULL(&' . $variable->getName() . ');', - '__$true' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 1);', - '__$false' => "\t" . 'ZVAL_BOOL(&' . $variable->getName() . ', 0);', - default => "\t" . 'ZVAL_UNDEF(&' . $variable->getName() . ');', + '__$null' => "\t".'ZVAL_NULL(&'.$variable->getName().');', + '__$true' => "\t".'ZVAL_BOOL(&'.$variable->getName().', 1);', + '__$false' => "\t".'ZVAL_BOOL(&'.$variable->getName().', 0);', + default => "\t".'ZVAL_UNDEF(&'.$variable->getName().');', }; }