addFiles([$source]); $compiler->prepareFile($source); $generated = $compiler->convertFile($source); $code = file_get_contents($generated); self::assertIsString($code); self::assertStringContainsString( 'auto direct = [base = base](php::Var value) mutable -> php::Var {', $code, ); self::assertStringContainsString('direct(2L)', $code); self::assertStringNotContainsString('typephp_call_cached(direct', $code); // Only the escaping closure needs a real Zend Closure. The local reference // capture uses the storage selected by the function degradation table. self::assertSame(1, substr_count($code, 'php::newClosureWithParameters(')); self::assertStringContainsString( 'auto dynamicRef = [&dynamic]() mutable -> php::Var {', $code, ); self::assertStringNotContainsString('typephp_call_cached(dynamicRef', $code); } }