From dc71ba557bba1ad4954ad269eec8f9748422ff34 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 5 May 2013 10:56:46 +0200 Subject: [PATCH] Consistently use arrays as paths for a given namespace prefix --- src/Composer/Autoload/AutoloadGenerator.php | 6 +----- .../Composer/Test/Autoload/AutoloadGeneratorTest.php | 12 ++++++------ .../Test/Autoload/Fixtures/autoload_main.php | 2 +- .../Test/Autoload/Fixtures/autoload_main2.php | 4 ++-- .../Test/Autoload/Fixtures/autoload_main3.php | 4 ++-- .../Test/Autoload/Fixtures/autoload_vendors.php | 6 +++--- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/Composer/Autoload/AutoloadGenerator.php b/src/Composer/Autoload/AutoloadGenerator.php index deaa69197..127f048c5 100644 --- a/src/Composer/Autoload/AutoloadGenerator.php +++ b/src/Composer/Autoload/AutoloadGenerator.php @@ -76,11 +76,7 @@ EOF; } $exportedPrefix = var_export($namespace, true); $namespacesFile .= " $exportedPrefix => "; - if (count($exportedPaths) > 1) { - $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n"; - } else { - $namespacesFile .= $exportedPaths[0].",\n"; - } + $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n"; } $namespacesFile .= ");\n"; diff --git a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php index 9552faf8f..9ead1b515 100644 --- a/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php +++ b/tests/Composer/Test/Autoload/AutoloadGeneratorTest.php @@ -478,9 +478,9 @@ class AutoloadGeneratorTest extends TestCase \$baseDir = dirname(\$vendorDir); return array( - 'B\\\\Sub\\\\Name' => \$vendorDir . '/b/b/src', + 'B\\\\Sub\\\\Name' => array(\$vendorDir . '/b/b/src'), 'A\\\\B' => array(\$baseDir . '/lib', \$vendorDir . '/a/a/lib'), - 'A' => \$vendorDir . '/a/a/src', + 'A' => array(\$vendorDir . '/a/a/src'), ); EOF; @@ -721,8 +721,8 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir).'/working-dir'; return array( - 'Foo' => $baseDir . '/src', - 'Bar' => $vendorDir . '/b/b/lib', + 'Foo' => array($baseDir . '/src'), + 'Bar' => array($vendorDir . '/b/b/lib'), ); EOF; @@ -784,7 +784,7 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir).'/working-dir'; return array( - 'Foo' => $baseDir . '/../src', + 'Foo' => array($baseDir . '/../src'), ); EOF; @@ -836,7 +836,7 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Foo' => $baseDir . '/', + 'Foo' => array($baseDir . '/'), ); EOF; diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_main.php b/tests/Composer/Test/Autoload/Fixtures/autoload_main.php index f011a7364..89d8ac537 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_main.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_main.php @@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Main' => $baseDir . '/src', + 'Main' => array($baseDir . '/src'), 'Lala' => array($baseDir . '/src', $baseDir . '/lib'), ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_main2.php b/tests/Composer/Test/Autoload/Fixtures/autoload_main2.php index afc146e2c..4dd90d74e 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_main2.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_main2.php @@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname(dirname($vendorDir)); return array( - 'Main' => $baseDir . '/src', - 'Lala' => $baseDir . '/src', + 'Main' => array($baseDir . '/src'), + 'Lala' => array($baseDir . '/src'), ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_main3.php b/tests/Composer/Test/Autoload/Fixtures/autoload_main3.php index fc9742ba5..c4b3052b7 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_main3.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_main3.php @@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = $vendorDir; return array( - 'Main' => $vendorDir . '/src', - 'Lala' => $vendorDir . '/src', + 'Main' => array($vendorDir . '/src'), + 'Lala' => array($vendorDir . '/src'), ); diff --git a/tests/Composer/Test/Autoload/Fixtures/autoload_vendors.php b/tests/Composer/Test/Autoload/Fixtures/autoload_vendors.php index 5cecf729f..4353b3e9c 100644 --- a/tests/Composer/Test/Autoload/Fixtures/autoload_vendors.php +++ b/tests/Composer/Test/Autoload/Fixtures/autoload_vendors.php @@ -6,7 +6,7 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'B\\Sub\\Name' => $vendorDir . '/b/b/src', - 'A\\B' => $vendorDir . '/a/a/lib', - 'A' => $vendorDir . '/a/a/src', + 'B\\Sub\\Name' => array($vendorDir . '/b/b/src'), + 'A\\B' => array($vendorDir . '/a/a/lib'), + 'A' => array($vendorDir . '/a/a/src'), );