From 30f319d279d5bd91111706db9ddb5ea2722e6d5d Mon Sep 17 00:00:00 2001 From: Dustin Shields-Cloues Date: Fri, 25 May 2018 09:08:34 -0400 Subject: [PATCH] Add prefix to PSR-4 autoloader 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. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7a672af0..5421e0cf 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ }, "autoload": { "psr-4": { - "": "src/" + "Optimizely\\": "src/Optimizely" } } }