Skip to content

Commit 3280346

Browse files
dclouesaliabbasrizvi
authored andcommitted
Add prefix to PSR-4 autoloader (#108)
PSR-4 autoloaders with no prefix can hurt performance, especially in large projects with many dependencies. When resolving class names to files, if Composer cannot use a prefix to limit the search paths, it has to search every autoloader with a blank prefix. This change adds a prefix to the autoloader, to avoid this problem. Running `composer diagnose` previously reported this: ~/src/php-sdk % composer diagnose Checking composer.json: WARNING Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance With this change, `composer diagnose` is happy. I couldn't add tests for this, because it's not a code change. But, I did run the test suite to verify that it everything still passes as expected.
1 parent b8ee905 commit 3280346

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"autoload": {
2525
"psr-4": {
26-
"": "src/"
26+
"Optimizely\\": "src/Optimizely"
2727
}
2828
}
2929
}

0 commit comments

Comments
 (0)