php-kilo/tokens.php
Timothy J Warren 9280b77d1e
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
Highlight more token types
2021-03-03 13:14:44 -05:00

14 lines
277 B
PHP

<?php declare(strict_types=1);
$file = file_get_contents('test.php');
$tokens = PhpToken::tokenize($file);
function addName (PhpToken $token): PhpToken
{
$token->type = $token->getTokenName();
return $token;
}
$tokens = array_map('addName', $tokens);
var_export($tokens);