Skip to content

Commit 4c1c369

Browse files
committed
perf: drop the class-name check in filter discovery
1 parent 621b2eb commit 4c1c369

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

‎system/Filters/Filters.php‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ private function discoverFilters(): void
154154

155155
$files = $locator->search('Config/Filters.php');
156156

157-
// Our main Filter configs are never included again, see below. Skip them
158-
// by path, as reading and tokenizing them to find that out is wasted work.
157+
// Don't include our main Filter configs again. They are skipped by path,
158+
// as reading and tokenizing them to find their class is wasted work.
159+
// APPPATH, SYSTEMPATH and the paths from search() are all real paths.
159160
$mainFiles = [
160161
APPPATH . 'Config' . DIRECTORY_SEPARATOR . 'Filters.php',
161162
SYSTEMPATH . 'Config' . DIRECTORY_SEPARATOR . 'Filters.php',
@@ -166,14 +167,6 @@ private function discoverFilters(): void
166167
continue;
167168
}
168169

169-
// The $file may not be a class file.
170-
$className = $locator->getClassname($file);
171-
172-
// Don't include our main Filter config again...
173-
if ($className === FiltersConfig::class || $className === BaseFiltersConfig::class) {
174-
continue;
175-
}
176-
177170
include $file;
178171
}
179172
}

0 commit comments

Comments
 (0)