From 0a2d27e89702b3b0d866a367de51f7761b60c32a Mon Sep 17 00:00:00 2001 From: Niklas Keller Date: Sat, 9 Jan 2021 16:03:20 +0100 Subject: [PATCH] Fix psr autoloading outside configured directory Fixes https://github.com/amphp/php-cs-fixer-config/issues/5. --- src/Fixer/Basic/PsrAutoloadingFixer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Fixer/Basic/PsrAutoloadingFixer.php b/src/Fixer/Basic/PsrAutoloadingFixer.php index 9187eda6a82..2153abd4c1f 100644 --- a/src/Fixer/Basic/PsrAutoloadingFixer.php +++ b/src/Fixer/Basic/PsrAutoloadingFixer.php @@ -137,6 +137,10 @@ protected function createConfigurationDefinition() */ protected function applyFix(\SplFileInfo $file, Tokens $tokens) { + if (null !== $this->configuration['dir'] && 0 !== strpos($file->getRealPath(), realpath($this->configuration['dir']))) { + return; + } + $namespace = null; $namespaceStartIndex = null; $namespaceEndIndex = null;