Skip to content

Commit

Permalink
chore: Tokens::setCode - further improvements to cache (#8053)
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus authored May 28, 2024
1 parent 604e7c2 commit 837bdba
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Tokenizer/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,8 @@ public function setCode(string $code): void

// clear memory
$this->setSize(0);
$this->blockStartCache = [];
$this->blockEndCache = [];

$tokens = token_get_all($code, TOKEN_PARSE);

Expand All @@ -1056,9 +1058,6 @@ public function setCode(string $code): void
$this[$index] = new Token($token);
}

$this->blockStartCache = [];
$this->blockEndCache = [];

$this->applyTransformers();

$this->foundTokenKinds = [];
Expand Down

0 comments on commit 837bdba

Please sign in to comment.