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.
Since reverting the PR at this point would be a mess I've gone ahead and removed the internals of the container. We should aim to keep the class since it's now part of our public API but it won't work as expected anymore. This is fine for now since we don't actually have anything in it!
- Add PHP League's Container package via Composer.
- Add an ObjectContainer class that encapsulates all the configuration
and insulates the codebase from the concrete DI engine used.
- Add an improved ReflectionContainer class that will allow to
register individual classes as singletons while autowiring.
- Use ObjectContainer to resolve the WooCommerce class, everything
instantiated with "new" inside it, and all singletons that are
usually obtained via WC() function.
- Introduce the CustomerProvider class.
- Introduce a service provider to resolve WC_Queue_Interface,
this replaces the WC_Queue class.
- Mark as obsolete all the replaced "instance()" methods,
and the entire WC_Queue class.