Sure! Here’s a solution to the "Warning: Ambiguous class resolution" message you are seeing:
The warning
Warning: Ambiguous class resolution, "League\Flysystem\Local\LocalFilesystemAdapterTest" was found in both "/var/www/meeplesperdusaurillac/vendor/league/flysystem-local/LocalFilesystemAdapterTest.php" and "/var/www/meeplesperdusaurillac/vendor/league/flysystem/src/Local/LocalFilesystemAdapterTest.php", the first will be used.
means that Composer found two files that define the same class. This typically happens when:
- You have vendor packages (in this case Flysystem) where the same files/classes exist in two places (perhaps after package upgrades/changes, or leftover files).
- Composer is not sure which one to use, so it picks the first, but this can cause strange bugs.
Why did this happen?
- It often occurs after dependencies have changed (e.g.
league/flysystem2.x/3.x andleague/flysystem-localas of v3 are separate packages), and files from older dependencies weren’t cleaned up. - Or, there is some misconfiguration where both packages are installed.
How to fix
1. Clean your vendor directory and re-install
Sometimes, leftover files after dependency changes cause this. To fix:
rm -rf vendor
rm composer.lock
composer install
(If you don’t want to delete composer.lock, you can just do composer install after deleting vendor. But deleting both is a good reset.)
This will remove any old files and re-install only what's required per your composer.json.
2. Check your composer.json for conflicting dependencies
Check if you have both league/flysystem and league/flysystem-local listed, and ensure you’re using compatible versions. As of Flysystem v3, LocalFilesystemAdapter is part of league/flysystem-local.
Example for Flysystem 3.x:
"require": {
"league/flysystem": "^3.0",
"league/flysystem-local": "^3.0"
}
If you're using Flysystem 2.x, you only need:
"require": {
"league/flysystem": "^2.0"
}
3. Remove old files
Sometimes, files can linger in vendor/league/flysystem/ or vendor/league/flysystem-local/ after upgrades. After the clean in step 1, it should be resolved. If not, check your vendor directory manually for .php files that shouldn’t exist.
4. Regenerate Autoload Files
After cleaning, re-run:
composer dump-autoload -o
Summary
99% of the time running:
rm -rf vendor composer.lock
composer install
composer dump-autoload -o
...will solve this warning.
If it does not, double-check your composer.json for duplicate/conflicting package entries, and ensure all packages are updated to compatible versions.
Let me know if you have follow-up questions!