@@ -49,25 +49,27 @@ public function onPreAutoloadDump(Event $event) {
4949 $ package = $ event ->getComposer ()->getPackage ();
5050
5151 $ rootDir = dirname ($ event ->getComposer ()->getConfig ()->get ('vendor-dir ' ));
52- $ phpIncConfig = $ package ->getExtra ()['php-inc ' ] ?? $ this -> createDefaultConfig ( );
52+ $ phpIncConfig = \array_merge ( $ this -> createDefaultConfig (), $ package ->getExtra ()['php-inc ' ] ?? [] );
5353
5454 $ rootPrefix = $ rootDir . '/ ' ;
5555
5656 $ srcPath = $ phpIncConfig ['src-path ' ] ?? null ;
57+ $ srcDir = $ srcPath ? $ rootDir . '/ ' . $ srcPath : null ;
5758 $ testPath = $ phpIncConfig ['test-path ' ] ?? null ;
59+ $ testDir = $ testPath ? $ rootDir . '/ ' . $ testPath : null ;
5860 $ matches = $ phpIncConfig ['matches ' ] ?? null ;
5961 $ devSrcMatches = $ phpIncConfig ['matches-dev-src ' ] ?? null ;
6062 $ devTestMatches = $ phpIncConfig ['matches-dev-test ' ] ?? null ;
6163
6264 $ additionalAutoloadFiles = [];
6365 $ additionalAutoloadDevFiles = [];
6466
65- if ($ srcPath ) {
67+ if ($ srcDir && \file_exists ( $ srcDir ) ) {
6668 $ sourceDir = $ rootDir . '/ ' . $ srcPath ;
6769 $ additionalAutoloadFiles = $ this ->matchFiles ($ rootPrefix , $ matches , $ sourceDir );
6870 $ additionalAutoloadDevFiles = $ this ->matchFiles ($ rootPrefix , $ devSrcMatches , $ sourceDir );
6971 }
70- if ($ testPath ) {
72+ if ($ testPath && \file_exists ( $ testDir ) ) {
7173 $ testDir = $ rootDir . '/ ' . $ testPath ;
7274 $ additionalAutoloadDevFiles = \array_merge ($ additionalAutoloadDevFiles , $ this ->matchFiles ($ rootPrefix , $ devTestMatches , $ testDir ));
7375 }
@@ -82,7 +84,7 @@ public function onPreAutoloadDump(Event $event) {
8284 $ autoload ['files ' ] = \array_unique (\array_merge ($ autoload ['files ' ] ?? [], $ additionalAutoloadFiles ));
8385 $ package ->setAutoload ($ autoload );
8486 $ autoloadDev = $ package ->getDevAutoload ();
85- $ autoloadDev ['files ' ] = \array_unique (\array_merge ($ autoload ['files ' ] ?? [], $ additionalAutoloadDevFiles ));
87+ $ autoloadDev ['files ' ] = \array_unique (\array_merge ($ autoloadDev ['files ' ] ?? [], $ additionalAutoloadDevFiles ));
8688 $ package ->setDevAutoload ($ autoloadDev );
8789 }
8890
@@ -135,7 +137,6 @@ private function createDefaultConfig(): array {
135137 ]
136138 }
137139}
138- JSON
139- );
140+ JSON , true );
140141 }
141142}
0 commit comments