|
21 | 21 | use Zephir\GlobalConstant;
|
22 | 22 | use Zephir\Variable;
|
23 | 23 |
|
| 24 | +use function in_array; |
| 25 | + |
24 | 26 | /**
|
25 |
| - * Zephir\Backends\ZendEngine2\Backend. |
26 |
| - * |
27 | 27 | * NOTE: ZendEngine2 backend is no longer supported
|
28 | 28 | * and this class will be removed in the future.
|
29 | 29 | */
|
@@ -300,7 +300,7 @@ public function addArrayEntry(Variable $variable, $key, $value, CompilationConte
|
300 | 300 | $var = $context->symbolTable->getVariableForRead($key->getCode(), $context);
|
301 | 301 | $typeKey = $var->getType();
|
302 | 302 | }
|
303 |
| - if (\in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { |
| 303 | + if (in_array($typeKey, ['int', 'uint', 'long', 'ulong'])) { |
304 | 304 | $keyType = 'index';
|
305 | 305 | }
|
306 | 306 | }
|
@@ -455,7 +455,7 @@ public function arrayFetch(Variable $var, Variable $src, $index, $flags, $arrayA
|
455 | 455 | $arrayAccess['right']
|
456 | 456 | );
|
457 | 457 | }
|
458 |
| - if ($isVariable && \in_array($index->getType(), ['variable', 'string', 'mixed'])) { |
| 458 | + if ($isVariable && in_array($index->getType(), ['variable', 'string', 'mixed'])) { |
459 | 459 | $output = 'zephir_array_fetch('.$this->getVariableCodePointer($var).', '.$this->getVariableCode($src).', '.$this->getVariableCode($index).', '.$flags.', "'.Compiler::getShortUserPath($arrayAccess['file']).'", '.$arrayAccess['line'].');';
|
460 | 460 | } else {
|
461 | 461 | if ($isVariable) {
|
@@ -500,20 +500,21 @@ public function arrayIssetFetch(Variable $target, Variable $var, $resolvedExpr,
|
500 | 500 | $code = $this->getVariableCodePointer($target).', '.$this->getVariableCode($var);
|
501 | 501 |
|
502 | 502 | if (!($resolvedExpr instanceof Variable)) {
|
503 |
| - if ('string' == $resolvedExpr->getType()) { |
| 503 | + if ('string' === $resolvedExpr->getType()) { |
504 | 504 | return new CompiledExpression('bool', 'zephir_array_isset_string_fetch('.$code.', SS("'.$resolvedExpr->getCode().'"), '.$flags.')', $expression);
|
505 |
| - } elseif (\in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { |
| 505 | + } elseif (in_array($resolvedExpr->getType(), ['int', 'uint', 'long'])) { |
506 | 506 | return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$resolvedExpr->getCode().', '.$flags.')', $expression);
|
507 | 507 | } else {
|
508 | 508 | $resolvedExpr = $context->symbolTable->getVariableForRead($resolvedExpr->getCode(), $context);
|
509 | 509 | }
|
510 | 510 | }
|
511 | 511 |
|
512 |
| - if ('int' == $resolvedExpr->getType() || 'long' == $resolvedExpr->getType()) { |
| 512 | + if (in_array($resolvedExpr->getType(), ['int', 'long'])) { |
513 | 513 | return new CompiledExpression('bool', 'zephir_array_isset_long_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression);
|
514 |
| - } elseif ('variable' == $resolvedExpr->getType() || 'string' == $resolvedExpr->getType()) { |
| 514 | + } elseif (in_array($resolvedExpr->getType(), ['variable', 'mixed', 'string'])) { |
515 | 515 | return new CompiledExpression('bool', 'zephir_array_isset_fetch('.$code.', '.$this->getVariableCode($resolvedExpr).', '.$flags.')', $expression);
|
516 | 516 | }
|
| 517 | + |
517 | 518 | throw new CompilerException('arrayIssetFetch ['.$resolvedExpr->getType().']', $expression);
|
518 | 519 | }
|
519 | 520 |
|
|
0 commit comments