diff --git a/src/AopKernel.php b/src/AopKernel.php index 677120a..1a79ea5 100644 --- a/src/AopKernel.php +++ b/src/AopKernel.php @@ -57,6 +57,13 @@ abstract class AopKernel extends CodeTransformerKernel */ protected ?string $cacheDir = null; + /** + * The exclude paths. Paths/directories in this array will be excluded + * + * @var array + */ + protected array $excludePaths = []; + // endregion /** diff --git a/src/Core/AutoloadInterceptor/ClassLoader.php b/src/Core/AutoloadInterceptor/ClassLoader.php index df66749..7b2ccbf 100644 --- a/src/Core/AutoloadInterceptor/ClassLoader.php +++ b/src/Core/AutoloadInterceptor/ClassLoader.php @@ -58,6 +58,11 @@ public function findFile($namespacedClass): false|string $filePath = Path::resolve($filePath); + foreach ($this->options->getExcludePaths() as $path) { + if (str_starts_with($filePath, Path::resolve($path))) { + return $filePath; + } + } // Query cache state $cacheState = $this->cacheStateManager->queryCacheState($filePath);