-
-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Description
when parsing lots of files, working with the Token class has some method call overhead.
to reduce this to a minimum, we could turn this class into a pure value-object, meaning turn all properties readonly (which would require PHP8.1+) or even use a readonly class (which would require PHP8.2+) and turn all properties public:
<?php declare(strict_types = 1);
namespace TheSeer\Tokenizer;
readonly class Token {
public function __construct(
public int $line,
public string $name,
public string $value
) {}
}that way accessing the data would get very fast
alternatively we could switch from token_get_all to PhpToken::tokenize() which internally uses a Token class similar to the above one.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels