move $length variable outsite foreach (#6828)

the `foreach` over the `prefixDirsPsr4[$search]` won't affect `$length`. 

It's used for the offset of `$logicalPathPsr4`.
main
Pedro de Carvalho 7 years ago committed by Jordi Boggiano
parent a4b220273e
commit f569833f5a

@ -379,8 +379,8 @@ class ClassLoader
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath.'\\';
if (isset($this->prefixDirsPsr4[$search])) {
$length = $this->prefixLengthsPsr4[$first][$search];
foreach ($this->prefixDirsPsr4[$search] as $dir) {
$length = $this->prefixLengthsPsr4[$first][$search];
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
return $file;
}

Loading…
Cancel
Save