Revert "Merge pull request #3975 from marc-mabe/hotfix/3974"
This reverts commitpull/4327/headbdb6ecb29e
, reversing changes made to8a12e50a16
.
parent
06feb19b2c
commit
fbae6b1589
|
@ -351,7 +351,7 @@ class ClassLoader
|
||||||
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
||||||
if (0 === strpos($class, $prefix)) {
|
if (0 === strpos($class, $prefix)) {
|
||||||
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
||||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -361,7 +361,7 @@ class ClassLoader
|
||||||
|
|
||||||
// PSR-4 fallback dirs
|
// PSR-4 fallback dirs
|
||||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,7 @@ class ClassLoader
|
||||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||||
if (0 === strpos($class, $prefix)) {
|
if (0 === strpos($class, $prefix)) {
|
||||||
foreach ($dirs as $dir) {
|
foreach ($dirs as $dir) {
|
||||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ class ClassLoader
|
||||||
|
|
||||||
// PSR-0 fallback dirs
|
// PSR-0 fallback dirs
|
||||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||||
if (is_file($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,17 +9,6 @@ use Composer\Autoload\ClassLoader;
|
||||||
*/
|
*/
|
||||||
class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
class ClassLoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testLoadClassDotPhp()
|
|
||||||
{
|
|
||||||
$loader = new ClassLoader();
|
|
||||||
$loader->add('DirDotPhp\\', __DIR__ . '/Fixtures');
|
|
||||||
$loader->addPsr4('DirDotPhp\\', __DIR__ . '/Fixtures/DirDotPhp/psr4');
|
|
||||||
|
|
||||||
$class = 'DirDotPhp\\Dir';
|
|
||||||
$loader->loadClass($class);
|
|
||||||
$this->assertTrue(class_exists($class, false), "->loadClass() loads '$class'.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests regular PSR-0 and PSR-4 class loading.
|
* Tests regular PSR-0 and PSR-4 class loading.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace DirDotPhp;
|
|
||||||
|
|
||||||
class Dir {}
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace DirDotPhp\Dir.php;
|
|
||||||
|
|
||||||
class File {}
|
|
||||||
|
|
Loading…
Reference in New Issue