#### Composer complains about non-compliance to PSR-4, even though everything seems fine

In my project, I’m including a package I’m developing, which has a composer.json, which includes the following autoload entry:
(censored to not get in trouble with my company of course)

{
"psr-4": {
"VendorPackage": "src/Package"
}
}
}


I have also seen some examples that only used "Vendor", but this resulted in the exact same issue.

I am requiring the package on version tag, so it should get and install the package correctly.

Any time composer runs autoload, it complains the namespaces don’t conform to PSR-4. I have checked the capitalisation, which all checks out. It complains about pretty much every php file in my project. Here’s an example of the file structure:

vendor
|- package
|- src
|- Package
|- PackageServiceProvider.php


The namespace of PackageServiceProvider.php is VendorPackage, and the class is PackageServiceProvider.
As far as I know, this is how it’s supposed to be. Yet composer still gives the deprecation notice.

I am completely out of ideas on how to fix this.

I’m on composer version 1.10.13, and Laravel version 5.8.38.

Source: Laravel