hhpack/typechecker-client

This package is abandoned and no longer maintained. No replacement package was suggested.

Type checker client library for Hack

1.0.0 2017-02-18 06:33 UTC

This package is not auto-updated.

Last update: 2020-01-17 13:48:23 UTC


README

Latest Stable Version Build Status Dependency Status License

Basic usage

Examples of the type of check will be as follows.

use HHPack\TypeChecker\TypeCheckerClient;

$client = new TypeCheckerClient(getcwd());

await $client->restart();

$result = await $client->check();

if ($result->isPassed()) {
    echo "Passed!!", PHP_EOL;
} else {
    echo "Failed!!", PHP_EOL;
}

Type of coverage

Examples of the type of coverage will be as follows.

use HHPack\TypeChecker\TypeCheckerClient;
use HHPack\TypeChecker\Coverage\File;

$client = new TypeCheckerClient(getcwd());
await $client->restart();

$result = await $client->coverage();
$files = $result->filter(($item) ==> {
    return $item instanceof File;
});

foreach ($files as $file) {
    $formattedParsentage = sprintf('%6.2f%%', (float) $file->parsentage() * 100); 
    echo $formattedParsentage, ' ', $file->name(), PHP_EOL;
}

API of Client

  • version - return type checker version
  • init - generate configuration file
  • start - starts a hack server
  • stop - stops a hack server
  • restart - restarts a hack server
  • check - return result of type check
  • coverage - return result of coverage

Run the test

You can run the test with the following command.

composer install
composer test