TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.1 KiB

<?php
use TypePhp\CompilerTest;
class ClosureTest extends \BaseTest
{
public function testUseReferenceCaptureCompiles(): void
{
global $translator;
$testFile = ROOT_PATH . '/phpunit/code/closure/use-reference-capture.php';
$compiler = CompilerTest::create(ROOT_PATH);
$translator = $compiler;
$compiler->addFiles([$testFile]);
$compiler->prepareFile($testFile);
$compiler->convertFile($testFile);
$this->assertTrue(true);
}
public function testClosureRebindingIsRejectedAtCompileTime(): void
{
$this->exec(
'Closure::call() is not supported',
'closure/closure-call-unsupported.php'
);
$this->exec(
'Closure::call() is not supported',
'closure/closure-call-typed-unsupported.php'
);
$this->exec(
'Closure::bindTo() is not supported',
'closure/closure-bind-to-unsupported.php'
);
$this->exec(
'Closure::bind() is not supported',
'closure/closure-bind-unsupported.php'
);
}
}