php-kilo/tokens.php

14 lines
277 B
PHP
Raw Normal View History

2021-03-03 13:14:44 -05:00
<?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);