Commit Graph

891 Commits

Author SHA1 Message Date
Nestor Soriano b53fc512bf Some changes on the dependency injection engine based on feedback:
- `wc_get_container` declares a return type now.
- The autoloader now runs before `autoload_packages.php` is included.
- The autloader now excludes the namespaces for Admin, Blocs, Rest API.
- `private $container` in `Container` is now declared as being
  of type `\League\Container\Container`.
- The underlying container is registered with `share` instead of `add`.
- All methods in `AbstractServiceProvider` now allow passing a concrete.
- `AbstractServiceProvider::addWithAutoArguments` now checks if an
  argument has a default value, and registers the argument so that
  that value is supplied when constructing the object.
- `Proxies` class renamed to `ProxiesServiceProvider`.
- The methods to call code in `LegacyProxy` now use `call_user_func_array`.
2020-07-24 09:23:05 +02:00
Nestor Soriano 064ae558ab Changes in the overall organization of the dependency injection:
- The `Container` class now implements `Psr\Container\ContainerInterface`
  (and registers itself as such), holding a private instance of the
  real container. This way it's a read-only container from the point
  of view of plugins (which should use their own containers, but
  can still use this to get WooCommerce classes).
- All registrations are now done in the `Container` constructor via
  service providers.
- The container instance is now held in a global variable, set in
  `woocommerce.php`
- Added the `wc_get_container` function for old code.
- Added the `AbstractServiceProvider` class, which inherits with the
  corresponding League's class and adds some utility methods,
  most notably `add/shareWithAutoArguments`.
- Added the `ActionsProxy` and `LegacyProxy` classes, they are
  registered via a dedicated service provider.
- `WC_Queue_Interface` is no longer resolvable via the container
  (which is for classes inside `src` only).
- All the method names in the new classes have the format `fooBarFizz`
  to be PSR4 compliant, so the MethodNameInvalid error has been
  disabled in phpcs.xml for the `src` directory.
- Introduced the `@public` annotation for public API classes
  (classes that plugins can use and whose backwards compatibility
  we guarantee), applied to `ActionsProxy` and to `LegacyProxy` for now.
- Removed the hack for the autoloader as now it doesn't work anyway.
  For the changes in this branch to work, now WP_DEBUG must be false.
2020-07-24 09:23:01 +02:00
Nestor Soriano a7829525eb Changes in the dependency injection container:
- Renamed from `ObjectContainer` to `Container`.
- It now inherits from PHP League's `Container`.
- It has now a `defineAsSharedAutowired` method.
- Initialization moved to the `WooCommerce::init_container` method.
- The static method for object resolution is now `WooCommerce::get_instance_of`.
2020-07-24 09:20:24 +02:00
Nestor Soriano 281ec18158 Undo the registration of old singletons in the DI container.
The container will in principle be used only to register classes
in the `src` directory.

Also, CustomerProvider class removed.
2020-07-24 09:20:24 +02:00
Nestor Soriano 518c52b829 Move PSR4 autoloading from woocommerce.php to the Autoloader class 2020-07-24 09:20:24 +02:00
Nestor Soriano 312383ae47 First steps towards introducing a dependency injection framework.
- 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.
2020-07-24 09:20:21 +02:00
Peter Fabian 6bc0ca724f Update versions and changelog from latest releases. 2020-07-09 13:18:51 +02:00
Jonny Harris 3a9f8875c5
Update woocommerce.php 2020-05-27 23:44:30 +01:00
Jonny Harris 34163a613b
Add requires headers in plugin 2020-05-27 13:58:41 +01:00
Claudio Sanches f01c5a3b79 Start 4.3.0 development 2020-05-12 17:49:20 -03:00
Christopher Allford caa1a6d475 Merge remote-tracking branch 'origin/master' into fix/update-minimum-version 2020-04-16 14:46:17 -07:00
vedanshu.jain a8fb8aa7fe Updated version numbers 2020-04-07 17:06:18 +05:30
Christopher Allford 09df1205de Updated the minimum PHP version to 7.0 2020-04-06 17:07:33 -07:00
Rodrigo Primo 83691541c2 Bump WooCommerce version since 4.1.0 development has begun 2020-03-11 11:37:35 -03:00
Peter Fabian 422d8787f5 Updated version to 4.0.0-beta.1 2020-02-06 14:00:43 +01:00
Peter Fabian e83934edff Bumped versions for the upcoming release. 2020-01-31 17:53:02 +01:00
Claudio Sanches d8bb034425 Version 3.9.0 2020-01-21 21:13:54 -03:00
Claudio Sanches 2847322008 3.9.0-rc.4 2020-01-20 19:53:08 -03:00
Claudio Sanches 28718614d7 Version 3.9.0-rc.3 2020-01-15 21:17:57 -03:00
Claudio Sanches b20ecc648e Bump version to 3.9.0-rc.2 2019-12-27 13:54:38 -03:00
Claudio Sanches 93e3e5bfe1 Bump version to 3.9.0-rc.1 2019-12-23 19:28:57 -03:00
Claudio Sanches 22bbfe7511 3.9.0-beta.2 2019-12-18 20:37:05 -03:00
Claudio Sanches 57e78d701b Updated version to 3.9.0-beta.1 2019-12-10 18:28:56 -03:00
Gerhard Potgieter 5424b0ed31
Merge pull request #24969 from ranss/wc-anass
Use standarized plugin file path constant
2019-11-20 12:31:27 +02:00
vedanshujain 90a45ef9ef Update version to 3.9.0-dev 2019-11-05 17:23:52 +05:30
vedanshujain 59e6fbc9d8 Update stable version and readme.txt 2019-11-05 17:07:56 +05:30
Anass Rahou 2c01ddf09d Use standarized plugin file path constant 2019-11-04 17:27:30 -05:00
vedanshujain cd2a63c293 Update version to 3.8-beta.1 2019-10-03 12:07:16 +05:30
Gerhard cd5319e97f Make master 3.8 dev branch, move changelogs from readme.txt to changelog.txt and start new 3.8 changelog in readme.txt. 2019-08-01 11:35:17 +02:00
Gerhard fa9dfa64e2 Bump version to 3.7.0-rc.1 and update changelog with changes since beta. 2019-07-29 13:23:52 +02:00
Gerhard 651aa3dd48 3.7.0 Beta 1 2019-07-16 18:06:08 +02:00
Mike Jolley f8d6b26e2e Add dedicated Packages loader and Autoloader to init functionality 2019-06-25 13:13:04 +01:00
Mike Jolley 06bdfa67fd Include the package autoloader in the main wc file 2019-06-21 13:41:10 +01:00
Timmy Crawford a9f3cb38a7 Bump master to 3.7.0-dev 2019-03-28 14:29:05 -07:00
Timmy Crawford fd53fe6eaa Release: Update Readme and version for RC. 2019-03-28 11:14:39 -07:00
Timmy Crawford 5220d251d8 Update version 3.6.0-beta.1 2019-03-14 19:23:56 -07:00
Mike Jolley 461010c787 update phpcs line 2019-02-18 11:55:36 +00:00
Mike Jolley a2f77ba7ec phpcs 2019-01-23 16:19:40 +00:00
Refael Iliaguyev 127f1cb276 Use WC() instead wc() for consistency 2018-11-08 12:59:07 +02:00
Rodrigo Primo 40c8d98a4f WC version in the master branch should be 3.6.0-dev and stable tag 3.5.0 2018-10-30 14:42:15 -03:00
claudiulodro c2da2afa6d Update version for rc 2018-09-28 08:35:51 -07:00
claudiulodro b53f706c15 Update versions 2018-09-12 08:20:31 -07:00
Mike Jolley c1de1d6fb7 Master is 3.5.0-dev 2018-05-24 16:20:05 +01:00
claudiulodro 4e046f2afe Recompile for RC1 2018-05-09 11:01:54 -07:00
claudiulodro eeb97510eb Recompile and prepare for beta 2 2018-05-03 09:46:40 -07:00
claudiulodro 75bb4095ef Bump version for 3.4 beta 1 2018-04-18 10:02:53 -07:00
Claudio Sanches 5bf5eadfaa Master is 3.4.0 dev now 2018-01-30 14:52:46 -02:00
Shiva Poudel 7a4debede6 WooCommerce sniffs for main plugin file 2018-01-15 11:13:59 +05:45
claudiulodro 1d7021bbaf Bump version for RC 2018-01-11 09:13:07 -08:00
claudiulodro fd18d24ddd Recompile and version for beta 2 2018-01-05 10:10:17 -08:00