1
0
Fork 0

removed obsolete code

pull/5765/head
Fabien Potencier 2016-10-06 11:54:09 -07:00
parent 902a5c32db
commit 2853e82400
2 changed files with 3 additions and 24 deletions

View File

@ -313,11 +313,6 @@ class ClassLoader
*/ */
public function findFile($class) public function findFile($class)
{ {
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
if ('\\' == $class[0]) {
$class = substr($class, 1);
}
// class map lookup // class map lookup
if (isset($this->classMap[$class])) { if (isset($this->classMap[$class])) {
return $this->classMap[$class]; return $this->classMap[$class];

View File

@ -25,26 +25,15 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
* @dataProvider getLoadClassTests * @dataProvider getLoadClassTests
* *
* @param string $class The fully-qualified class name to test, without preceding namespace separator. * @param string $class The fully-qualified class name to test, without preceding namespace separator.
* @param bool $prependSeparator Whether to call ->loadClass() with a class name with preceding
* namespace separator, as it happens in PHP 5.3.0 - 5.3.2. See https://bugs.php.net/50731
*/ */
public function testLoadClass($class, $prependSeparator = false) public function testLoadClass($class)
{ {
$loader = new ClassLoader(); $loader = new ClassLoader();
$loader->add('Namespaced\\', __DIR__ . '/Fixtures'); $loader->add('Namespaced\\', __DIR__ . '/Fixtures');
$loader->add('Pearlike_', __DIR__ . '/Fixtures'); $loader->add('Pearlike_', __DIR__ . '/Fixtures');
$loader->addPsr4('ShinyVendor\\ShinyPackage\\', __DIR__ . '/Fixtures'); $loader->addPsr4('ShinyVendor\\ShinyPackage\\', __DIR__ . '/Fixtures');
$loader->loadClass($class);
if ($prependSeparator) { $this->assertTrue(class_exists($class, false), "->loadClass() loads '$class'");
$prepend = '\\';
$message = "->loadClass() loads '$class'.";
} else {
$prepend = '';
$message = "->loadClass() loads '\\$class', as required in PHP 5.3.0 - 5.3.2.";
}
$loader->loadClass($prepend . $class);
$this->assertTrue(class_exists($class, false), $message);
} }
/** /**
@ -58,11 +47,6 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
array('Namespaced\\Foo'), array('Namespaced\\Foo'),
array('Pearlike_Foo'), array('Pearlike_Foo'),
array('ShinyVendor\\ShinyPackage\\SubNamespace\\Foo'), array('ShinyVendor\\ShinyPackage\\SubNamespace\\Foo'),
// "Bar" would not work here, since it is defined in a ".inc" file,
// instead of a ".php" file. So, use "Baz" instead.
array('Namespaced\\Baz', true),
array('Pearlike_Bar', true),
array('ShinyVendor\\ShinyPackage\\SubNamespace\\Bar', true),
); );
} }