*/ private $included_files = []; /** * @template T * @param callable():T $f * @return T */ public function runAndCollect(callable $f) { $before = get_included_files(); $ret = $f(); $after = get_included_files(); $included = array_diff($after, $before); $this->included_files = array_values(array_unique(array_merge($this->included_files, $included))); return $ret; } /** @return list */ public function getIncludedFiles(): array { return $this->included_files; } /** @return list */ public function getFilteredIncludedFiles(): array { return array_values(preg_grep('@^phar://@', $this->getIncludedFiles(), PREG_GREP_INVERT)); } }