This includes a number of improvements but also requires that we set the `optimize-autoloader` configuration key to compensate for some classes that don't comply with PSR-4.
Since Composer can't recursively use repositories, we can't actually use a local package to deal with this. We're going to keep the local package to separate the dependencies but we need to add autoload keys in the root package's `composer.json`
In order to avoid problems posed by potentially including the unconverted dependencies in the root autoloader, this package will hold all dependencies that require conflict avoidance.
This also updates the woocommerce/woocommerce-admin and woocommerce/woocommerce-blocks packages as their dependence on `composer/installers` precludes update otherwise
Since the Mozart package requires PHP 7.2, and we need to support 7.0
and 7.1, the moving step has been removed from the composer install
stage. Instead, now it has to be triggered manually via
`composer run move-vendor-namespaces`, and the moved package must be
added to source control. See the updated src/Internal/Vendor/REAMDE.md
for details.
A custom fork of the coenjacobs/mozart package is now used to change
the namespace of the appropriate packages (only league/container
for now) instead of the previously used prefix-vendor-namespaces script.
The packages are now moved to the src/Internal/Vendor namespace instead
of being modified in-place in the vendor directory. The namespaces
are thus now prefixed with Automattic\WooCommerce\Internal\Vendor
(previously it was just Automattic\WooCommerce\Vendor).
We introduced the Composer Bin package as a dev dependency, and this
required a "composer bin install" post-install/update Composer command.
However when doing "composer install no-dev" this throws a
"Command 'bin' is not defined" error.
The solution is to add a dummy "bin" command in composer.json that
will run in lieu of the Composer Bin one when doing a no-dev install.
All the classes in the package are re-namespaced from
"Leage\Container" to "Automattic\WooCommerce\Vendor\League\Container"
to prevent conflicts with extensions using the same plugin.
The re-namespacing is done by using a simple text substitution
on all the code files (see prefix-vendor-namespaces.sh), for this
particular case this approach is enough.