Skip to content

Commit

Permalink
Prevent redundant file scans
Browse files Browse the repository at this point in the history
  • Loading branch information
richardDobron committed Nov 18, 2023
1 parent d4833b7 commit 6d0c8f9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fbt/Transform/FbtTransform/FbtTransform.php
Expand Up @@ -94,7 +94,11 @@ public static function _fbtTraverse(Node $node)
*/
private static function initDefaultOptions(array $entrypoint)
{
if (isset($entrypoint['file']) && file_exists($entrypoint['file'])) {
static $cache = [];

if (isset($entrypoint['file']) && file_exists($entrypoint['file']) && ! in_array($entrypoint['file'], $cache)) {
$cache[] = $entrypoint['file'];

$comments = array_filter(
token_get_all(file_get_contents($entrypoint['file'])),
function ($entry) {
Expand Down

0 comments on commit 6d0c8f9

Please sign in to comment.