Zephir\Passes\LocalContextPass::passLetStatement PHP Method

passLetStatement() public method

public passLetStatement ( array $statement )
$statement array
    public function passLetStatement(array $statement)
    {
        foreach ($statement['assignments'] as $assignment) {
            if (isset($assignment['expr'])) {
                $this->passExpression($assignment['expr']);
            }
            $this->increaseMutations($assignment['variable']);
            switch ($assignment['assign-type']) {
                case 'variable':
                    switch ($assignment['operator']) {
                        case 'mul-assign':
                        case 'sub-assign':
                        case 'add-assign':
                            $this->markVariableNoLocal($assignment['variable']);
                            break;
                    }
                    switch ($assignment['expr']['type']) {
                        case 'property-access':
                        case 'property-dynamic-access':
                        case 'property-string-access':
                        case 'array-access':
                        case 'static-property-access':
                        case 'static-constant-access':
                        case 'string':
                        case 'array':
                        case 'empty-array':
                        case 'fcall':
                        case 'mcall':
                        case 'scall':
                        case 'concat':
                        case 'clone':
                        case 'require':
                        case 'type-hint':
                        case 'minus':
                        case 'new':
                        case 'new-type':
                        case 'closure':
                        case 'closure-arrow':
                        case 'reference':
                        case 'irange':
                        case 'erange':
                            $this->markVariableNoLocal($assignment['variable']);
                            break;
                        case 'constant':
                            if (defined($assignment['expr']['value'])) {
                                if (gettype(constant($assignment['expr']['value'])) == 'string') {
                                    $this->markVariableNoLocal($assignment['variable']);
                                }
                            }
                            break;
                        case 'variable':
                            $this->markVariableNoLocal($assignment['expr']['value']);
                            $this->markVariableNoLocal($assignment['variable']);
                            break;
                        case 'cast':
                            switch ($assignment['expr']['left']) {
                                case 'array':
                                case 'string':
                                    $this->markVariableNoLocal($assignment['variable']);
                                    break;
                            }
                            break;
                        default:
                            //echo '[', $assignment['expr']['type'], ']', PHP_EOL;
                    }
                    break;
                case 'object-property':
                case 'array-index':
                case 'object-property-array-index':
                case 'object-property-append':
                    switch ($assignment['expr']['type']) {
                        case 'variable':
                            $this->markVariableNoLocal($assignment['expr']['value']);
                            break;
                    }
                    $this->markVariableNoLocal($assignment['variable']);
                    break;
                case 'variable-append':
                    $this->markVariableNoLocal($assignment['variable']);
                    switch ($assignment['expr']['type']) {
                        case 'variable':
                            $this->markVariableNoLocal($assignment['expr']['value']);
                            break;
                        default:
                            //echo '[', $assignment['assign-type'], ']';
                    }
                    break;
                default:
                    //echo $assignment['assign-type'];
            }
        }
    }