diff --git a/doc/04-schema.md b/doc/04-schema.md index b777416ed..f5440fba7 100644 --- a/doc/04-schema.md +++ b/doc/04-schema.md @@ -416,7 +416,8 @@ use an empty prefix like: The `classmap` references are all combined, during install/update, into a single key => value array which may be found in the generated file -`vendor/composer/autoload_classmap.php`. +`vendor/composer/autoload_classmap.php`. This map is built by scanning for +classes in all `.php` and `.inc` files in the given directories/files. You can use the classmap generation support to define autoloading for all libraries that do not follow PSR-0. To configure this you specify all directories or files diff --git a/src/Composer/Autoload/ClassMapGenerator.php b/src/Composer/Autoload/ClassMapGenerator.php index 26f3cf28e..5a74728f2 100644 --- a/src/Composer/Autoload/ClassMapGenerator.php +++ b/src/Composer/Autoload/ClassMapGenerator.php @@ -71,7 +71,7 @@ class ClassMapGenerator $filePath = $file->getRealPath(); - if (pathinfo($filePath, PATHINFO_EXTENSION) !== 'php') { + if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc'))) { continue; } diff --git a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php index 9f5606e0c..40d79849c 100644 --- a/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php +++ b/tests/Composer/Test/Autoload/ClassMapGeneratorTest.php @@ -27,7 +27,7 @@ class ClassMapGeneratorTest extends \PHPUnit_Framework_TestCase { $data = array( array(__DIR__.'/Fixtures/Namespaced', array( - 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.php', + 'Namespaced\\Bar' => realpath(__DIR__).'/Fixtures/Namespaced/Bar.inc', 'Namespaced\\Foo' => realpath(__DIR__).'/Fixtures/Namespaced/Foo.php', 'Namespaced\\Baz' => realpath(__DIR__).'/Fixtures/Namespaced/Baz.php', )), diff --git a/tests/Composer/Test/Autoload/Fixtures/Namespaced/Bar.php b/tests/Composer/Test/Autoload/Fixtures/Namespaced/Bar.inc similarity index 100% rename from tests/Composer/Test/Autoload/Fixtures/Namespaced/Bar.php rename to tests/Composer/Test/Autoload/Fixtures/Namespaced/Bar.inc