diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 09bbd447f..7a19b8345 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -110,8 +110,7 @@ class ClassMapGenerator foreach ($classes as $class) { // skip classes not within the given namespace prefix - // TODO enable in Composer v1.11 or 2.0 whichever comes first - if (/* null === $autoloadType && */ null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) { + if (null === $autoloadType && null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) { continue; } @@ -180,19 +179,15 @@ class ClassMapGenerator // warn only if no valid classes, else silently skip invalid if (empty($validClasses)) { foreach ($rejectedClasses as $class) { - trigger_error( - "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v2.0.", - E_USER_DEPRECATED - ); + if ($io) { + $io->writeError("Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. Skipping."); + } } - // TODO enable in Composer 2.0 - //return array(); + return array(); } - // TODO enable in Composer 2.0 & unskip test in AutoloadGeneratorTest::testPSRToClassMapIgnoresNonPSRClasses - //return $validClasses; - return $classes; + return $validClasses; } /** diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 3cd8f7ff2..6cb9b76dc 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -604,8 +604,6 @@ class AutoloadGeneratorTest extends TestCase { $package = new Package('a', '1.0', '1.0'); - $this->markTestSkipped('Skipped until ClassMapGenerator ignoring of invalid PSR-x classes is enabled'); - $package->setAutoload(array( 'psr-0' => array('psr0_' => 'psr0/'), 'psr-4' => array('psr4\\' => 'psr4/'),