Skip to content

Commit

Permalink
Merge pull request composer#5765 from fabpot/remove-obsolete-code
Browse files Browse the repository at this point in the history
removed obsolete code
  • Loading branch information
Seldaek committed Oct 8, 2016
2 parents 4cd6eab + 2853e82 commit c540dac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
5 changes: 0 additions & 5 deletions src/Composer/Autoload/ClassLoader.php
Expand Up @@ -313,11 +313,6 @@ public function loadClass($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
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
Expand Down
22 changes: 3 additions & 19 deletions tests/Composer/Test/Autoload/ClassLoaderTest.php
Expand Up @@ -25,26 +25,15 @@ class ClassLoaderTest extends \PHPUnit_Framework_TestCase
* @dataProvider getLoadClassTests
*
* @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->add('Namespaced\\', __DIR__ . '/Fixtures');
$loader->add('Pearlike_', __DIR__ . '/Fixtures');
$loader->addPsr4('ShinyVendor\\ShinyPackage\\', __DIR__ . '/Fixtures');

if ($prependSeparator) {
$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);
$loader->loadClass($class);
$this->assertTrue(class_exists($class, false), "->loadClass() loads '$class'");
}

/**
Expand All @@ -58,11 +47,6 @@ public function getLoadClassTests()
array('Namespaced\\Foo'),
array('Pearlike_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),
);
}

Expand Down

0 comments on commit c540dac

Please sign in to comment.