Skip to content

Commit

Permalink
#2407 - Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Oct 29, 2023
1 parent d319046 commit 5b8e2b1
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions Library/Backend/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
};
}
Expand Down Expand Up @@ -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().');',
};
}

Expand Down

0 comments on commit 5b8e2b1

Please sign in to comment.