[PSR4] Fix extra slash in NormalizeNamespaceByPSR4ComposerAutoloadRector

This commit is contained in:
TomasVotruba 2019-12-15 20:51:54 +01:00
parent 9eb47d1280
commit 1d72b06b2f
2 changed files with 6 additions and 0 deletions

View File

@ -118,6 +118,9 @@ final class NormalizeNamespaceByPSR4ComposerAutoloadRector extends AbstractRecto
$psr4Autoloads = $this->psR4AutoloadPathsProvider->provide();
foreach ($psr4Autoloads as $namespace => $path) {
// remove extra slash
$path = rtrim($path, '/');
if (Strings::startsWith($smartFileInfo->getRelativeDirectoryPath(), $path)) {
$expectedNamespace = $namespace . $this->resolveExtraNamespace($smartFileInfo, $path);

View File

@ -1,3 +1,6 @@
services:
Rector\PSR4\Rector\Namespace_\NormalizeNamespaceByPSR4ComposerAutoloadRector: ~
parameters:
exclude_paths:
- "/Fixture/"