Library/Operators/Other/TypeHintOperator.php
public function compile(array $expression, CompilationContext $compilationContext)
    {
        $expr = new Expression($expression['right']);
        $expr->setReadOnly(true);
        $resolved = $expr->compile($compilationContext);

        if ('variable' != $resolved->getType()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable = $compilationContext->symbolTable->getVariableForRead(
            $resolved->getCode(),
            $compilationContext,
            $expression
        );

        if (!$symbolVariable->isVariable()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable->setDynamicTypes('object');
        $symbolVariable->setClassTypes($compilationContext->getFullName($expression['left']['value']));

        return $resolved;
    }
public function compile(array $expression, CompilationContext $compilationContext)
    {
        $expr = new Expression($expression['right']);
        $expr->setReadOnly(true);
        $resolved = $expr->compile($compilationContext);

        if ('variable' != $resolved->getType()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable = $compilationContext->symbolTable->getVariableForRead(
            $resolved->getCode(),
            $compilationContext,
            $expression
        );

        if (!$symbolVariable->isVariable()) {
            throw new CompilerException('Type-Hints only can be applied to dynamic variables.', $expression);
        }

        $symbolVariable->setDynamicTypes('object');
        $symbolVariable->setClassTypes($compilationContext->getFullName($expression['left']['value']));

        return $resolved;
    }
public function compile ( array $ expression , CompilationContext $ compilationContext ) { $ expr = new Expression ( $ expression [ 'right' ] ) ; $ expr -> setReadOnly ( true ) ; $ resolved = $ expr -> compile ( $ compilationContext ) ; if ( 'variable' != $ resolved -> getType ( ) ) { throw new CompilerException ( 'Type-Hints only can be applied to dynamic variables.' , $ expression ) ; } $ symbolVariable = $ compilationContext -> symbolTable -> getVariableForRead ( $ resolved -> getCode ( ) , $ compilationContext , $ expression ) ; if ( ! $ symbolVariable -> isVariable ( ) ) { throw new CompilerException ( 'Type-Hints only can be applied to dynamic variables.' , $ expression ) ; } $ symbolVariable -> setDynamicTypes ( 'object' ) ; $ symbolVariable -> setClassTypes ( $ compilationContext -> getFullName ( $ expression [ 'left' ] [ 'value' ] ) ) ; return $ resolved ; }
Performs type-hint compilation.

@param array              $expression
@param CompilationContext $compilationContext

@throws CompilerException

@return CompiledExpression
Performs type - hint compilation .