PHP code example of hhpack / typechecker-client

1. Go to this page and download the library: Download hhpack/typechecker-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hhpack / typechecker-client example snippets

hack
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;
}
hack
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;
}