From 1c52650b2e34d7042dbe39980651a32aaee13185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Tue, 3 Dec 2024 09:29:37 -0500 Subject: [PATCH 01/46] update service providers --- inc/Addon/Cloudflare/ServiceProvider.php | 54 ++++++++++--------- inc/Addon/ServiceProvider.php | 43 +++++++++------ inc/Addon/Varnish/ServiceProvider.php | 19 ++++--- inc/Engine/Activation/ServiceProvider.php | 26 +++++---- inc/Engine/Admin/API/ServiceProvider.php | 5 +- inc/Engine/Admin/Beacon/ServiceProvider.php | 18 +++++-- inc/Engine/Admin/Database/ServiceProvider.php | 25 +++++---- .../Admin/DomainChange/ServiceProvider.php | 18 ++++--- inc/Engine/Admin/Settings/ServiceProvider.php | 33 +++++++----- .../class-common-subscribers.php | 6 ++- inc/classes/ServiceProvider/class-options.php | 9 ++-- 11 files changed, 159 insertions(+), 97 deletions(-) diff --git a/inc/Addon/Cloudflare/ServiceProvider.php b/inc/Addon/Cloudflare/ServiceProvider.php index f10d4ee06d..7de4663cdd 100644 --- a/inc/Addon/Cloudflare/ServiceProvider.php +++ b/inc/Addon/Cloudflare/ServiceProvider.php @@ -3,10 +3,12 @@ namespace WP_Rocket\Addon\Cloudflare; +use WP_Rocket\Admin\Options_Data; use WP_Rocket\Addon\Cloudflare\Admin\Subscriber as CloudflareAdminSubscriber; use WP_Rocket\Addon\Cloudflare\API\{Client, Endpoints}; use WP_Rocket\Addon\Cloudflare\Cloudflare; use WP_Rocket\Addon\Cloudflare\Subscriber as CloudflareSubscriber; +use WP_Rocket\Admin\Options; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WPMedia\Cloudflare\Auth\APIKeyFactory; @@ -20,11 +22,12 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - 'cloudflare_client', - 'cloudflare_endpoints', - 'cloudflare', - 'cloudflare_subscriber', - 'cloudflare_admin_subscriber', + APIKeyFactory::class, + Client::class, + Endpoints::class, + Cloudflare::class, + CloudflareSubscriber::class, + CloudflareAdminSubscriber::class, ]; /** @@ -42,26 +45,29 @@ public function provides( string $id ): bool { * Registers items with the container */ public function register(): void { - $options = $this->getContainer()->get( 'options' ); + $this->getContainer()->add( APIKeyFactory::class )->addArgument( Options_Data::class ); - $this->getContainer()->add( 'cloudflare_auth_factory', APIKeyFactory::class )->addArgument( $options ); + $this->getContainer()->add( Client::class ) + ->addArgument( $this->getContainer()->get( APIKeyFactory::class )->create() ); + $this->getContainer()->add( Endpoints::class ) + ->addArgument( Client::class ); - $this->getContainer()->add( 'cloudflare_client', Client::class ) - ->addArgument( $this->getContainer()->get( 'cloudflare_auth_factory' )->create() ); - $this->getContainer()->add( 'cloudflare_endpoints', Endpoints::class ) - ->addArgument( $this->getContainer()->get( 'cloudflare_client' ) ); - - $this->getContainer()->add( 'cloudflare', Cloudflare::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'cloudflare_endpoints' ) ); - $this->getContainer()->addShared( 'cloudflare_subscriber', CloudflareSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'cloudflare' ) ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'cloudflare_auth_factory' ) ); - $this->getContainer()->addShared( - 'cloudflare_admin_subscriber', - CloudflareAdminSubscriber::class - ); + $this->getContainer()->add( Cloudflare::class ) + ->addArguments( + [ + Options_Data::class, + Endpoints::class, + ] + ); + $this->getContainer()->addShared( CloudflareSubscriber::class ) + ->addArguments( + [ + Cloudflare::class, + Options_Data::class, + Options::class, + APIKeyFactory::class, + ] + ); + $this->getContainer()->addShared( CloudflareAdminSubscriber::class ); } } diff --git a/inc/Addon/ServiceProvider.php b/inc/Addon/ServiceProvider.php index e885fd843f..1d379582bb 100644 --- a/inc/Addon/ServiceProvider.php +++ b/inc/Addon/ServiceProvider.php @@ -1,9 +1,15 @@ getContainer()->get( 'options' ); - - // Sucuri Addon. - $this->getContainer()->addShared( 'sucuri_subscriber', SucuriSubscriber::class ) - ->addArgument( $options ); + $this->getContainer()->addShared( SucuriSubscriber::class ) + ->addArgument( Options_Data::class ); - $this->getContainer()->addShared( 'webp_admin_subscriber', WebPAdminSubscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'cdn_subscriber' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ); + $this->getContainer()->addShared( WebPAdminSubscriber::class ) + ->addArguments( + [ + Options_Data::class, + CDNSubscriber::class, + Beacon::class, + ] + ); - $this->getContainer()->addShared( 'webp_subscriber', WebPSubscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'cdn_subscriber' ) ); + $this->getContainer()->addShared( WebPSubscriber::class ) + ->addArguments( + [ + Options_Data::class, + Options::class, + CDNSubscriber::class, + ] + ); } } diff --git a/inc/Addon/Varnish/ServiceProvider.php b/inc/Addon/Varnish/ServiceProvider.php index 46435929c6..b838937986 100644 --- a/inc/Addon/Varnish/ServiceProvider.php +++ b/inc/Addon/Varnish/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->add( 'varnish', Varnish::class ); - $this->getContainer()->addShared( 'varnish_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'varnish' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + $this->getContainer()->add( Varnish::class ); + $this->getContainer()->addShared( Subscriber::class ) + ->addArguments( + [ + Varnish::class, + Options_Data::class, + ] + ); } } diff --git a/inc/Engine/Activation/ServiceProvider.php b/inc/Engine/Activation/ServiceProvider.php index eda25745b7..270941a547 100644 --- a/inc/Engine/Activation/ServiceProvider.php +++ b/inc/Engine/Activation/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->add( 'advanced_cache', AdvancedCache::class ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ) - ->addArgument( $filesystem ); - $this->getContainer()->add( 'capabilities_manager', Manager::class ); - $this->getContainer()->add( 'wp_cache', WPCache::class ) + $this->getContainer()->add( AdvancedCache::class ) + ->addArguments( + [ + $this->getContainer()->get( 'template_path' ) . '/cache/', + $filesystem, + ] + ); + $this->getContainer()->add( Manager::class ); + $this->getContainer()->add( WPCache::class ) ->addArgument( $filesystem ); - $this->getContainer()->add( 'action_scheduler_check', ActionSchedulerCheck::class ); + $this->getContainer()->add( ActionSchedulerCheck::class ); } } diff --git a/inc/Engine/Admin/API/ServiceProvider.php b/inc/Engine/Admin/API/ServiceProvider.php index a418cd752f..c4d6e2fdac 100644 --- a/inc/Engine/Admin/API/ServiceProvider.php +++ b/inc/Engine/Admin/API/ServiceProvider.php @@ -1,4 +1,5 @@ getContainer()->add( 'admin_api_subscriber', Subscriber::class ); + $this->getContainer()->add( Subscriber::class ); } } diff --git a/inc/Engine/Admin/Beacon/ServiceProvider.php b/inc/Engine/Admin/Beacon/ServiceProvider.php index f6f330079e..396ec407ac 100644 --- a/inc/Engine/Admin/Beacon/ServiceProvider.php +++ b/inc/Engine/Admin/Beacon/ServiceProvider.php @@ -1,7 +1,11 @@ getContainer()->addShared( 'beacon', Beacon::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/settings' ) - ->addArgument( $this->getContainer()->get( 'support_data' ) ); + $this->getContainer()->addShared( Beacon::class ) + ->addArguments( + [ + Options_Data::class, + $this->getContainer()->get( 'template_path' ) . '/settings', + Data::class + ] + ); } } diff --git a/inc/Engine/Admin/Database/ServiceProvider.php b/inc/Engine/Admin/Database/ServiceProvider.php index 73fa04a959..b0536c9cd6 100644 --- a/inc/Engine/Admin/Database/ServiceProvider.php +++ b/inc/Engine/Admin/Database/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->add( 'db_optimization_process', OptimizationProcess::class ); - $this->getContainer()->add( 'db_optimization', Optimization::class ) - ->addArgument( $this->getContainer()->get( 'db_optimization_process' ) ); - $this->getContainer()->addShared( 'db_optimization_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'db_optimization' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + $this->getContainer()->add( OptimizationProcess::class ); + $this->getContainer()->add( Optimization::class ) + ->addArgument( OptimizationProcess::class ); + $this->getContainer()->addShared( Subscriber::class ) + ->addArguments( + [ + Optimization::class, + Options_Data::class, + ] + ); } } diff --git a/inc/Engine/Admin/DomainChange/ServiceProvider.php b/inc/Engine/Admin/DomainChange/ServiceProvider.php index 7c93f13c97..620b327658 100644 --- a/inc/Engine/Admin/DomainChange/ServiceProvider.php +++ b/inc/Engine/Admin/DomainChange/ServiceProvider.php @@ -1,8 +1,10 @@ getContainer()->add( 'ajax_handler', AjaxHandler::class ); - $this->getContainer()->add( 'domain_change_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'ajax_handler' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ); + $this->getContainer()->add( AjaxHandler::class ); + $this->getContainer()->add( Subscriber::class ) + ->addArguments( + [ + AjaxHandler::class, + Beacon::class, + ] + ); } } diff --git a/inc/Engine/Admin/Settings/ServiceProvider.php b/inc/Engine/Admin/Settings/ServiceProvider.php index 20a287010c..77e0751a29 100644 --- a/inc/Engine/Admin/Settings/ServiceProvider.php +++ b/inc/Engine/Admin/Settings/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->add( 'plugin_family_model', PluginFamilyModel::class ); - $this->getContainer()->add( 'plugin_family_controller', PluginFamilyController::class ); + $this->getContainer()->add( PluginFamilyModel::class ); + $this->getContainer()->add( PluginFamilyController::class ); - $this->getContainer()->add( 'settings', Settings::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer()->add( 'settings_render', Render::class ) + $this->getContainer()->add( Settings::class ) + ->addArgument( Options_Data::class ); + $this->getContainer()->add( Render::class ) ->addArguments( [ $this->getContainer()->get( 'template_path' ) . '/settings', - 'plugin_family_model', + PluginFamilyModel::class, ] ); - $this->getContainer()->add( 'settings_page', Page::class ) + $this->getContainer()->add( Page::class ) ->addArgument( $this->getContainer()->get( 'settings_page_config' ) ) ->addArgument( $this->getContainer()->get( 'settings' ) ) ->addArgument( $this->getContainer()->get( 'settings_render' ) ) @@ -60,11 +65,11 @@ public function register(): void { ->addArgument( $this->getContainer()->get( 'delay_js_sitelist' ) ) ->addArgument( $this->getContainer()->get( 'template_path' ) ) ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer()->addShared( 'settings_page_subscriber', Subscriber::class ) + $this->getContainer()->addShared( Subscriber::class ) ->addArguments( [ - $this->getContainer()->get( 'settings_page' ), - 'plugin_family_controller', + Page::class, + PluginFamilyController::class, ] ); } diff --git a/inc/classes/ServiceProvider/class-common-subscribers.php b/inc/classes/ServiceProvider/class-common-subscribers.php index ab94157a1a..5776710886 100644 --- a/inc/classes/ServiceProvider/class-common-subscribers.php +++ b/inc/classes/ServiceProvider/class-common-subscribers.php @@ -1,4 +1,6 @@ getContainer()->addShared( 'detect_missing_tags_subscriber', Detect_Missing_Tags_Subscriber::class ); + $this->getContainer()->addShared( Detect_Missing_Tags_Subscriber::class ); } } diff --git a/inc/classes/ServiceProvider/class-options.php b/inc/classes/ServiceProvider/class-options.php index 421bd26242..bba845623e 100644 --- a/inc/classes/ServiceProvider/class-options.php +++ b/inc/classes/ServiceProvider/class-options.php @@ -1,7 +1,10 @@ getContainer()->add( 'options', Options_Data::class ) - ->addArgument( $this->getContainer()->get( 'options_api' )->get( 'settings', [] ) ); + $this->getContainer()->add( Options_Data::class ) + ->addArgument( $this->getContainer()->get( OptionsAPI::class )->get( 'settings', [] ) ); } } From 061b87e58b74f455f0ef17352087250736ea1514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Mon, 6 Jan 2025 16:49:35 -0500 Subject: [PATCH 02/46] update classes instantiation --- inc/Addon/Cloudflare/ServiceProvider.php | 8 ++++---- inc/Addon/ServiceProvider.php | 12 ++++++------ inc/Addon/Varnish/ServiceProvider.php | 4 ++-- inc/Engine/Admin/API/ServiceProvider.php | 4 ++-- inc/Engine/Admin/Beacon/ServiceProvider.php | 4 ++-- inc/Engine/Admin/Database/ServiceProvider.php | 4 ++-- inc/Engine/Admin/DomainChange/ServiceProvider.php | 4 ++-- inc/Engine/Admin/Settings/ServiceProvider.php | 4 ++-- .../ServiceProvider/class-common-subscribers.php | 4 ++-- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/inc/Addon/Cloudflare/ServiceProvider.php b/inc/Addon/Cloudflare/ServiceProvider.php index 7de4663cdd..32c3ccb0ac 100644 --- a/inc/Addon/Cloudflare/ServiceProvider.php +++ b/inc/Addon/Cloudflare/ServiceProvider.php @@ -26,8 +26,8 @@ class ServiceProvider extends AbstractServiceProvider { Client::class, Endpoints::class, Cloudflare::class, - CloudflareSubscriber::class, - CloudflareAdminSubscriber::class, + 'cloudflare_subscriber', + 'cloudflare_admin_subscriber', ]; /** @@ -59,7 +59,7 @@ public function register(): void { Endpoints::class, ] ); - $this->getContainer()->addShared( CloudflareSubscriber::class ) + $this->getContainer()->addShared( 'cloudflare_subscriber', CloudflareSubscriber::class ) ->addArguments( [ Cloudflare::class, @@ -68,6 +68,6 @@ public function register(): void { APIKeyFactory::class, ] ); - $this->getContainer()->addShared( CloudflareAdminSubscriber::class ); + $this->getContainer()->addShared( 'cloudflare_admin_subscriber', CloudflareAdminSubscriber::class ); } } diff --git a/inc/Addon/ServiceProvider.php b/inc/Addon/ServiceProvider.php index 1d379582bb..f83b59fe2f 100644 --- a/inc/Addon/ServiceProvider.php +++ b/inc/Addon/ServiceProvider.php @@ -22,9 +22,9 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - SucuriSubscriber::class, - WebPSubscriber::class, - WebPAdminSubscriber::class, + 'sucuri_subscriber', + 'webp_subscriber', + 'webp_admin_subscriber', ]; /** @@ -42,10 +42,10 @@ public function provides( string $id ): bool { * Registers items with the container */ public function register(): void { - $this->getContainer()->addShared( SucuriSubscriber::class ) + $this->getContainer()->addShared( 'sucuri_subscriber', SucuriSubscriber::class ) ->addArgument( Options_Data::class ); - $this->getContainer()->addShared( WebPAdminSubscriber::class ) + $this->getContainer()->addShared( 'webp_admin_subscriber', WebPAdminSubscriber::class ) ->addArguments( [ Options_Data::class, @@ -54,7 +54,7 @@ public function register(): void { ] ); - $this->getContainer()->addShared( WebPSubscriber::class ) + $this->getContainer()->addShared( 'webp_subscriber', WebPSubscriber::class ) ->addArguments( [ Options_Data::class, diff --git a/inc/Addon/Varnish/ServiceProvider.php b/inc/Addon/Varnish/ServiceProvider.php index b838937986..b401cb7b80 100644 --- a/inc/Addon/Varnish/ServiceProvider.php +++ b/inc/Addon/Varnish/ServiceProvider.php @@ -17,7 +17,7 @@ class ServiceProvider extends AbstractServiceProvider { */ protected $provides = [ Varnish::class, - Subscriber::class, + 'varnish_subscriber', ]; /** @@ -38,7 +38,7 @@ public function provides( string $id ): bool { */ public function register(): void { $this->getContainer()->add( Varnish::class ); - $this->getContainer()->addShared( Subscriber::class ) + $this->getContainer()->addShared( 'varnish_subscriber', Subscriber::class ) ->addArguments( [ Varnish::class, diff --git a/inc/Engine/Admin/API/ServiceProvider.php b/inc/Engine/Admin/API/ServiceProvider.php index c4d6e2fdac..e509ac1e68 100644 --- a/inc/Engine/Admin/API/ServiceProvider.php +++ b/inc/Engine/Admin/API/ServiceProvider.php @@ -12,7 +12,7 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - Subscriber::class, + 'admin_api_subscriber', ]; /** @@ -32,6 +32,6 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( Subscriber::class ); + $this->getContainer()->add( 'admin_api_subscriber', Subscriber::class ); } } diff --git a/inc/Engine/Admin/Beacon/ServiceProvider.php b/inc/Engine/Admin/Beacon/ServiceProvider.php index 396ec407ac..7f7863c363 100644 --- a/inc/Engine/Admin/Beacon/ServiceProvider.php +++ b/inc/Engine/Admin/Beacon/ServiceProvider.php @@ -17,7 +17,7 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - Beacon::class, + 'beacon', ]; /** @@ -37,7 +37,7 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->addShared( Beacon::class ) + $this->getContainer()->addShared( 'beacon', Beacon::class ) ->addArguments( [ Options_Data::class, diff --git a/inc/Engine/Admin/Database/ServiceProvider.php b/inc/Engine/Admin/Database/ServiceProvider.php index b0536c9cd6..711bf97026 100644 --- a/inc/Engine/Admin/Database/ServiceProvider.php +++ b/inc/Engine/Admin/Database/ServiceProvider.php @@ -18,7 +18,7 @@ class ServiceProvider extends AbstractServiceProvider { protected $provides = [ OptimizationProcess::class, Optimization::class, - Subscriber::class, + 'db_optimization_subscriber', ]; /** @@ -41,7 +41,7 @@ public function register(): void { $this->getContainer()->add( OptimizationProcess::class ); $this->getContainer()->add( Optimization::class ) ->addArgument( OptimizationProcess::class ); - $this->getContainer()->addShared( Subscriber::class ) + $this->getContainer()->addShared( 'db_optimization_subscriber', Subscriber::class ) ->addArguments( [ Optimization::class, diff --git a/inc/Engine/Admin/DomainChange/ServiceProvider.php b/inc/Engine/Admin/DomainChange/ServiceProvider.php index 620b327658..d9561a13e2 100644 --- a/inc/Engine/Admin/DomainChange/ServiceProvider.php +++ b/inc/Engine/Admin/DomainChange/ServiceProvider.php @@ -14,7 +14,7 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - Subscriber::class, + 'domain_change_subscriber', AjaxHandler::class, ]; @@ -36,7 +36,7 @@ public function provides( string $id ): bool { */ public function register(): void { $this->getContainer()->add( AjaxHandler::class ); - $this->getContainer()->add( Subscriber::class ) + $this->getContainer()->addShared( 'domain_change_subscriber', Subscriber::class ) ->addArguments( [ AjaxHandler::class, diff --git a/inc/Engine/Admin/Settings/ServiceProvider.php b/inc/Engine/Admin/Settings/ServiceProvider.php index 77e0751a29..3bd37797e2 100644 --- a/inc/Engine/Admin/Settings/ServiceProvider.php +++ b/inc/Engine/Admin/Settings/ServiceProvider.php @@ -23,7 +23,7 @@ class ServiceProvider extends AbstractServiceProvider { Settings::class, Render::class, Page::class, - Subscriber::class, + 'settings_page_subscriber', ]; /** @@ -65,7 +65,7 @@ public function register(): void { ->addArgument( $this->getContainer()->get( 'delay_js_sitelist' ) ) ->addArgument( $this->getContainer()->get( 'template_path' ) ) ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer()->addShared( Subscriber::class ) + $this->getContainer()->addShared( 'settings_page_subscriber', Subscriber::class ) ->addArguments( [ Page::class, diff --git a/inc/classes/ServiceProvider/class-common-subscribers.php b/inc/classes/ServiceProvider/class-common-subscribers.php index 5776710886..6c09a6b73c 100644 --- a/inc/classes/ServiceProvider/class-common-subscribers.php +++ b/inc/classes/ServiceProvider/class-common-subscribers.php @@ -16,7 +16,7 @@ class Common_Subscribers extends AbstractServiceProvider { * @var array */ protected $provides = [ - Detect_Missing_Tags_Subscriber::class, + 'detect_missing_tags_subscriber', ]; /** @@ -36,6 +36,6 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->addShared( Detect_Missing_Tags_Subscriber::class ); + $this->getContainer()->addShared( 'detect_missing_tags_subscriber', Detect_Missing_Tags_Subscriber::class ); } } From dec544386e24404173f6da8521fa257a9339728f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 08:55:38 -0500 Subject: [PATCH 03/46] fix naming --- inc/Addon/ServiceProvider.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/inc/Addon/ServiceProvider.php b/inc/Addon/ServiceProvider.php index f83b59fe2f..fc85d72253 100644 --- a/inc/Addon/ServiceProvider.php +++ b/inc/Addon/ServiceProvider.php @@ -8,7 +8,6 @@ use WP_Rocket\Addon\Sucuri\Subscriber as SucuriSubscriber; use WP_Rocket\Addon\WebP\AdminSubscriber as WebPAdminSubscriber; use WP_Rocket\Addon\WebP\Subscriber as WebPSubscriber; -use WP_Rocket\Engine\Admin\Beacon\Beacon; use WP_Rocket\Engine\CDN\Subscriber as CDNSubscriber; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; @@ -49,8 +48,8 @@ public function register(): void { ->addArguments( [ Options_Data::class, - CDNSubscriber::class, - Beacon::class, + 'cdn_subscriber', + 'beacon', ] ); @@ -59,7 +58,7 @@ public function register(): void { [ Options_Data::class, Options::class, - CDNSubscriber::class, + 'cdn_subscriber', ] ); } From 248b3f2511ada9b118cd764e00f75a0cf7768d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:30:39 -0500 Subject: [PATCH 04/46] revert alias removal --- inc/Addon/Cloudflare/ServiceProvider.php | 34 +++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/inc/Addon/Cloudflare/ServiceProvider.php b/inc/Addon/Cloudflare/ServiceProvider.php index 32c3ccb0ac..004c2e6cd4 100644 --- a/inc/Addon/Cloudflare/ServiceProvider.php +++ b/inc/Addon/Cloudflare/ServiceProvider.php @@ -3,12 +3,10 @@ namespace WP_Rocket\Addon\Cloudflare; -use WP_Rocket\Admin\Options_Data; use WP_Rocket\Addon\Cloudflare\Admin\Subscriber as CloudflareAdminSubscriber; use WP_Rocket\Addon\Cloudflare\API\{Client, Endpoints}; use WP_Rocket\Addon\Cloudflare\Cloudflare; use WP_Rocket\Addon\Cloudflare\Subscriber as CloudflareSubscriber; -use WP_Rocket\Admin\Options; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WPMedia\Cloudflare\Auth\APIKeyFactory; @@ -22,10 +20,10 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - APIKeyFactory::class, - Client::class, - Endpoints::class, - Cloudflare::class, + 'cloudflare_api_key_factory', + 'cloudflare_client', + 'cloudflare_endpoints', + 'cloudflare', 'cloudflare_subscriber', 'cloudflare_admin_subscriber', ]; @@ -45,27 +43,27 @@ public function provides( string $id ): bool { * Registers items with the container */ public function register(): void { - $this->getContainer()->add( APIKeyFactory::class )->addArgument( Options_Data::class ); + $this->getContainer()->add( 'cloudflare_api_key_factory', APIKeyFactory::class )->addArgument( 'options' ); - $this->getContainer()->add( Client::class ) - ->addArgument( $this->getContainer()->get( APIKeyFactory::class )->create() ); - $this->getContainer()->add( Endpoints::class ) - ->addArgument( Client::class ); + $this->getContainer()->add( 'cloudflare_client', Client::class ) + ->addArgument( $this->getContainer()->get( 'cloudflare_api_key_factory' )->create() ); + $this->getContainer()->add( 'cloudflare_endpoints', Endpoints::class ) + ->addArgument( 'cloudflare_client' ); - $this->getContainer()->add( Cloudflare::class ) + $this->getContainer()->add( 'cloudflare', Cloudflare::class ) ->addArguments( [ - Options_Data::class, - Endpoints::class, + 'options', + 'cloudflare_endpoints', ] ); $this->getContainer()->addShared( 'cloudflare_subscriber', CloudflareSubscriber::class ) ->addArguments( [ - Cloudflare::class, - Options_Data::class, - Options::class, - APIKeyFactory::class, + 'cloudflare', + 'options', + 'options_api', + 'cloudflare_api_key_factory', ] ); $this->getContainer()->addShared( 'cloudflare_admin_subscriber', CloudflareAdminSubscriber::class ); From 6b5153fc52b69c19b77d0ba5135d3d7f751a1f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:34:19 -0500 Subject: [PATCH 05/46] update some classes instantiation --- inc/Plugin.php | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/inc/Plugin.php b/inc/Plugin.php index 1300cbc134..7c7ec851a2 100644 --- a/inc/Plugin.php +++ b/inc/Plugin.php @@ -1,10 +1,11 @@ event_manager = new Event_Manager(); $this->container->addShared( 'event_manager', $this->event_manager ); - $this->options_api = new Options( 'wp_rocket_' ); - $this->container->add( 'options_api', $this->options_api ); + $this->container->add( 'options_api', Options::class ) + ->addArgument( new StringArgument( 'wp_rocket_' ) ); $this->container->addServiceProvider( new OptionsServiceProvider() ); $this->options = $this->container->get( 'options' ); @@ -204,15 +195,6 @@ private function init_admin_subscribers() { remove_action( 'imagify_assets_enqueued', 'imagify_dequeue_sweetalert_wprocket' ); } - $this->container->add( - 'settings_page_config', - [ - 'slug' => WP_ROCKET_PLUGIN_SLUG, - 'title' => WP_ROCKET_PLUGIN_NAME, - 'capability' => 'rocket_manage_options', - ] - ); - $this->container->addServiceProvider( new SettingsServiceProvider() ); $this->container->addServiceProvider( new EngineAdminServiceProvider() ); $this->container->addServiceProvider( new OptimizationAdminServiceProvider() ); @@ -286,19 +268,17 @@ private function init_valid_key_subscribers() { private function init_common_subscribers() { $this->container->addServiceProvider( new CapabilitiesServiceProvider() ); $this->container->addServiceProvider( new AddonServiceProvider() ); - $this->container->addServiceProvider( new VarnishServiceProvider() ); $this->container->addServiceProvider( new PreloadServiceProvider() ); $this->container->addServiceProvider( new PreloadLinksServiceProvider() ); $this->container->addServiceProvider( new CDNServiceProvider() ); $this->container->addServiceProvider( new Common_Subscribers() ); - $this->container->addServiceProvider( new ThirdPartyServiceProvider() ); $this->container->addServiceProvider( new HostingsServiceProvider() ); $this->container->addServiceProvider( new PluginServiceProvider() ); + $this->container->addServiceProvider( new DynamicListsServiceProvider() ); $this->container->addServiceProvider( new DelayJSServiceProvider() ); $this->container->addServiceProvider( new RUCSSServiceProvider() ); $this->container->addServiceProvider( new HeartbeatServiceProvider() ); - $this->container->addServiceProvider( new DynamicListsServiceProvider() ); $this->container->addServiceProvider( new LicenseServiceProvider() ); $this->container->addServiceProvider( new ThemesServiceProvider() ); $this->container->addServiceProvider( new APIServiceProvider() ); @@ -311,6 +291,7 @@ private function init_common_subscribers() { $this->container->addServiceProvider( new PerformanceHintsServiceProvider() ); $this->container->addServiceProvider( new LRCServiceProvider() ); $this->container->addServiceProvider( new MediaFontsServiceProvider() ); + $this->container->addServiceProvider( new ThirdPartyServiceProvider() ); $common_subscribers = [ 'license_subscriber', From aa8abdc6dfae8a4eec3d129510381bce6be97886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:36:49 -0500 Subject: [PATCH 06/46] revert alias removal --- inc/Addon/ServiceProvider.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/inc/Addon/ServiceProvider.php b/inc/Addon/ServiceProvider.php index fc85d72253..1e92bb2f12 100644 --- a/inc/Addon/ServiceProvider.php +++ b/inc/Addon/ServiceProvider.php @@ -3,12 +3,9 @@ namespace WP_Rocket\Addon; -use WP_Rocket\Admin\Options; -use WP_Rocket\Admin\Options_Data; use WP_Rocket\Addon\Sucuri\Subscriber as SucuriSubscriber; use WP_Rocket\Addon\WebP\AdminSubscriber as WebPAdminSubscriber; use WP_Rocket\Addon\WebP\Subscriber as WebPSubscriber; -use WP_Rocket\Engine\CDN\Subscriber as CDNSubscriber; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; /** @@ -42,12 +39,12 @@ public function provides( string $id ): bool { */ public function register(): void { $this->getContainer()->addShared( 'sucuri_subscriber', SucuriSubscriber::class ) - ->addArgument( Options_Data::class ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'webp_admin_subscriber', WebPAdminSubscriber::class ) ->addArguments( [ - Options_Data::class, + 'options', 'cdn_subscriber', 'beacon', ] @@ -56,8 +53,8 @@ public function register(): void { $this->getContainer()->addShared( 'webp_subscriber', WebPSubscriber::class ) ->addArguments( [ - Options_Data::class, - Options::class, + 'options', + 'options_api', 'cdn_subscriber', ] ); From 6ba6c463a5ca35b5190ec22643d627a780aa3485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:47:22 -0500 Subject: [PATCH 07/46] revert alias removals --- inc/Addon/Varnish/ServiceProvider.php | 9 ++- inc/Engine/Activation/ServiceProvider.php | 19 +++--- inc/Engine/Admin/Beacon/ServiceProvider.php | 9 ++- inc/Engine/Admin/Database/ServiceProvider.php | 14 ++--- .../Admin/DomainChange/ServiceProvider.php | 10 ++-- inc/Engine/Admin/Settings/ServiceProvider.php | 58 +++++++++++-------- inc/classes/ServiceProvider/class-options.php | 7 +-- 7 files changed, 66 insertions(+), 60 deletions(-) diff --git a/inc/Addon/Varnish/ServiceProvider.php b/inc/Addon/Varnish/ServiceProvider.php index b401cb7b80..c5e30eb0ca 100644 --- a/inc/Addon/Varnish/ServiceProvider.php +++ b/inc/Addon/Varnish/ServiceProvider.php @@ -3,7 +3,6 @@ namespace WP_Rocket\Addon\Varnish; -use WP_Rocket\Admin\Options_Data; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; /** @@ -16,7 +15,7 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - Varnish::class, + 'varnish', 'varnish_subscriber', ]; @@ -37,12 +36,12 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( Varnish::class ); + $this->getContainer()->add( 'varnish', Varnish::class ); $this->getContainer()->addShared( 'varnish_subscriber', Subscriber::class ) ->addArguments( [ - Varnish::class, - Options_Data::class, + 'varnish', + 'options', ] ); } diff --git a/inc/Engine/Activation/ServiceProvider.php b/inc/Engine/Activation/ServiceProvider.php index 270941a547..2455e1d0de 100644 --- a/inc/Engine/Activation/ServiceProvider.php +++ b/inc/Engine/Activation/ServiceProvider.php @@ -3,6 +3,7 @@ namespace WP_Rocket\Engine\Activation; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Dependencies\League\Container\ServiceProvider\BootableServiceProviderInterface; use WP_Rocket\Engine\Cache\AdvancedCache; @@ -20,10 +21,10 @@ class ServiceProvider extends AbstractServiceProvider implements BootableService * @var array */ protected $provides = [ - AdvancedCache::class, - Manager::class, - WPCache::class, - ActionSchedulerCheck::class, + 'advanced_cache', + 'capabilities_manager', + 'wp_cache', + 'action_scheduler_check', ]; /** @@ -54,16 +55,16 @@ public function boot(): void { public function register(): void { $filesystem = rocket_direct_filesystem(); - $this->getContainer()->add( AdvancedCache::class ) + $this->getContainer()->add( 'advanced_cache', AdvancedCache::class ) ->addArguments( [ - $this->getContainer()->get( 'template_path' ) . '/cache/', + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ), $filesystem, ] ); - $this->getContainer()->add( Manager::class ); - $this->getContainer()->add( WPCache::class ) + $this->getContainer()->add( 'capabilities_manager', Manager::class ); + $this->getContainer()->add( 'wp_cache', WPCache::class ) ->addArgument( $filesystem ); - $this->getContainer()->add( ActionSchedulerCheck::class ); + $this->getContainer()->add( 'action_scheduler_check', ActionSchedulerCheck::class ); } } diff --git a/inc/Engine/Admin/Beacon/ServiceProvider.php b/inc/Engine/Admin/Beacon/ServiceProvider.php index 7f7863c363..d62d1daf5b 100644 --- a/inc/Engine/Admin/Beacon/ServiceProvider.php +++ b/inc/Engine/Admin/Beacon/ServiceProvider.php @@ -3,9 +3,8 @@ namespace WP_Rocket\Engine\Admin\Beacon; -use WP_Rocket\Admin\Options_Data; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; -use WP_Rocket\Engine\Support\Data; /** * Service Provider for Beacon @@ -40,9 +39,9 @@ public function register(): void { $this->getContainer()->addShared( 'beacon', Beacon::class ) ->addArguments( [ - Options_Data::class, - $this->getContainer()->get( 'template_path' ) . '/settings', - Data::class + 'options', + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/settings' ), + 'support_data', ] ); } diff --git a/inc/Engine/Admin/Database/ServiceProvider.php b/inc/Engine/Admin/Database/ServiceProvider.php index 711bf97026..a9cfaeaa6a 100644 --- a/inc/Engine/Admin/Database/ServiceProvider.php +++ b/inc/Engine/Admin/Database/ServiceProvider.php @@ -16,8 +16,8 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - OptimizationProcess::class, - Optimization::class, + 'db_optimization_process', + 'db_optimization', 'db_optimization_subscriber', ]; @@ -38,14 +38,14 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( OptimizationProcess::class ); - $this->getContainer()->add( Optimization::class ) - ->addArgument( OptimizationProcess::class ); + $this->getContainer()->add( 'db_optimization_process', OptimizationProcess::class ); + $this->getContainer()->add( 'db_optimization', Optimization::class ) + ->addArgument( 'db_optimization_process' ); $this->getContainer()->addShared( 'db_optimization_subscriber', Subscriber::class ) ->addArguments( [ - Optimization::class, - Options_Data::class, + 'db_optimization', + 'options', ] ); } diff --git a/inc/Engine/Admin/DomainChange/ServiceProvider.php b/inc/Engine/Admin/DomainChange/ServiceProvider.php index d9561a13e2..bfd969132d 100644 --- a/inc/Engine/Admin/DomainChange/ServiceProvider.php +++ b/inc/Engine/Admin/DomainChange/ServiceProvider.php @@ -4,7 +4,7 @@ namespace WP_Rocket\Engine\Admin\DomainChange; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; -use WP_Rocket\Engine\Admin\Beacon\Beacon; + use WP_Rocket\Engine\Common\Ajax\AjaxHandler; class ServiceProvider extends AbstractServiceProvider { @@ -15,7 +15,7 @@ class ServiceProvider extends AbstractServiceProvider { */ protected $provides = [ 'domain_change_subscriber', - AjaxHandler::class, + 'ajax_handler', ]; /** @@ -35,12 +35,12 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( AjaxHandler::class ); + $this->getContainer()->add( 'ajax_handler', AjaxHandler::class ); $this->getContainer()->addShared( 'domain_change_subscriber', Subscriber::class ) ->addArguments( [ - AjaxHandler::class, - Beacon::class, + 'ajax_handler', + 'beacon', ] ); } diff --git a/inc/Engine/Admin/Settings/ServiceProvider.php b/inc/Engine/Admin/Settings/ServiceProvider.php index 3bd37797e2..6c6025258e 100644 --- a/inc/Engine/Admin/Settings/ServiceProvider.php +++ b/inc/Engine/Admin/Settings/ServiceProvider.php @@ -3,7 +3,7 @@ namespace WP_Rocket\Engine\Admin\Settings; -use WP_Rocket\Admin\Options_Data; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\{ArrayArgument, StringArgument}; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Dependencies\WPMedia\PluginFamily\Model\PluginFamily as PluginFamilyModel; use WP_Rocket\Dependencies\WPMedia\PluginFamily\Controller\PluginFamily as PluginFamilyController; @@ -18,11 +18,11 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ - PluginFamilyModel::class, - PluginFamilyController::class, - Settings::class, - Render::class, - Page::class, + 'plugin_family_model', + 'plugin_family_controller', + 'settings', + 'settings_render', + 'settings_page', 'settings_page_subscriber', ]; @@ -43,33 +43,41 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( PluginFamilyModel::class ); - $this->getContainer()->add( PluginFamilyController::class ); + $this->getContainer()->add( 'plugin_family_model', PluginFamilyModel::class ); + $this->getContainer()->add( 'plugin_family_controller', PluginFamilyController::class ); - $this->getContainer()->add( Settings::class ) - ->addArgument( Options_Data::class ); - $this->getContainer()->add( Render::class ) + $this->getContainer()->add( 'settings', Settings::class ) + ->addArgument( 'options' ); + $this->getContainer()->add( 'settings_render', Render::class ) ->addArguments( [ - $this->getContainer()->get( 'template_path' ) . '/settings', - PluginFamilyModel::class, + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/settings' ), + 'plugin_family_model', + ] + ); + $this->getContainer()->add( 'settings_page', Page::class ) + ->addArguments( + [ + new ArrayArgument( [ + 'slug' => WP_ROCKET_PLUGIN_SLUG, + 'title' => WP_ROCKET_PLUGIN_NAME, + 'capability' => 'rocket_manage_options', + ] ), + 'settings', + 'settings_render', + 'beacon', + 'db_optimization', + 'user_client', + 'delay_js_sitelist', + 'template_path', + 'options', ] ); - $this->getContainer()->add( Page::class ) - ->addArgument( $this->getContainer()->get( 'settings_page_config' ) ) - ->addArgument( $this->getContainer()->get( 'settings' ) ) - ->addArgument( $this->getContainer()->get( 'settings_render' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( $this->getContainer()->get( 'db_optimization' ) ) - ->addArgument( $this->getContainer()->get( 'user_client' ) ) - ->addArgument( $this->getContainer()->get( 'delay_js_sitelist' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ); $this->getContainer()->addShared( 'settings_page_subscriber', Subscriber::class ) ->addArguments( [ - Page::class, - PluginFamilyController::class, + 'settings_page', + 'plugin_family_controller', ] ); } diff --git a/inc/classes/ServiceProvider/class-options.php b/inc/classes/ServiceProvider/class-options.php index bba845623e..ac7b2e1924 100644 --- a/inc/classes/ServiceProvider/class-options.php +++ b/inc/classes/ServiceProvider/class-options.php @@ -4,7 +4,6 @@ namespace WP_Rocket\ServiceProvider; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; -use WP_Rocket\Admin\Options as OptionsAPI; use WP_Rocket\Admin\Options_Data; /** @@ -17,7 +16,7 @@ class Options extends AbstractServiceProvider { * @var array */ protected $provides = [ - Options_Data::class, + 'options', ]; /** @@ -37,7 +36,7 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( Options_Data::class ) - ->addArgument( $this->getContainer()->get( OptionsAPI::class )->get( 'settings', [] ) ); + $this->getContainer()->add( 'options', Options_Data::class ) + ->addArgument( $this->getContainer()->get( 'options_api' )->get( 'settings', [] ) ); } } From 36db2b6aa92c18aab0c1c6a6221677c85d0c18e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:51:25 -0500 Subject: [PATCH 08/46] fix code styling --- inc/Engine/Admin/Settings/ServiceProvider.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/Engine/Admin/Settings/ServiceProvider.php b/inc/Engine/Admin/Settings/ServiceProvider.php index 6c6025258e..de10c7ca58 100644 --- a/inc/Engine/Admin/Settings/ServiceProvider.php +++ b/inc/Engine/Admin/Settings/ServiceProvider.php @@ -58,11 +58,13 @@ public function register(): void { $this->getContainer()->add( 'settings_page', Page::class ) ->addArguments( [ - new ArrayArgument( [ + new ArrayArgument( + [ 'slug' => WP_ROCKET_PLUGIN_SLUG, 'title' => WP_ROCKET_PLUGIN_NAME, 'capability' => 'rocket_manage_options', - ] ), + ] + ), 'settings', 'settings_render', 'beacon', From a23f89e8a7ac1269a51978cf41b0e143b62ad22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 09:52:59 -0500 Subject: [PATCH 09/46] use StringArgument --- inc/Engine/Activation/Activation.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Activation/Activation.php b/inc/Engine/Activation/Activation.php index 12541b5568..25b8fee43b 100644 --- a/inc/Engine/Activation/Activation.php +++ b/inc/Engine/Activation/Activation.php @@ -3,6 +3,7 @@ namespace WP_Rocket\Engine\Activation; use WP_Rocket\Admin\Options; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument; use WP_Rocket\Dependencies\League\Container\Container; use WP_Rocket\Engine\Common\PerformanceHints\Activation\ServiceProvider as PerformanceHintsActivationServiceProvider; use WP_Rocket\Engine\License\ServiceProvider as LicenseServiceProvider; @@ -44,7 +45,7 @@ public static function activate_plugin() { $container = new Container(); $event_manager = new Event_Manager(); - $container->add( 'template_path', WP_ROCKET_PATH . 'views' ); + $container->add( 'template_path', new StringArgument( rocket_get_constant( 'WP_ROCKET_PATH', '' ) . 'views' ) ); $options_api = new Options( 'wp_rocket_' ); $container->add( 'options_api', $options_api ); $container->addServiceProvider( new OptionsServiceProvider() ); From 2aba49a8b70d43953f9eb7f25cb1dc0bf0ab97cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:02 -0500 Subject: [PATCH 10/46] update arguments declaration --- inc/Engine/Admin/ServiceProvider.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/inc/Engine/Admin/ServiceProvider.php b/inc/Engine/Admin/ServiceProvider.php index 324e8ef050..57a22a2a56 100644 --- a/inc/Engine/Admin/ServiceProvider.php +++ b/inc/Engine/Admin/ServiceProvider.php @@ -1,7 +1,10 @@ getContainer()->get( 'options' ); - $this->getContainer()->add( 'deactivation_intent', DeactivationIntent::class ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/deactivation-intent' ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $options ); + ->addArguments( + [ + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/deactivation-intent' ), + 'options_api', + 'options', + ] + ); $this->getContainer()->addShared( 'deactivation_intent_subscriber', Subscriber::class ) ->addArgument( $this->getContainer()->get( 'deactivation_intent' ) ); $this->getContainer()->addShared( 'hummingbird_subscriber', Hummingbird::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'actionscheduler_admin_subscriber', ActionSchedulerSubscriber::class ); $this->getContainer()->addShared( 'post_edit_options_subscriber', PostEditOptionsSubscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/metaboxes' ); + ->addArguments( + [ + 'options', + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/metaboxes'), + ] + ); } } From be485f3acea48d81fde273eee961c00371b7d28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:12 -0500 Subject: [PATCH 11/46] update arguments declaration --- inc/Engine/Cache/ServiceProvider.php | 60 +++++++++++++++++++--------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/inc/Engine/Cache/ServiceProvider.php b/inc/Engine/Cache/ServiceProvider.php index eb34187aaf..88ddc3befd 100644 --- a/inc/Engine/Cache/ServiceProvider.php +++ b/inc/Engine/Cache/ServiceProvider.php @@ -1,11 +1,13 @@ getContainer()->add( 'preload_caches_query', CacheQuery::class ) - ->addArgument( new Logger() ); - $cache_query = $this->getContainer()->get( 'preload_caches_query' ); + ->addArgument( 'logger' ); $this->getContainer()->add( 'advanced_cache', AdvancedCache::class ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ) - ->addArgument( $filesystem ); + ->addArguments( + [ + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ), + $filesystem, + ] + ); $this->getContainer()->add( 'wp_cache', WPCache::class ) ->addArgument( $filesystem ); $this->getContainer()->add( 'purge', Purge::class ) - ->addArgument( $filesystem ) - ->addArgument( $cache_query ); + ->addArguments( + [ + $filesystem, + 'preload_caches_query', + ] + ); $this->getContainer()->addShared( 'purge_actions_subscriber', PurgeActionsSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'purge' ) ); + ->addArguments( + [ + 'options', + 'purge', + ] + ); $this->getContainer()->addShared( 'admin_cache_subscriber', AdminSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'advanced_cache' ) ) - ->addArgument( $this->getContainer()->get( 'wp_cache' ) ); - + ->addArguments( + [ + 'advanced_cache', + 'wp_cache', + ] + ); $this->getContainer()->add( 'expired_cache_purge', PurgeExpiredCache::class ) - ->addArgument( rocket_get_constant( 'WP_ROCKET_CACHE_PATH' ) ); + ->addArgument( new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_PATH', '' ) ) ); $this->getContainer()->addShared( 'expired_cache_purge_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'expired_cache_purge' ) ); - $this->getContainer()->add( 'cache_config', ConfigSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ); + ->addArguments( + [ + 'options', + 'expired_cache_purge', + ] + ); + $this->getContainer()->addShared( 'cache_config', ConfigSubscriber::class ) + ->addArguments( + [ + 'options', + 'options_api', + ] + ); $this->getContainer()->addShared( 'taxonomy_subscriber', TaxonomySubscriber::class ); } } From 757ea89b68d9ce515f0b83aaf0038ed3d9f02e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:18 -0500 Subject: [PATCH 12/46] update arguments declaration --- inc/Engine/Capabilities/ServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Capabilities/ServiceProvider.php b/inc/Engine/Capabilities/ServiceProvider.php index 7dda54986b..b33a71980f 100644 --- a/inc/Engine/Capabilities/ServiceProvider.php +++ b/inc/Engine/Capabilities/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->add( 'capabilities_manager', Manager::class ); $this->getContainer()->addShared( 'capabilities_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'capabilities_manager' ) ); + ->addArgument( 'capabilities_manager' ); } } From a56f3cc0cbd561ea91b0480ab14c5d9a2a0d07f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:25 -0500 Subject: [PATCH 13/46] update arguments declaration --- inc/Engine/CDN/RocketCDN/ServiceProvider.php | 54 ++++++++++++++------ 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/inc/Engine/CDN/RocketCDN/ServiceProvider.php b/inc/Engine/CDN/RocketCDN/ServiceProvider.php index 220bd65248..647ae22fe0 100644 --- a/inc/Engine/CDN/RocketCDN/ServiceProvider.php +++ b/inc/Engine/CDN/RocketCDN/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->get( 'options' ); // RocketCDN API Client. $this->getContainer()->add( 'rocketcdn_api_client', APIClient::class ); // RocketCDN CDN options manager. $this->getContainer()->add( 'rocketcdn_options_manager', CDNOptionsManager::class ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $options ); + ->addArguments( + [ + 'options_api', + 'options', + ] + ); // RocketCDN Data manager subscriber. $this->getContainer()->addShared( 'rocketcdn_data_manager_subscriber', DataManagerSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rocketcdn_api_client' ) ) - ->addArgument( $this->getContainer()->get( 'rocketcdn_options_manager' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ); + ->addArguments( + [ + 'rocketcdn_api_client', + 'rocketcdn_options_manager', + 'options', + 'options_api', + ] + ); // RocketCDN REST API Subscriber. $this->getContainer()->addShared( 'rocketcdn_rest_subscriber', RESTSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rocketcdn_options_manager' ) ) - ->addArgument( $options ); + ->addArguments( + [ + 'rocketcdn_options_manager', + 'options', + ] + ); // RocketCDN Notices Subscriber. $this->getContainer()->addShared( 'rocketcdn_notices_subscriber', NoticesSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rocketcdn_api_client' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( __DIR__ . '/views' ); + ->addArguments( + [ + 'rocketcdn_api_client', + 'beacon', + new StringArgument( __DIR__ . '/views' ), + ] + ); // RocketCDN settings page subscriber. $this->getContainer()->addShared( 'rocketcdn_admin_subscriber', AdminPageSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rocketcdn_api_client' ) ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( __DIR__ . '/views' ); + ->addArguments( + [ + 'rocketcdn_api_client', + 'options', + 'beacon', + new StringArgument( __DIR__ . '/views' ), + ] + ); } } From e918bcc9fbb27fd45dce7e97984a4a05d9108e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:35 -0500 Subject: [PATCH 14/46] update arguments declaration --- inc/Engine/CDN/ServiceProvider.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/inc/Engine/CDN/ServiceProvider.php b/inc/Engine/CDN/ServiceProvider.php index 6c5454dd89..4e36436963 100644 --- a/inc/Engine/CDN/ServiceProvider.php +++ b/inc/Engine/CDN/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->get( 'options' ); - $this->getContainer()->addShared( 'cdn', CDN::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'cdn_subscriber', Subscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'cdn' ) ); + ->addArguments( + [ + 'options', + 'cdn', + ] + ); $this->getContainer()->addShared( 'cdn_admin_subscriber', AdminSubscriber::class ); } } From a3d6ad27b20a445cc97cf67f18045ad5f4faa3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:41 -0500 Subject: [PATCH 15/46] update arguments declaration --- inc/Engine/Common/ExtractCSS/ServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Common/ExtractCSS/ServiceProvider.php b/inc/Engine/Common/ExtractCSS/ServiceProvider.php index 0148a2f9cc..e166c81084 100644 --- a/inc/Engine/Common/ExtractCSS/ServiceProvider.php +++ b/inc/Engine/Common/ExtractCSS/ServiceProvider.php @@ -1,7 +1,9 @@ getContainer()->add( 'lazyload_css_cache', FilesystemCache::class ) - ->addArgument( $root ); + ->addArgument( new StringArgument( $root ) ); $this->getContainer()->addShared( 'common_extractcss_subscriber', Subscriber::class ); } } From 626c9cbe8af500c45f48f4007fab52cb22fc7802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:45 -0500 Subject: [PATCH 16/46] update arguments declaration --- .../Common/JobManager/ServiceProvider.php | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/inc/Engine/Common/JobManager/ServiceProvider.php b/inc/Engine/Common/JobManager/ServiceProvider.php index d404ef36ff..7059307f4f 100644 --- a/inc/Engine/Common/JobManager/ServiceProvider.php +++ b/inc/Engine/Common/JobManager/ServiceProvider.php @@ -48,40 +48,35 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $factories = [ $this->getContainer()->get( 'rucss_factory' ), ]; $this->getContainer()->add( 'wpr_clock', WPRClock::class ); - $this->getContainer()->add( 'retry_strategy_context', RetryContext::class ); - $this->getContainer()->add( 'retry_strategy_factory', StrategyFactory::class ) - ->addArgument( $this->getContainer()->get( 'wpr_clock' ) ); - + ->addArgument( 'wpr_clock' ); $this->getContainer()->add( 'queue', Queue::class ); $this->getContainer()->add( 'api_client', APIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'job_processor', JobProcessor::class ) ->addArguments( [ $factories, - $this->getContainer()->get( 'queue' ), - $this->getContainer()->get( 'retry_strategy_factory' ), - $this->getContainer()->get( 'api_client' ), - $this->getContainer()->get( 'wpr_clock' ), + 'queue', + 'retry_strategy_factory', + 'api_client', + 'wpr_clock', ] - ); - + ); $this->getContainer()->addShared( 'cron_subscriber', CronSubscriber::class ) ->addArguments( [ - $this->getContainer()->get( 'job_processor' ), + 'job_processor', $factories, ] - ); + ); } } From bd0b31d9bdd320b4bcecbf8e88d078595fea162b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:51 -0500 Subject: [PATCH 17/46] update arguments declaration --- .../Activation/ServiceProvider.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inc/Engine/Common/PerformanceHints/Activation/ServiceProvider.php b/inc/Engine/Common/PerformanceHints/Activation/ServiceProvider.php index 6640dbe77a..03a2e10c4d 100644 --- a/inc/Engine/Common/PerformanceHints/Activation/ServiceProvider.php +++ b/inc/Engine/Common/PerformanceHints/Activation/ServiceProvider.php @@ -55,7 +55,7 @@ public function register(): void { $this->getContainer()->addShared( 'atf_activation_factory', ATFActivationFactory::class ) ->addArguments( [ - $this->getContainer()->get( 'atf_context' ), + 'atf_context', ] ); @@ -64,7 +64,7 @@ public function register(): void { $this->getContainer()->addShared( 'lrc_activation_factory', LRCActivationFactory::class ) ->addArguments( [ - $this->getContainer()->get( 'lrc_context' ), + 'lrc_context', ] ); @@ -83,7 +83,7 @@ public function register(): void { } $this->getContainer()->add( 'performance_hints_warmup_apiclient', APIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->add( 'performance_hints_warmup_queue', Queue::class ); @@ -91,20 +91,20 @@ public function register(): void { ->addArguments( [ $factories, - $this->getContainer()->get( 'options' ), - $this->getContainer()->get( 'performance_hints_warmup_apiclient' ), - $this->getContainer()->get( 'user' ), - $this->getContainer()->get( 'performance_hints_warmup_queue' ), + 'options', + 'performance_hints_warmup_apiclient', + 'user', + 'performance_hints_warmup_queue', ] ); $this->getContainer()->addShared( 'performance_hints_warmup_subscriber', WarmUpSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'performance_hints_warmup_controller' ) ); + ->addArgument( 'performance_hints_warmup_controller' ); $this->getContainer()->add( 'performance_hints_activation', Activation::class ) ->addArguments( [ - $this->getContainer()->get( 'performance_hints_warmup_controller' ), + 'performance_hints_warmup_controller', $factories, ] ); From 8dc21913af2222a2953759526f05115949003698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:34:54 -0500 Subject: [PATCH 18/46] update arguments declaration --- .../PerformanceHints/ServiceProvider.php | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/inc/Engine/Common/PerformanceHints/ServiceProvider.php b/inc/Engine/Common/PerformanceHints/ServiceProvider.php index 1330e11e3a..0a74c07e63 100644 --- a/inc/Engine/Common/PerformanceHints/ServiceProvider.php +++ b/inc/Engine/Common/PerformanceHints/ServiceProvider.php @@ -4,6 +4,7 @@ namespace WP_Rocket\Engine\Common\PerformanceHints; use WP_Rocket\Buffer\{Config, Tests}; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\{ArrayArgument, StringArgument}; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Engine\Common\PerformanceHints\Admin\{ Controller as AdminController, @@ -49,6 +50,7 @@ class ServiceProvider extends AbstractServiceProvider { 'performance_hints_warmup_subscriber', 'performance_hints_admin_bar', 'performance_hints_clean', + 'performance_hints_notices', ]; /** @@ -68,7 +70,6 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $factories = []; $factory_array = [ @@ -92,27 +93,32 @@ public function register(): void { ); $this->getContainer()->addShared( 'performance_hints_ajax_subscriber', AjaxSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'ajax_processor' ) ); + ->addArgument( 'ajax_processor' ); $this->getContainer()->add( 'frontend_processor', FrontendProcessor::class ) ->addArguments( [ $factories, - $this->getContainer()->get( 'options' ), + 'options', ] ); $this->getContainer()->add( 'config', Config::class ) - ->addArgument( [ 'config_dir_path' => rocket_get_constant( 'WP_ROCKET_CONFIG_PATH' ) ] ); - + ->addArgument( + new ArrayArgument( + [ + 'config_dir_path' => rocket_get_constant( 'WP_ROCKET_CONFIG_PATH', '' ), + ] + ) + ); $this->getContainer()->add( 'tests', Tests::class ) - ->addArgument( $this->getContainer()->get( 'config' ) ); + ->addArgument( 'config' ); $this->getContainer()->addShared( 'performance_hints_frontend_subscriber', FrontendSubscriber::class ) ->addArguments( [ - $this->getContainer()->get( 'frontend_processor' ), - $this->getContainer()->get( 'tests' ), + 'frontend_processor', + 'tests', ] ); @@ -129,49 +135,41 @@ public function register(): void { $factories, ] ); - $this->getContainer()->add( 'performance_hints_admin_bar', Adminbar::class ) ->addArguments( [ $factories, - $this->getContainer()->get( 'template_path' ) . '/settings', + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/settings' ), ] ); - $this->getContainer()->add( 'performance_hints_clean', Clean::class ); - $this->getContainer()->addShared( 'performance_hints_admin_subscriber', AdminSubscriber::class ) ->addArguments( [ - $this->getContainer()->get( 'performance_hints_admin_controller' ), - $this->getContainer()->get( 'performance_hints_admin_bar' ), - $this->getContainer()->get( 'performance_hints_clean' ), - $this->getContainer()->get( 'performance_hints_notices' ), + 'performance_hints_admin_controller', + 'performance_hints_admin_bar', + 'performance_hints_clean', + 'performance_hints_notices', ] ); $this->getContainer()->add( 'cron_controller', CronController::class ) ->addArgument( $factory_array ); - $this->getContainer()->addShared( 'performance_hints_cron_subscriber', CronSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'cron_controller' ) ); - + ->addArgument( 'cron_controller' ); $this->getContainer()->add( 'performance_hints_warmup_apiclient', APIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - + ->addArgument( 'options' ); $this->getContainer()->add( 'performance_hints_warmup_queue', Queue::class ); - $this->getContainer()->add( 'performance_hints_warmup_controller', WarmUpController::class ) ->addArguments( [ $factories, - $this->getContainer()->get( 'options' ), - $this->getContainer()->get( 'performance_hints_warmup_apiclient' ), - $this->getContainer()->get( 'user' ), - $this->getContainer()->get( 'performance_hints_warmup_queue' ), + 'options', + 'performance_hints_warmup_apiclient', + 'user', + 'performance_hints_warmup_queue', ] ); - $this->getContainer()->addShared( 'performance_hints_warmup_subscriber', WarmUpSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'performance_hints_warmup_controller' ) ); + ->addArgument( 'performance_hints_warmup_controller' ); } } From 1b8a48a492a9c34f37ff0adac6d2fa57b87f5b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:35:26 -0500 Subject: [PATCH 19/46] add strict type --- inc/Logger/ServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/Logger/ServiceProvider.php b/inc/Logger/ServiceProvider.php index 8b5c497675..c6ad9d1776 100644 --- a/inc/Logger/ServiceProvider.php +++ b/inc/Logger/ServiceProvider.php @@ -1,4 +1,5 @@ Date: Fri, 10 Jan 2025 10:35:44 -0500 Subject: [PATCH 20/46] add strict type --- inc/ThirdParty/Hostings/ServiceProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/ThirdParty/Hostings/ServiceProvider.php b/inc/ThirdParty/Hostings/ServiceProvider.php index 82de2e72e8..61dfe187a1 100644 --- a/inc/ThirdParty/Hostings/ServiceProvider.php +++ b/inc/ThirdParty/Hostings/ServiceProvider.php @@ -1,4 +1,5 @@ Date: Fri, 10 Jan 2025 10:38:31 -0500 Subject: [PATCH 21/46] update arguments declaration --- inc/Engine/Support/ServiceProvider.php | 30 +++++++++++++++++--------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/inc/Engine/Support/ServiceProvider.php b/inc/Engine/Support/ServiceProvider.php index e16d26a386..c2a344bf6f 100644 --- a/inc/Engine/Support/ServiceProvider.php +++ b/inc/Engine/Support/ServiceProvider.php @@ -3,8 +3,8 @@ namespace WP_Rocket\Engine\Support; -use WP_Rocket_Mobile_Detect; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; +use WP_Rocket_Mobile_Detect; class ServiceProvider extends AbstractServiceProvider { /** @@ -37,20 +37,30 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $options = $this->getContainer()->get( 'options' ); - $this->getContainer()->add( 'mobile_detect', WP_Rocket_Mobile_Detect::class ); $this->getContainer()->add( 'support_data', Data::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->add( 'support_rest', Rest::class ) - ->addArgument( $this->getContainer()->get( 'support_data' ) ) - ->addArgument( $options ); + ->addArguments( + [ + 'support_data', + 'options', + ] + ); $this->getContainer()->add( 'support_meta', Meta::class ) - ->addArgument( $this->getContainer()->get( 'mobile_detect' ) ) - ->addArgument( $options ); + ->addArguments( + [ + 'mobile_detect', + 'options', + ] + ); $this->getContainer()->addShared( 'support_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'support_rest' ) ) - ->addArgument( $this->getContainer()->get( 'support_meta' ) ); + ->addArguments( + [ + 'support_rest', + 'support_meta', + ] + ); } } From 9efa3b5484867adfc18eb8f71faf30d6d4429e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:39:00 -0500 Subject: [PATCH 22/46] update arguments declaration --- inc/Engine/Preload/Links/ServiceProvider.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Preload/Links/ServiceProvider.php b/inc/Engine/Preload/Links/ServiceProvider.php index d68be1b287..5ccd84432b 100644 --- a/inc/Engine/Preload/Links/ServiceProvider.php +++ b/inc/Engine/Preload/Links/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->get( 'options' ); - $this->getContainer()->addShared( 'preload_links_admin_subscriber', AdminSubscriber::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'preload_links_subscriber', Subscriber::class ) - ->addArgument( $options ) + ->addArgument( 'options' ) ->addArgument( rocket_direct_filesystem() ); } } From b926b0f718383f09bca8cff6cf46c965c4a317ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:40:39 -0500 Subject: [PATCH 23/46] update arguments declaration --- inc/Engine/Plugin/ServiceProvider.php | 61 ++++++++++++++++----------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/inc/Engine/Plugin/ServiceProvider.php b/inc/Engine/Plugin/ServiceProvider.php index 1bc3ab0f99..3dd6d903fb 100644 --- a/inc/Engine/Plugin/ServiceProvider.php +++ b/inc/Engine/Plugin/ServiceProvider.php @@ -1,6 +1,10 @@ getContainer()->add( 'plugin_renewal_notice', RenewalNotice::class ) - ->addArgument( $this->getContainer()->get( 'user' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/plugins/' ); - - $this->getContainer()->addShared( 'plugin_updater_common_subscriber', UpdaterApiCommonSubscriber::class ) - ->addArgument( + ->addArguments( [ - 'site_url' => home_url(), - 'plugin_version' => WP_ROCKET_VERSION, - 'settings_slug' => WP_ROCKET_SLUG, - 'settings_nonce_key' => WP_ROCKET_PLUGIN_SLUG, - 'plugin_options' => $this->getContainer()->get( 'options' ), + 'user', + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/plugins/' ), ] ); - + $this->getContainer()->addShared( 'plugin_updater_common_subscriber', UpdaterApiCommonSubscriber::class ) + ->addArgument( + new ArrayArgument( + [ + 'site_url' => home_url(), + 'plugin_version' => WP_ROCKET_VERSION, + 'settings_slug' => WP_ROCKET_SLUG, + 'settings_nonce_key' => WP_ROCKET_PLUGIN_SLUG, + 'plugin_options' => $this->getContainer()->get( 'options' ), + ] + ) + ); $this->getContainer()->addShared( 'plugin_information_subscriber', InformationSubscriber::class ) ->addArgument( - [ - 'plugin_file' => WP_ROCKET_FILE, - ] + new ArrayArgument( + [ + 'plugin_file' => WP_ROCKET_FILE, + ] + ) ); - $this->getContainer()->addShared( 'plugin_updater_subscriber', UpdaterSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'plugin_renewal_notice' ) ) - ->addArgument( + ->addArguments( [ - 'plugin_file' => WP_ROCKET_FILE, - 'plugin_version' => WP_ROCKET_VERSION, - 'vendor_url' => WP_ROCKET_WEB_MAIN, - 'icons' => [ - '2x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-256x256.png', - '1x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-128x128.png', - ], + 'plugin_renewal_notice', + new ArrayArgument( + [ + 'plugin_file' => WP_ROCKET_FILE, + 'plugin_version' => WP_ROCKET_VERSION, + 'vendor_url' => WP_ROCKET_WEB_MAIN, + 'icons' => [ + '2x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-256x256.png', + '1x' => WP_ROCKET_ASSETS_IMG_URL . 'icon-128x128.png', + ], + ] + ), ] ); } From db08cbbbf40450e498bef31cfd00ad573c1f060a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:43:43 -0500 Subject: [PATCH 24/46] update arguments declaration --- inc/ThirdParty/ServiceProvider.php | 187 +++++++++++++---------------- 1 file changed, 82 insertions(+), 105 deletions(-) diff --git a/inc/ThirdParty/ServiceProvider.php b/inc/ThirdParty/ServiceProvider.php index 3b763f1e9a..824c62723c 100644 --- a/inc/ThirdParty/ServiceProvider.php +++ b/inc/ThirdParty/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->get( 'options' ); - - $this->getContainer() - ->addShared( 'mobile_subscriber', Mobile_Subscriber::class ); - $this->getContainer() - ->addShared( 'elementor_subscriber', Elementor::class ) - ->addArgument( $options ) - ->addArgument( rocket_direct_filesystem() ) - ->addArgument( $this->getContainer()->get( 'delay_js_html' ) ); - $this->getContainer() - ->addShared( 'woocommerce_subscriber', WooCommerceSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'delay_js_html' ) ); - $this->getContainer() - ->addShared( 'syntaxhighlighter_subscriber', SyntaxHighlighter_Subscriber::class ); - $this->getContainer() - ->addShared( 'ngg_subscriber', NGG_Subscriber::class ); - $this->getContainer() - ->addShared( 'smush_subscriber', Smush::class ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - $this->getContainer() - ->addShared( 'imagify_webp_subscriber', Imagify_Subscriber::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'shortpixel_webp_subscriber', ShortPixel_Subscriber::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'ewww_webp_subscriber', EWWW_Subscriber::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'optimus_webp_subscriber', Optimus_Subscriber::class ); - $this->getContainer() - ->addShared( 'bigcommerce_subscriber', BigCommerce::class ); - $this->getContainer() - ->addShared( 'beaverbuilder_subscriber', BeaverBuilder::class ); - $this->getContainer() - ->addShared( 'amp_subscriber', AMP::class ) - ->addArgument( $this->getContainer()->get( 'cdn_subscriber' ) ); - $this->getContainer() - ->addShared( 'simple_custom_css', SimpleCustomCss::class ) - ->addArgument( WP_ROCKET_CACHE_BUSTING_PATH )->addArgument( WP_ROCKET_CACHE_BUSTING_URL ); - $this->getContainer() - ->addShared( 'pdfembedder', PDFEmbedder::class ); - $this->getContainer() - ->addShared( 'mod_pagespeed', ModPagespeed::class ); - $this->getContainer() - ->addShared( 'adthrive', Adthrive::class ); - $this->getContainer() - ->addShared( 'autoptimize', Autoptimize::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'wp-meteor', WPMeteor::class ); - $this->getContainer() - ->addShared( 'revolution_slider_subscriber', RevolutionSlider::class ); - $this->getContainer() - ->addShared( 'wordfence_subscriber', WordFenceCompatibility::class ); - $this->getContainer() - ->addShared( 'ezoic', Ezoic::class ); - $this->getContainer() - ->addShared( 'thirstyaffiliates', ThirstyAffiliates::class ); - $this->getContainer() - ->addShared( 'pwa', PWA::class ); - $this->getContainer() - ->addShared( 'yoast_seo', Yoast::class ); - $this->getContainer() - ->addShared( 'convertplug', ConvertPlug::class ); - $this->getContainer() - ->addShared( 'unlimited_elements', UnlimitedElements::class ); - $this->getContainer() - ->addShared( 'inline_related_posts', InlineRelatedPosts::class ); - $this->getContainer() - ->addShared( 'wpml', WPML::class ); - $this->getContainer()->add( 'cloudflare_plugin_facade', CloudflareFacade::class ); - $this->getContainer() - ->addShared( 'cloudflare_plugin_subscriber', Cloudflare::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( $this->getContainer()->get( 'cloudflare_plugin_facade' ) ); - $this->getContainer() - ->addShared( 'jetpack', Jetpack::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'convertplug', ConvertPlug::class ); - $this->getContainer() - ->addShared( 'rank_math_seo', RankMathSEO::class ); - $this->getContainer() - ->addShared( 'all_in_one_seo_pack', AllInOneSEOPack::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'seopress', SEOPress::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'the_seo_framework', TheSEOFramework::class ) - ->addArgument( $options ); - $this->getContainer() - ->addShared( 'rocket_lazy_load', RocketLazyLoad::class ); - $this->getContainer() - ->addShared( 'the_events_calendar', TheEventsCalendar::class ); - $this->getContainer() - ->addShared( 'perfmatters', Perfmatters::class ); - $this->getContainer() - ->addShared( 'rapidload', RapidLoad::class ); - $this->getContainer() - ->addShared( 'weglot', Weglot::class ); + $this->getContainer()->addShared( 'mobile_subscriber', Mobile_Subscriber::class ); + $this->getContainer()->addShared( 'elementor_subscriber', Elementor::class ) + ->addArguments( + [ + 'options', + rocket_direct_filesystem(), + 'delay_js_html', + ] + ); + $this->getContainer()->addShared( 'woocommerce_subscriber', WooCommerceSubscriber::class ) + ->addArgument( 'delay_js_html' ); + $this->getContainer()->addShared( 'syntaxhighlighter_subscriber', SyntaxHighlighter_Subscriber::class ); + $this->getContainer()->addShared( 'ngg_subscriber', NGG_Subscriber::class ); + $this->getContainer()->addShared( 'smush_subscriber', Smush::class ) + ->addArguments( + [ + 'options_api', + 'options', + ] + ); + $this->getContainer()->addShared( 'imagify_webp_subscriber', Imagify_Subscriber::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'shortpixel_webp_subscriber', ShortPixel_Subscriber::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'ewww_webp_subscriber', EWWW_Subscriber::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'optimus_webp_subscriber', Optimus_Subscriber::class ); + $this->getContainer()->addShared( 'bigcommerce_subscriber', BigCommerce::class ); + $this->getContainer()->addShared( 'beaverbuilder_subscriber', BeaverBuilder::class ); + $this->getContainer()->addShared( 'amp_subscriber', AMP::class ) + ->addArgument( 'cdn_subscriber' ); + $this->getContainer()->addShared( 'simple_custom_css', SimpleCustomCss::class ) + ->addArguments( + [ + new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_PATH', '' ) ), + new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_URL', '' ) ), + ] + ); + $this->getContainer()->addShared( 'pdfembedder', PDFEmbedder::class ); + $this->getContainer()->addShared( 'mod_pagespeed', ModPagespeed::class ); + $this->getContainer()->addShared( 'adthrive', Adthrive::class ); + $this->getContainer()->addShared( 'autoptimize', Autoptimize::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'wp-meteor', WPMeteor::class ); + $this->getContainer()->addShared( 'revolution_slider_subscriber', RevolutionSlider::class ); + $this->getContainer()->addShared( 'wordfence_subscriber', WordFenceCompatibility::class ); + $this->getContainer()->addShared( 'ezoic', Ezoic::class ); + $this->getContainer()->addShared( 'thirstyaffiliates', ThirstyAffiliates::class ); + $this->getContainer()->addShared( 'pwa', PWA::class ); + $this->getContainer()->addShared( 'yoast_seo', Yoast::class ); + $this->getContainer()->addShared( 'convertplug', ConvertPlug::class ); + $this->getContainer()->addShared( 'unlimited_elements', UnlimitedElements::class ); + $this->getContainer()->addShared( 'inline_related_posts', InlineRelatedPosts::class ); + $this->getContainer()->addShared( 'wpml', WPML::class ); + $this->getContainer()->add( 'cloudflare_plugin_facade', CloudflareFacade::class ); + $this->getContainer()->addShared( 'cloudflare_plugin_subscriber', Cloudflare::class ) + ->addArguments( + [ + 'options', + 'options_api', + 'beacon', + 'cloudflare_plugin_facade', + ] + ); + $this->getContainer()->addShared( 'jetpack', Jetpack::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'convertplug', ConvertPlug::class ); + $this->getContainer()->addShared( 'rank_math_seo', RankMathSEO::class ); + $this->getContainer()->addShared( 'all_in_one_seo_pack', AllInOneSEOPack::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'seopress', SEOPress::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'the_seo_framework', TheSEOFramework::class ) + ->addArgument( 'options' ); + $this->getContainer()->addShared( 'rocket_lazy_load', RocketLazyLoad::class ); + $this->getContainer()->addShared( 'the_events_calendar', TheEventsCalendar::class ); + $this->getContainer()->addShared( 'perfmatters', Perfmatters::class ); + $this->getContainer()->addShared( 'rapidload', RapidLoad::class ); + $this->getContainer()->addShared( 'weglot', Weglot::class ); $this->getContainer()->addShared( 'translatepress', TranslatePress::class ); $this->getContainer()->addShared( 'wpgeotargeting', WPGeotargeting::class ); $this->getContainer()->addShared( 'contactform7', ContactForm7::class ); From f6e1a24aebd5dff7ced54895afe90d72ed0f0080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 10:45:28 -0500 Subject: [PATCH 25/46] update arguments declaration and fix naming --- inc/Engine/Saas/ServiceProvider.php | 35 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/inc/Engine/Saas/ServiceProvider.php b/inc/Engine/Saas/ServiceProvider.php index 784c0e3a78..9b9f9e1116 100644 --- a/inc/Engine/Saas/ServiceProvider.php +++ b/inc/Engine/Saas/ServiceProvider.php @@ -3,6 +3,7 @@ namespace WP_Rocket\Engine\Saas; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Engine\Saas\Admin\{AdminBar, Clean, Notices, Subscriber}; @@ -40,17 +41,29 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $this->getContainer()->add( 'sass_admin_bar', Adminbar::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_optimize_context' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/settings' ); - $this->getContainer()->add( 'sass_clean', Clean::class ); - $this->getContainer()->add( 'sass_notices', Notices::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ); + $this->getContainer()->add( 'saas_admin_bar', Adminbar::class ) + ->addArguments( + [ + 'options', + 'rucss_optimize_context', + new StringArgument( $this->getContainer()->get( 'template_path' ) ), + ] + ); + $this->getContainer()->add( 'saas_clean', Clean::class ); + $this->getContainer()->add( 'saas_notices', Notices::class ) + ->addArguments( + [ + 'options', + 'beacon', + ] + ); $this->getContainer()->addShared( 'saas_admin_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'sass_admin_bar' ) ) - ->addArgument( $this->getContainer()->get( 'sass_clean' ) ) - ->addArgument( $this->getContainer()->get( 'sass_notices' ) ); + ->addArguments( + [ + 'saas_admin_bar', + 'saas_clean', + 'saas_notices', + ] + ); } } From d29739ba03fa6d166d798957e7fdcd5cf8c265f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:36:37 -0500 Subject: [PATCH 26/46] update arguments declaration --- inc/Engine/CriticalPath/ServiceProvider.php | 120 ++++++++++++-------- 1 file changed, 75 insertions(+), 45 deletions(-) diff --git a/inc/Engine/CriticalPath/ServiceProvider.php b/inc/Engine/CriticalPath/ServiceProvider.php index 4584532428..cdf96681c4 100644 --- a/inc/Engine/CriticalPath/ServiceProvider.php +++ b/inc/Engine/CriticalPath/ServiceProvider.php @@ -1,7 +1,9 @@ getContainer()->get( 'options' ); - $beacon = $this->getContainer()->get( 'beacon' ); - $template_path = $this->getContainer()->get( 'template_path' ) . '/cpcss'; + $critical_css_path = new StringArgument( rocket_get_constant( 'WP_ROCKET_CRITICAL_CSS_PATH' ) ); + $template_path = new StringArgument( $this->getContainer()->get( 'template_path' ) . '/cpcss' ); - $this->getContainer()->addShared( 'cpcss_api_client', APIClient::class ); - $this->getContainer()->addShared( 'cpcss_data_manager', DataManager::class ) - ->addArgument( $critical_css_path ) - ->addArgument( $filesystem ); - $this->getContainer()->addShared( 'cpcss_service', ProcessorService::class ) - ->addArgument( $this->getContainer()->get( 'cpcss_data_manager' ) ) - ->addArgument( $this->getContainer()->get( 'cpcss_api_client' ) ); - - $processor_service = $this->getContainer()->get( 'cpcss_service' ); + $this->getContainer()->add( 'cpcss_api_client', APIClient::class ); + $this->getContainer()->add( 'cpcss_data_manager', DataManager::class ) + ->addArguments( + [ + $critical_css_path, + $filesystem, + ] + ); + $this->getContainer()->add( 'cpcss_service', ProcessorService::class ) + ->addArguments( + [ + 'cpcss_data_manager', + 'cpcss_api_client', + ] + ); // REST CPCSS START. - $this->getContainer()->addShared( 'rest_cpcss_wp_post', RESTWPPost::class ) - ->addArgument( $processor_service ) - ->addArgument( $options ); + $this->getContainer()->add( 'rest_cpcss_wp_post', RESTWPPost::class ) + ->addArguments( + [ + 'cpcss_service', + 'options', + ] + ); $this->getContainer()->addShared( 'rest_cpcss_subscriber', RESTCSSSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rest_cpcss_wp_post' ) ); + ->addArgument( 'rest_cpcss_wp_post' ); // REST CPCSS END. $this->getContainer()->add( 'critical_css_generation', CriticalCSSGeneration::class ) - ->addArgument( $processor_service ); + ->addArgument( 'cpcss_service' ); $this->getContainer()->add( 'critical_css', CriticalCSS::class ) - ->addArgument( $this->getContainer()->get( 'critical_css_generation' ) ) - ->addArgument( $options ) - ->addArgument( $filesystem ); - - $critical_css = $this->getContainer()->get( 'critical_css' ); - + ->addArguments( + [ + 'critical_css_generation', + 'options', + $filesystem, + ] + ); $this->getContainer()->addShared( 'critical_css_subscriber', CriticalCSSSubscriber::class ) - ->addArgument( $critical_css ) - ->addArgument( $processor_service ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'user' ) ) - ->addArgument( $filesystem ); - - $this->getContainer()->add( 'cpcss_post', Post::class ) - ->addArgument( $options ) - ->addArgument( $beacon ) - ->addArgument( $critical_css_path ) - ->addArgument( $template_path ); + ->addArguments( + [ + 'critical_css', + 'cpcss_service', + 'options', + 'options_api', + 'user', + $filesystem, + ] + ); + $this->getContainer()->add( 'cpcss_post', Post::class ) + ->addArguments( + [ + 'options', + 'beacon', + $critical_css_path, + $template_path, + ] + ); $this->getContainer()->add( 'cpcss_settings', Settings::class ) - ->addArgument( $options ) - ->addArgument( $beacon ) - ->addArgument( $critical_css ) - ->addArgument( $template_path ); + ->addArguments( + [ + 'options', + 'beacon', + 'critical_css', + $template_path, + ] + ); $this->getContainer()->add( 'cpcss_admin', Admin::class ) - ->addArgument( $options ) - ->addArgument( $processor_service ); + ->addArguments( + [ + 'options', + 'cpcss_service', + ] + ); $this->getContainer()->addShared( 'critical_css_admin_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'cpcss_post' ) ) - ->addArgument( $this->getContainer()->get( 'cpcss_settings' ) ) - ->addArgument( $this->getContainer()->get( 'cpcss_admin' ) ); + ->addArguments( + [ + 'cpcss_post', + 'cpcss_settings', + 'cpcss_admin', + ] + ); } } From 5a33b58df9ae8bdbfda9242c78afd50e03864334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:37:21 -0500 Subject: [PATCH 27/46] use StringArgument --- inc/Engine/Deactivation/Deactivation.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/Engine/Deactivation/Deactivation.php b/inc/Engine/Deactivation/Deactivation.php index f7380914e2..30d936fa66 100644 --- a/inc/Engine/Deactivation/Deactivation.php +++ b/inc/Engine/Deactivation/Deactivation.php @@ -3,6 +3,7 @@ namespace WP_Rocket\Engine\Deactivation; use WP_Rocket\Admin\Options; +use WP_Rocket\Dependencies\League\Container\Argument\Literal\StringArgument; use WP_Rocket\Dependencies\League\Container\Container; use WP_Rocket\Engine\Admin\Beacon\ServiceProvider as BeaconServiceProvider; use WP_Rocket\Engine\Support\ServiceProvider as SupportServiceProvider; @@ -36,12 +37,11 @@ public static function deactivate_plugin() { $container = new Container(); $container->add( 'options_api', new Options( 'wp_rocket_' ) ); - $container->add( 'template_path', WP_ROCKET_PATH . 'views' ); + $container->add( 'template_path', new StringArgument( rocket_get_constant( 'WP_ROCKET_PATH', '' ) . 'views' ) ); $container->addServiceProvider( new OptionsServiceProvider() ); $container->addServiceProvider( new BeaconServiceProvider() ); $container->addServiceProvider( new SupportServiceProvider() ); - $container->addServiceProvider( new ServiceProvider() ); $container->addServiceProvider( new HostingsServiceProvider() ); From 7f92ac95950b07c86bce65882268e2b3dc8f40da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:39:04 -0500 Subject: [PATCH 28/46] update arguments declaration --- inc/Engine/Deactivation/ServiceProvider.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/Engine/Deactivation/ServiceProvider.php b/inc/Engine/Deactivation/ServiceProvider.php index 6d33c2d9ee..ac020b5c4e 100644 --- a/inc/Engine/Deactivation/ServiceProvider.php +++ b/inc/Engine/Deactivation/ServiceProvider.php @@ -1,6 +1,7 @@ getContainer()->add( 'cloudflare_plugin_facade', CloudflareFacade::class ); $this->getContainer() ->addShared( 'cloudflare_plugin_subscriber', Cloudflare::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( $this->getContainer()->get( 'cloudflare_plugin_facade' ) ); + ->addArgument( 'options' ) + ->addArgument( 'options_api' ) + ->addArgument( 'beacon' ) + ->addArgument( 'cloudflare_plugin_facade' ); $this->getContainer()->add( 'advanced_cache', AdvancedCache::class ) - ->addArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ) + ->addArgument( new StringArgument( $this->getContainer()->get( 'template_path' ) . '/cache/' ) ) ->addArgument( $filesystem ); $this->getContainer()->add( 'capabilities_manager', Manager::class ); $this->getContainer()->add( 'wp_cache', WPCache::class ) From 1a086162c320005f2dedaf19cf63bad31573e70c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:40:24 -0500 Subject: [PATCH 29/46] update arguments declaration --- inc/Engine/Debug/ServiceProvider.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Debug/ServiceProvider.php b/inc/Engine/Debug/ServiceProvider.php index 78b441f699..1045156caf 100644 --- a/inc/Engine/Debug/ServiceProvider.php +++ b/inc/Engine/Debug/ServiceProvider.php @@ -1,8 +1,10 @@ container->add( 'debug_subscriber', DebugSubscriber::class ); + $this->container->addShared( 'debug_subscriber', DebugSubscriber::class ); if ( empty( $this->services ) ) { return; @@ -71,8 +73,8 @@ public function register(): void { foreach ( $this->services as $service ) { $this->getContainer()->add( $service['service'], $service['class'] ) - ->addArgument( $this->getContainer()->get( 'options_debug' ) ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ); + ->addArgument( 'options_debug' ) + ->addArgument( 'options_api' ); } } } From 3aff24ef14d9f3d0c5ede56fe41978af8ddbb14c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:41:04 -0500 Subject: [PATCH 30/46] update arguments declaration --- inc/Engine/HealthCheck/ServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/Engine/HealthCheck/ServiceProvider.php b/inc/Engine/HealthCheck/ServiceProvider.php index 1a2acf8758..a9dcf73b58 100644 --- a/inc/Engine/HealthCheck/ServiceProvider.php +++ b/inc/Engine/HealthCheck/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->addShared( 'health_check', HealthCheck::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'action_scheduler_check', ActionSchedulerCheck::class ); } } From 09f681cc201388299c745914bdfaac9ce74d004e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:41:22 -0500 Subject: [PATCH 31/46] update arguments declaration --- inc/Engine/Heartbeat/ServiceProvider.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/Engine/Heartbeat/ServiceProvider.php b/inc/Engine/Heartbeat/ServiceProvider.php index e8c1664e65..d180062dec 100644 --- a/inc/Engine/Heartbeat/ServiceProvider.php +++ b/inc/Engine/Heartbeat/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->addShared( 'heartbeat_subscriber', HeartbeatSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); } } From 301cb14fbfda740221a147400735894ef2b6e6e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:46:05 -0500 Subject: [PATCH 32/46] update arguments declaration --- inc/Engine/License/ServiceProvider.php | 36 ++++++++++++++++++-------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/inc/Engine/License/ServiceProvider.php b/inc/Engine/License/ServiceProvider.php index cae466089a..cde3cc726b 100644 --- a/inc/Engine/License/ServiceProvider.php +++ b/inc/Engine/License/ServiceProvider.php @@ -1,7 +1,9 @@ getContainer()->add( 'pricing_client', PricingClient::class ); $this->getContainer()->add( 'user_client', UserClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'pricing', Pricing::class ) ->addArgument( $this->getContainer()->get( 'pricing_client' )->get_pricing_data() ); $this->getContainer()->addShared( 'user', User::class ) ->addArgument( $this->getContainer()->get( 'user_client' )->get_user_data() ); $this->getContainer()->add( 'upgrade', Upgrade::class ) - ->addArgument( $this->getContainer()->get( 'pricing' ) ) - ->addArgument( $this->getContainer()->get( 'user' ) ) - ->addArgument( $views ); + ->addArguments( + [ + 'pricing', + 'user', + $views, + ] + ); $this->getContainer()->add( 'renewal', Renewal::class ) - ->addArgument( $this->getContainer()->get( 'pricing' ) ) - ->addArgument( $this->getContainer()->get( 'user' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $views ); + ->addArguments( + [ + 'pricing', + 'user', + 'options', + $views, + ] + ); $this->getContainer()->addShared( 'license_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'upgrade' ) ) - ->addArgument( $this->getContainer()->get( 'renewal' ) ); + ->addArguments( + [ + 'upgrade', + 'renewal', + ] + ); } } From 81f2a055199844a1361904968508d13cf74ee47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:47:58 -0500 Subject: [PATCH 33/46] update arguments declaration --- .../Media/AboveTheFold/ServiceProvider.php | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/inc/Engine/Media/AboveTheFold/ServiceProvider.php b/inc/Engine/Media/AboveTheFold/ServiceProvider.php index 55c1f4999f..50095f783b 100644 --- a/inc/Engine/Media/AboveTheFold/ServiceProvider.php +++ b/inc/Engine/Media/AboveTheFold/ServiceProvider.php @@ -56,31 +56,30 @@ public function register(): void { $this->getContainer()->add( 'atf_controller', FrontController::class ) ->addArguments( [ - $this->getContainer()->get( 'options' ), - $this->getContainer()->get( 'atf_query' ), - $this->getContainer()->get( 'atf_context' ), + 'options', + 'atf_query', + 'atf_context', ] ); $this->getContainer()->addShared( 'atf_subscriber', FrontSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'atf_controller' ) ); - + ->addArgument( 'atf_controller' ); $this->getContainer()->add( 'atf_ajax_controller', AJAXController::class ) ->addArguments( [ - $this->getContainer()->get( 'atf_query' ), - $this->getContainer()->get( 'atf_context' ), + 'atf_query', + 'atf_context', ] ); $this->getContainer()->addShared( 'atf_factory', Factory::class ) ->addArguments( [ - $this->getContainer()->get( 'atf_ajax_controller' ), - $this->getContainer()->get( 'atf_controller' ), - $this->getContainer()->get( 'atf_table' ), - $this->getContainer()->get( 'atf_query' ), - $this->getContainer()->get( 'atf_context' ), + 'atf_ajax_controller', + 'atf_controller', + 'atf_table', + 'atf_query', + 'atf_context', ] ); } From 37fe62c6238118fb0c36e6e86edd3338d745edcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:49:54 -0500 Subject: [PATCH 34/46] update arguments declaration --- inc/Engine/Media/Lazyload/CSS/Admin/ServiceProvider.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/Engine/Media/Lazyload/CSS/Admin/ServiceProvider.php b/inc/Engine/Media/Lazyload/CSS/Admin/ServiceProvider.php index 7b12094792..55bfbb5a9d 100644 --- a/inc/Engine/Media/Lazyload/CSS/Admin/ServiceProvider.php +++ b/inc/Engine/Media/Lazyload/CSS/Admin/ServiceProvider.php @@ -1,4 +1,5 @@ getContainer()->addShared( 'lazyload_css_admin_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_cache' ) ); + ->addArgument( 'lazyload_css_cache' ); } } From 4cf6ba4f2ddcdaf86172049f4b5327b5f57011b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:51:15 -0500 Subject: [PATCH 35/46] update arguments declaration --- .../Optimization/DeferJS/ServiceProvider.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/inc/Engine/Optimization/DeferJS/ServiceProvider.php b/inc/Engine/Optimization/DeferJS/ServiceProvider.php index 4376d115e8..aea10665bd 100644 --- a/inc/Engine/Optimization/DeferJS/ServiceProvider.php +++ b/inc/Engine/Optimization/DeferJS/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->add( 'defer_js', DeferJS::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'dynamic_lists_defaultlists_data_manager' ) ); + ->addArguments( + [ + 'options', + 'dynamic_lists_defaultlists_data_manager', + ] + ); $this->getContainer()->addShared( 'defer_js_admin_subscriber', AdminSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'defer_js' ) ); + ->addArgument( 'defer_js' ); $this->getContainer()->addShared( 'defer_js_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'defer_js' ) ); + ->addArgument( 'defer_js' ); } } From 426305b7565e45233534745aeb0e854367d4787e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:55:04 -0500 Subject: [PATCH 36/46] update arguments declaration --- .../Optimization/DelayJS/ServiceProvider.php | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/inc/Engine/Optimization/DelayJS/ServiceProvider.php b/inc/Engine/Optimization/DelayJS/ServiceProvider.php index fb39c7a2c7..35194388a0 100644 --- a/inc/Engine/Optimization/DelayJS/ServiceProvider.php +++ b/inc/Engine/Optimization/DelayJS/ServiceProvider.php @@ -1,4 +1,6 @@ getContainer()->add( 'delay_js_sitelist', SiteList::class ) - ->addArgument( $this->getContainer()->get( 'dynamic_lists' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ); + ->addArguments( + [ + 'dynamic_lists', + 'options', + 'options_api', + ] + ); $this->getContainer()->add( 'delay_js_settings', Settings::class ) - ->addArgument( $this->getContainer()->get( 'options_api' ) ); + ->addArgument( 'options_api' ); $this->getContainer()->addShared( 'delay_js_admin_subscriber', AdminSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'delay_js_settings' ) ) - ->addArgument( $this->getContainer()->get( 'delay_js_sitelist' ) ); + ->addArguments( + [ + 'delay_js_settings', + 'delay_js_sitelist', + ] + ); $this->getContainer()->add( 'delay_js_html', HTML::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'dynamic_lists_defaultlists_data_manager' ) ) - ->addArgument( new Logger() ); + ->addArguments( + [ + 'options', + 'dynamic_lists_defaultlists_data_manager', + 'logger', + ] + ); $this->getContainer()->addShared( 'delay_js_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'delay_js_html' ) ) - ->addArgument( rocket_direct_filesystem() ); + ->addArguments( + [ + 'delay_js_html', + rocket_direct_filesystem(), + ] + ); } } From 7a0ee66adf9366a3bff55ac124c7b625ada58628 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 11:57:30 -0500 Subject: [PATCH 37/46] update arguments declaration --- .../Preload/Activation/ServiceProvider.php | 37 +++++++++---------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/inc/Engine/Preload/Activation/ServiceProvider.php b/inc/Engine/Preload/Activation/ServiceProvider.php index 51e492fd17..6ef624771d 100755 --- a/inc/Engine/Preload/Activation/ServiceProvider.php +++ b/inc/Engine/Preload/Activation/ServiceProvider.php @@ -3,12 +3,10 @@ namespace WP_Rocket\Engine\Preload\Activation; -use WP_Filesystem_Direct; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Engine\Preload\Controller\{PreloadUrl, Queue}; use WP_Rocket\Engine\Preload\Database\Queries\Cache as CacheQuery; use WP_Rocket\Engine\Preload\Database\Tables\Cache as CacheTable; -use WP_Rocket\Logger\Logger; class ServiceProvider extends AbstractServiceProvider { /** @@ -43,29 +41,28 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $options = $this->getContainer()->get( 'options' ); - $this->getContainer()->add( 'preload_cache_table', CacheTable::class ); $this->getContainer()->get( 'preload_cache_table' ); - $this->getContainer()->add( 'wp_direct_filesystem', WP_Filesystem_Direct::class ) - ->addArgument( [] ); $this->getContainer()->add( 'preload_cache_query', CacheQuery::class ) - ->addArgument( new Logger() ); + ->addArgument( 'logger' ); $this->getContainer()->add( 'preload_queue', Queue::class ); - - $cache_query = $this->getContainer()->get( 'preload_cache_query' ); - $queue = $this->getContainer()->get( 'preload_queue' ); - $this->getContainer()->add( 'preload_url_controller', PreloadUrl::class ) - ->addArgument( $options ) - ->addArgument( $queue ) - ->addArgument( $cache_query ) - ->addArgument( $this->getContainer()->get( 'wp_direct_filesystem' ) ); - + ->addArguments( + [ + 'options', + 'preload_queue', + 'preload_cache_query', + rocket_direct_filesystem(), + ] + ); $this->getContainer()->add( 'preload_activation', Activation::class ) - ->addArgument( $this->getContainer()->get( 'preload_url_controller' ) ) - ->addArgument( $queue ) - ->addArgument( $cache_query ) - ->addArgument( $options ); + ->addArguments( + [ + 'preload_url_controller', + 'preload_queue', + 'preload_cache_query', + 'options', + ] + ); } } From 8c679938d659d5dbe53da9547a33e30858121e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 12:07:21 -0500 Subject: [PATCH 38/46] update arguments declaration --- inc/Engine/Preload/ServiceProvider.php | 163 +++++++++++++------------ 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/inc/Engine/Preload/ServiceProvider.php b/inc/Engine/Preload/ServiceProvider.php index 8c29dd4083..5623d729cb 100755 --- a/inc/Engine/Preload/ServiceProvider.php +++ b/inc/Engine/Preload/ServiceProvider.php @@ -3,7 +3,6 @@ namespace WP_Rocket\Engine\Preload; -use WP_Filesystem_Direct; use WP_Rocket\Dependencies\League\Container\ServiceProvider\AbstractServiceProvider; use WP_Rocket\Engine\Preload\Activation\Activation; use WP_Rocket\Engine\Preload\Admin\Settings; @@ -15,7 +14,6 @@ use WP_Rocket\Engine\Preload\Frontend\FetchSitemap; use WP_Rocket\Engine\Preload\Frontend\SitemapParser; use WP_Rocket\Engine\Preload\Frontend\Subscriber as FrontEndSubscriber; -use WP_Rocket\Logger\Logger; use WP_Rocket_Mobile_Detect; /** @@ -28,6 +26,7 @@ class ServiceProvider extends AbstractServiceProvider { * @var array */ protected $provides = [ + 'mobile_detect', 'preload_queue', 'sitemap_parser', 'fetch_sitemap_controller', @@ -64,101 +63,105 @@ public function provides( string $id ): bool { * @return void */ public function register(): void { - $options = $this->getContainer()->get( 'options' ); - - $this->getContainer()->add( 'preload_mobile_detect', WP_Rocket_Mobile_Detect::class ); - - $this->getContainer()->add( 'wp_direct_filesystem', WP_Filesystem_Direct::class ) - ->addArgument( [] ); - $wp_file_system = $this->getContainer()->get( 'wp_direct_filesystem' ); - + $this->getContainer()->add( 'mobile_detect', WP_Rocket_Mobile_Detect::class ); $this->getContainer()->add( 'preload_caches_table', CacheTable::class ); $this->getContainer()->add( 'preload_caches_query', CacheQuery::class ) - ->addArgument( new Logger() ); + ->addArgument( 'logger' ); $this->getContainer()->get( 'preload_caches_table' ); - $cache_query = $this->getContainer()->get( 'preload_caches_query' ); - $this->getContainer()->add( 'preload_queue', Queue::class ); - $queue = $this->getContainer()->get( 'preload_queue' ); - $this->getContainer()->add( 'preload_url_controller', PreloadUrl::class ) - ->addArgument( $options ) - ->addArgument( $queue ) - ->addArgument( $cache_query ) - ->addArgument( $wp_file_system ); - - $preload_url_controller = $this->getContainer()->get( 'preload_url_controller' ); - + ->addArguments( + [ + 'options', + 'preload_queue', + 'preload_caches_query', + rocket_direct_filesystem(), + ] + ); $this->getContainer()->add( 'homepage_crawler', CrawlHomepage::class ); - $crawl_homepage = $this->getContainer()->get( 'homepage_crawler' ); - $this->getContainer()->add( 'sitemap_parser', SitemapParser::class ); - $sitemap_parser = $this->getContainer()->get( 'sitemap_parser' ); - $this->getContainer()->add( 'fetch_sitemap_controller', FetchSitemap::class ) - ->addArgument( $sitemap_parser ) - ->addArgument( $queue ) - ->addArgument( $cache_query ); - - $fetch_sitemap_controller = $this->getContainer()->get( 'fetch_sitemap_controller' ); - + ->addArguments( + [ + 'sitemap_parser', + 'preload_queue', + 'preload_caches_query', + ] + ); $this->getContainer()->add( 'load_initial_sitemap_controller', LoadInitialSitemap::class ) - ->addArgument( $queue ) - ->addArgument( $cache_query ) - ->addArgument( $crawl_homepage ); - + ->addArguments( + [ + 'preload_queue', + 'preload_caches_query', + 'homepage_crawler', + ] + ); $this->getContainer()->add( 'preload_activation', Activation::class ) - ->addArgument( $preload_url_controller ) - ->addArgument( $queue ) - ->addArgument( $cache_query ) - ->addArgument( $options ); - + ->addArguments( + [ + 'preload_url_controller', + 'preload_queue', + 'preload_caches_query', + 'options', + ] + ); $this->getContainer()->add( 'preload_settings', Settings::class ) - ->addArgument( $options ) - ->addArgument( $preload_url_controller ) - ->addArgument( $this->getContainer()->get( 'load_initial_sitemap_controller' ) ) - ->addArgument( $this->getContainer()->get( 'preload_caches_table' ) ); - - $preload_settings = $this->getContainer()->get( 'preload_settings' ); - + ->addArguments( + [ + 'options', + 'preload_url_controller', + 'load_initial_sitemap_controller', + 'preload_caches_table', + ] + ); $this->getContainer()->add( 'check_finished_controller', CheckFinished::class ) - ->addArgument( $preload_settings ) - ->addArgument( $cache_query ) - ->addArgument( $queue ); - - $check_finished_controller = $this->getContainer()->get( 'check_finished_controller' ); - + ->addArguments( + [ + 'preload_settings', + 'preload_caches_query', + 'preload_queue', + ] + ); $this->getContainer()->addShared( 'preload_front_subscriber', FrontEndSubscriber::class ) - ->addArgument( $fetch_sitemap_controller ) - ->addArgument( $preload_url_controller ) - ->addArgument( $check_finished_controller ) - ->addArgument( $this->getContainer()->get( 'load_initial_sitemap_controller' ) ); - + ->addArguments( + [ + 'fetch_sitemap_controller', + 'preload_url_controller', + 'check_finished_controller', + 'load_initial_sitemap_controller', + ] + ); $this->getContainer()->add( 'preload_clean_controller', ClearCache::class ) - ->addArgument( $cache_query ); - - $clean_controller = $this->getContainer()->get( 'preload_clean_controller' ); - + ->addArgument( 'preload_caches_query' ); $this->getContainer()->addShared( 'preload_subscriber', Subscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'load_initial_sitemap_controller' ) ) - ->addArgument( $cache_query ) - ->addArgument( $this->getContainer()->get( 'preload_activation' ) ) - ->addArgument( $this->getContainer()->get( 'preload_mobile_detect' ) ) - ->addArgument( $clean_controller ) - ->addArgument( $queue ); - + ->addArguments( + [ + 'options', + 'load_initial_sitemap_controller', + 'preload_caches_query', + 'preload_activation', + 'mobile_detect', + 'preload_clean_controller', + 'preload_queue', + ] + ); $this->getContainer()->addShared( 'preload_cron_subscriber', CronSubscriber::class ) - ->addArgument( $preload_settings ) - ->addArgument( $cache_query ) - ->addArgument( $preload_url_controller ); - + ->addArguments( + [ + 'preload_settings', + 'preload_caches_query', + 'preload_url_controller', + ] + ); $this->getContainer()->addShared( 'fonts_preload_subscriber', Fonts::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'cdn' ) ); - - $this->getContainer()->add( 'preload_admin_subscriber', AdminSubscriber::class ) - ->addArgument( $preload_settings ); + ->addArguments( + [ + 'options', + 'cdn', + ] + ); + $this->getContainer()->addShared( 'preload_admin_subscriber', AdminSubscriber::class ) + ->addArgument( 'preload_settings' ); } } From bf22782ed7f6acc81020111a48393085a8fc6b1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:11:26 -0500 Subject: [PATCH 39/46] update arguments declaration --- .../LazyRenderContent/ServiceProvider.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/inc/Engine/Optimization/LazyRenderContent/ServiceProvider.php b/inc/Engine/Optimization/LazyRenderContent/ServiceProvider.php index 023710553e..600b028608 100644 --- a/inc/Engine/Optimization/LazyRenderContent/ServiceProvider.php +++ b/inc/Engine/Optimization/LazyRenderContent/ServiceProvider.php @@ -56,16 +56,16 @@ public function register(): void { $this->getContainer()->add( 'lrc_ajax_controller', AJAXController::class ) ->addArguments( [ - $this->getContainer()->get( 'lrc_query' ), - $this->getContainer()->get( 'lrc_context' ), + 'lrc_query', + 'lrc_context', ] ); $this->getContainer()->add( 'lrc_frontend_processor', Processor::class ); $this->getContainer()->add( 'lrc_frontend_controller', FrontController::class ) ->addArguments( [ - $this->getContainer()->get( 'lrc_frontend_processor' ), - $this->getContainer()->get( 'lrc_context' ), + 'lrc_frontend_processor', + 'lrc_context', ] ); $this->getContainer()->addShared( 'lrc_frontend_subscriber', FrontSubscriber::class ) @@ -78,11 +78,11 @@ public function register(): void { $this->getContainer()->addShared( 'lrc_factory', Factory::class ) ->addArguments( [ - $this->getContainer()->get( 'lrc_context' ), - $this->getContainer()->get( 'lrc_table' ), - $this->getContainer()->get( 'lrc_query' ), - $this->getContainer()->get( 'lrc_ajax_controller' ), - $this->getContainer()->get( 'lrc_frontend_controller' ), + 'lrc_context', + 'lrc_table', + 'lrc_query', + 'lrc_ajax_controller', + 'lrc_frontend_controller', ] ); } From d5bed5aae4500033141d79a1c4f7ca112695e3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:13:56 -0500 Subject: [PATCH 40/46] update arguments declaration --- inc/Engine/Optimization/ServiceProvider.php | 47 ++++++++++++++------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/inc/Engine/Optimization/ServiceProvider.php b/inc/Engine/Optimization/ServiceProvider.php index 65cc7d66f0..86964d46af 100644 --- a/inc/Engine/Optimization/ServiceProvider.php +++ b/inc/Engine/Optimization/ServiceProvider.php @@ -1,10 +1,13 @@ getContainer()->get( 'options' ); $filesystem = rocket_direct_filesystem(); $this->getContainer()->add( 'buffer_optimization', Optimization::class ) - ->addArgument( $this->getContainer()->get( 'tests' ) ); + ->addArgument( 'tests' ); $this->getContainer()->addShared( 'buffer_subscriber', BufferSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'buffer_optimization' ) ); + ->addArgument( 'buffer_optimization' ); $this->getContainer()->addShared( 'cache_dynamic_resource', CacheDynamicResource::class ) - ->addArgument( $options ) - ->addArgument( WP_ROCKET_CACHE_BUSTING_PATH ) - ->addArgument( WP_ROCKET_CACHE_BUSTING_URL ); + ->addArguments( + [ + 'options', + new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_PATH', '' ) ), + new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_URL', '' ) ) + ] + ); $this->getContainer()->add( 'optimize_google_fonts', Combine::class ); $this->getContainer()->add( 'optimize_google_fonts_v2', CombineV2::class ); $this->getContainer()->addShared( 'combine_google_fonts_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'optimize_google_fonts' ) ) - ->addArgument( $this->getContainer()->get( 'optimize_google_fonts_v2' ) ) - ->addArgument( $options ); + ->addArguments( + [ + 'optimize_google_fonts', + 'optimize_google_fonts_v2', + 'options', + ] ); $this->getContainer()->addShared( 'minify_css_subscriber', Minify\CSS\Subscriber::class ) - ->addArgument( $options ) - ->addArgument( $filesystem ); + ->addArguments( + [ + 'options', + $filesystem + ] + ); $this->getContainer()->addShared( 'minify_js_subscriber', Minify\JS\Subscriber::class ) - ->addArgument( $options ) - ->addArgument( $filesystem ); + ->addArguments( + [ + 'options', + $filesystem + ] + ); $this->getContainer()->addShared( 'ie_conditionals_subscriber', IEConditionalSubscriber::class ); } } From 31325ed1395dbdd62a3aefbb24b85ac32aef053c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:15:30 -0500 Subject: [PATCH 41/46] update arguments declaration --- .../Optimization/AdminServiceProvider.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/inc/Engine/Optimization/AdminServiceProvider.php b/inc/Engine/Optimization/AdminServiceProvider.php index 2c5730e4d2..9790b6c29b 100644 --- a/inc/Engine/Optimization/AdminServiceProvider.php +++ b/inc/Engine/Optimization/AdminServiceProvider.php @@ -1,7 +1,12 @@ getContainer()->addShared( 'minify_css_admin_subscriber', 'WP_Rocket\Engine\Optimization\Minify\CSS\AdminSubscriber' ); - $this->getContainer()->add( 'google_fonts_settings', 'WP_Rocket\Engine\Optimization\GoogleFonts\Admin\Settings' ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) ); - $this->getContainer()->addShared( 'google_fonts_admin_subscriber', 'WP_Rocket\Engine\Optimization\GoogleFonts\Admin\Subscriber' ) - ->addArgument( $this->getContainer()->get( 'google_fonts_settings' ) ); - $this->getContainer()->addShared( 'minify_admin_subscriber', 'WP_Rocket\Engine\Optimization\Minify\AdminSubscriber' ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + $this->getContainer()->addShared( 'minify_css_admin_subscriber', MinifyCssAdminSubscriber::class ); + $this->getContainer()->add( 'google_fonts_settings', Settings::class ) + ->addArgument( 'options' ) + ->addArgument( 'beacon' ) + ->addArgument( 'template_path' ); + $this->getContainer()->addShared( 'google_fonts_admin_subscriber', Subscriber::class ) + ->addArgument( 'google_fonts_settings' ); + $this->getContainer()->addShared( 'minify_admin_subscriber', MinifyAdminSubscriber::class ) + ->addArgument( 'options' ); } } From 03660b096c5eba9dedd3b132cc449b64e3b894ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:23:23 -0500 Subject: [PATCH 42/46] update arguments declaration --- .../Optimization/RUCSS/ServiceProvider.php | 107 +++++++++++------- 1 file changed, 65 insertions(+), 42 deletions(-) diff --git a/inc/Engine/Optimization/RUCSS/ServiceProvider.php b/inc/Engine/Optimization/RUCSS/ServiceProvider.php index 3e4bef6c37..10a8a2e1f3 100644 --- a/inc/Engine/Optimization/RUCSS/ServiceProvider.php +++ b/inc/Engine/Optimization/RUCSS/ServiceProvider.php @@ -1,6 +1,9 @@ getContainer()->addShared( 'rucss_usedcss_table', UsedCSSTable::class ); $this->getContainer()->add( 'rucss_database', Database::class ) - ->addArgument( $this->getContainer()->get( 'rucss_usedcss_table' ) ); + ->addArgument( 'rucss_usedcss_table' ); $this->getContainer()->add( 'rucss_settings', Settings::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_usedcss_table' ) ); - + ->addArguments( + [ + 'options', + 'beacon', + 'rucss_usedcss_table', + ] + ); $this->getContainer()->add( 'rucss_used_css_query', UsedCSSQuery::class ); $this->getContainer()->add( 'rucss_queue', Queue::class ); $this->getContainer()->add( 'rucss_filesystem', Filesystem::class ) - ->addArgument( rocket_get_constant( 'WP_ROCKET_USED_CSS_PATH' ) ) - ->addArgument( rocket_direct_filesystem() ); - + ->addArguments( + [ + new StringArgument( rocket_get_constant( 'WP_ROCKET_USED_CSS_PATH', '' ) ), + rocket_direct_filesystem(), + ] + ); $this->getContainer()->add( 'rucss_context', RUCSSContext::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_filesystem' ) ); - + ->addArguments( + [ + 'options', + 'rucss_filesystem', + ] + ); $this->getContainer()->add( 'rucss_optimize_context', RUCSSOptimizeContext::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - + ->addArgument( 'options' ); $this->getContainer()->add( 'rucss_context_saas', RUCSSContextSaas::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); - + ->addArgument( 'options' ); $this->getContainer()->add( 'rucss_manager', Manager::class ) ->addArguments( [ - $this->getContainer()->get( 'rucss_used_css_query' ), - $this->getContainer()->get( 'rucss_filesystem' ), - $this->getContainer()->get( 'rucss_context_saas' ), - $this->getContainer()->get( 'options' ), + 'rucss_used_css_query', + 'rucss_filesystem', + 'rucss_context_saas', + 'options', ] ); - $this->getContainer()->addShared( 'rucss_factory', Factory::class ) ->addArguments( - [ - $this->getContainer()->get( 'rucss_manager' ), - $this->getContainer()->get( 'rucss_usedcss_table' ), - ] + [ + 'rucss_manager', + 'rucss_usedcss_table', + ] ); - $this->getContainer()->add( 'rucss_used_css_controller', UsedCSSController::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_used_css_query' ) ) - ->addArgument( $this->getContainer()->get( 'dynamic_lists_defaultlists_data_manager' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_filesystem' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_context' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_manager' ) ); - + ->addArguments( + [ + 'options', + 'rucss_used_css_query', + 'dynamic_lists_defaultlists_data_manager', + 'rucss_filesystem', + 'rucss_context', + 'rucss_manager', + ] + ); $this->getContainer()->addShared( 'rucss_option_subscriber', OptionSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rucss_settings' ) ); + ->addArgument( 'rucss_settings' ); $this->getContainer()->addShared( 'rucss_admin_subscriber', AdminSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rucss_settings' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_database' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_used_css_controller' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_queue' ) ); + ->addArguments( + [ + 'rucss_settings', + 'rucss_database', + 'rucss_used_css_controller', + 'rucss_queue', + ] + ); $this->getContainer()->addShared( 'rucss_frontend_subscriber', FrontendSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'rucss_used_css_controller' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_context' ) ); - + ->addArguments( + [ + 'rucss_used_css_controller', + 'rucss_context', + ] + ); $this->getContainer()->addShared( 'rucss_cron_subscriber', CronSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'job_processor' ) ) - ->addArgument( $this->getContainer()->get( 'rucss_used_css_query' ) ); + ->addArguments( + [ + 'job_processor', + 'rucss_used_css_query', + ] + ); } } From df5e1794a240b7b82ff5b3549442e886d7a13766 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:26:08 -0500 Subject: [PATCH 43/46] update arguments declaration --- .../DynamicLists/ServiceProvider.php | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/inc/Engine/Optimization/DynamicLists/ServiceProvider.php b/inc/Engine/Optimization/DynamicLists/ServiceProvider.php index cfb64586f5..8dc27e566d 100644 --- a/inc/Engine/Optimization/DynamicLists/ServiceProvider.php +++ b/inc/Engine/Optimization/DynamicLists/ServiceProvider.php @@ -1,4 +1,5 @@ getContainer()->add( 'dynamic_lists_defaultlists_data_manager', DefaultListsDataManager::class ); $this->getContainer()->add( 'dynamic_lists_defaultlists_api_client', DefaultListsAPIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->add( 'dynamic_lists_delayjslists_data_manager', DelayJSListsDataManager::class ); $this->getContainer()->add( 'dynamic_lists_delayjslists_api_client', DelayJSListsAPIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->add( 'dynamic_lists_incompatible_plugins_lists_data_manager', IncompatiblePluginsListsDataManager::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $this->getContainer()->add( 'dynamic_lists_incompatible_plugins_lists_api_client', IncompatiblePluginsListsAPIClient::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ); + ->addArgument( 'options' ); $providers = [ 'defaultlists' => @@ -84,12 +85,15 @@ public function register(): void { ]; $this->getContainer()->add( 'dynamic_lists', DynamicLists::class ) - ->addArgument( $providers ) - ->addArgument( $this->getContainer()->get( 'user' ) ) - ->addArgument( $this->getContainer()->get( 'template_path' ) ) - ->addArgument( $this->getContainer()->get( 'beacon' ) ); - + ->addArguments( + [ + $providers, + 'user', + 'template_path', + 'beacon', + ] + ); $this->getContainer()->addShared( 'dynamic_lists_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'dynamic_lists' ) ); + ->addArgument( 'dynamic_lists' ); } } From 889934242f30f1a7e4285b4a3881f053e6266dc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:28:19 -0500 Subject: [PATCH 44/46] update arguments declaration --- inc/Engine/Media/ServiceProvider.php | 43 ++++++++++++++++++---------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/inc/Engine/Media/ServiceProvider.php b/inc/Engine/Media/ServiceProvider.php index 1b3d686a0c..dd364c4065 100644 --- a/inc/Engine/Media/ServiceProvider.php +++ b/inc/Engine/Media/ServiceProvider.php @@ -1,8 +1,10 @@ getContainer()->get( 'options' ); - $this->getContainer()->add( 'config', Config::class ) - ->addArgument( [ 'config_dir_path' => rocket_get_constant( 'WP_ROCKET_CONFIG_PATH' ) ] ); + ->addArgument( + new ArrayArgument( + [ + 'config_dir_path' => rocket_get_constant( 'WP_ROCKET_CONFIG_PATH' ), + ] + ) + ); $this->getContainer()->add( 'tests', Tests::class ) - ->addArgument( $this->getContainer()->get( 'config' ) ); + ->addArgument( 'config' ); $this->getContainer()->add( 'lazyload_assets', Assets::class ); $this->getContainer()->add( 'lazyload_image', Image::class ); $this->getContainer()->add( 'lazyload_iframe', Iframe::class ); $this->getContainer()->addShared( 'lazyload_subscriber', Subscriber::class ) - ->addArgument( $options ) - ->addArgument( $this->getContainer()->get( 'lazyload_assets' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_image' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_iframe' ) ); + ->addArguments( [ + 'options', + 'lazyload_assets', + 'lazyload_image', + 'lazyload_iframe', + ] + ); $this->getContainer()->addShared( 'lazyload_admin_subscriber', LazyloadAdminSubscriber::class ); $this->getContainer()->addShared( 'emojis_subscriber', EmojisSubscriber::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->add( 'image_dimensions', ImageDimensions::class ) - ->addArgument( $options ); + ->addArgument( 'options' ); $this->getContainer()->addShared( 'image_dimensions_subscriber', ImageDimensionsSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'image_dimensions' ) ) - ->addArgument( $this->getContainer()->get( 'tests' ) ); + ->addArguments( + [ + 'image_dimensions', + 'tests', + ] + ); $this->getContainer()->addShared( 'image_dimensions_admin_subscriber', ImageDimensionsAdminSubscriber::class ) - ->addArgument( $this->getContainer()->get( 'image_dimensions' ) ); + ->addArgument( 'image_dimensions' ); } } From 4badbe02b76e52d6c3c6e71376912241b3801ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:33:25 -0500 Subject: [PATCH 45/46] update arguments declaration --- .../Media/Lazyload/CSS/ServiceProvider.php | 59 +++++++++++-------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/inc/Engine/Media/Lazyload/CSS/ServiceProvider.php b/inc/Engine/Media/Lazyload/CSS/ServiceProvider.php index 10f0189942..d7b828be67 100644 --- a/inc/Engine/Media/Lazyload/CSS/ServiceProvider.php +++ b/inc/Engine/Media/Lazyload/CSS/ServiceProvider.php @@ -1,7 +1,9 @@ getContainer()->add( 'lazyload_css_cache', FilesystemCache::class ) - ->addArgument( apply_filters( 'rocket_lazyload_css_cache_root', 'background-css/' . get_current_blog_id() ) ); + $path = apply_filters( 'rocket_lazyload_css_cache_root', 'background-css/' . get_current_blog_id() ); - $cache = $this->getContainer()->get( 'lazyload_css_cache' ); + $this->getContainer()->add( 'lazyload_css_cache', FilesystemCache::class ) + ->addArgument( new StringArgument( $path ) ); $this->getContainer()->add( 'lazyload_css_context', LazyloadCSSContext::class ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $cache ); - - $this->getContainer()->add( 'lazyload_css_fetcher', ContentFetcher::class ); - + ->addArguments( + [ + 'options', + 'lazyload_css_cache', + ] + ); + $this->getContainer()->add( 'lazyload_css_content_fetcher', ContentFetcher::class ); $this->getContainer()->add( 'lazyload_css_extractor', Extractor::class ); $this->getContainer()->add( 'lazyload_css_file_resolver', FileResolver::class ); - $this->getContainer()->add( 'lazyload_css_json_formatter', MappingFormatter::class ); + $this->getContainer()->add( 'lazyload_css_mapping_formatter', MappingFormatter::class ); $this->getContainer()->add( 'lazyload_css_rule_formatter', RuleFormatter::class ); $this->getContainer()->add( 'lazyload_css_tag_generator', TagGenerator::class ); - - $this->getContainer()->add( 'lazyload_css_factory', LazyloadCSSContentFactory::class ); - + $this->getContainer()->add( 'lazyload_css_content_factory', LazyloadCSSContentFactory::class ); $this->getContainer()->addShared( 'lazyload_css_subscriber', Subscriber::class ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_extractor' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_rule_formatter' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_file_resolver' ) ) - ->addArgument( $cache ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_json_formatter' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_tag_generator' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_fetcher' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_context' ) ) - ->addArgument( $this->getContainer()->get( 'options' ) ) - ->addArgument( $this->getContainer()->get( 'lazyload_css_factory' ) ); + ->addArguments( + [ + 'lazyload_css_extractor', + 'lazyload_css_rule_formatter', + 'lazyload_css_file_resolver', + 'lazyload_css_cache', + 'lazyload_css_mapping_formatter', + 'lazyload_css_tag_generator', + 'lazyload_css_content_fetcher', + 'lazyload_css_context', + 'options', + 'lazyload_css_content_factory', + ] + ); } } From 0bb62734ecd4192d727576674e750ecd78fd882f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Perona?= Date: Fri, 10 Jan 2025 14:38:46 -0500 Subject: [PATCH 46/46] fix code styling --- inc/Engine/Admin/ServiceProvider.php | 2 +- inc/Engine/Admin/Settings/ServiceProvider.php | 6 +++--- inc/Engine/Media/ServiceProvider.php | 3 ++- inc/Engine/Optimization/AdminServiceProvider.php | 2 +- inc/Engine/Optimization/ServiceProvider.php | 15 ++++++++------- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/inc/Engine/Admin/ServiceProvider.php b/inc/Engine/Admin/ServiceProvider.php index 57a22a2a56..2e62ce1966 100644 --- a/inc/Engine/Admin/ServiceProvider.php +++ b/inc/Engine/Admin/ServiceProvider.php @@ -60,7 +60,7 @@ public function register(): void { ->addArguments( [ 'options', - new StringArgument( $this->getContainer()->get( 'template_path' ) . '/metaboxes'), + new StringArgument( $this->getContainer()->get( 'template_path' ) . '/metaboxes' ), ] ); } diff --git a/inc/Engine/Admin/Settings/ServiceProvider.php b/inc/Engine/Admin/Settings/ServiceProvider.php index de10c7ca58..3eac3e3a7c 100644 --- a/inc/Engine/Admin/Settings/ServiceProvider.php +++ b/inc/Engine/Admin/Settings/ServiceProvider.php @@ -60,9 +60,9 @@ public function register(): void { [ new ArrayArgument( [ - 'slug' => WP_ROCKET_PLUGIN_SLUG, - 'title' => WP_ROCKET_PLUGIN_NAME, - 'capability' => 'rocket_manage_options', + 'slug' => WP_ROCKET_PLUGIN_SLUG, + 'title' => WP_ROCKET_PLUGIN_NAME, + 'capability' => 'rocket_manage_options', ] ), 'settings', diff --git a/inc/Engine/Media/ServiceProvider.php b/inc/Engine/Media/ServiceProvider.php index dd364c4065..8a866a2423 100644 --- a/inc/Engine/Media/ServiceProvider.php +++ b/inc/Engine/Media/ServiceProvider.php @@ -73,7 +73,8 @@ public function register(): void { $this->getContainer()->add( 'lazyload_image', Image::class ); $this->getContainer()->add( 'lazyload_iframe', Iframe::class ); $this->getContainer()->addShared( 'lazyload_subscriber', Subscriber::class ) - ->addArguments( [ + ->addArguments( + [ 'options', 'lazyload_assets', 'lazyload_image', diff --git a/inc/Engine/Optimization/AdminServiceProvider.php b/inc/Engine/Optimization/AdminServiceProvider.php index 9790b6c29b..2609bf46bb 100644 --- a/inc/Engine/Optimization/AdminServiceProvider.php +++ b/inc/Engine/Optimization/AdminServiceProvider.php @@ -42,7 +42,7 @@ public function provides( string $id ): bool { */ public function register(): void { $this->getContainer()->addShared( 'minify_css_admin_subscriber', MinifyCssAdminSubscriber::class ); - $this->getContainer()->add( 'google_fonts_settings', Settings::class ) + $this->getContainer()->add( 'google_fonts_settings', Settings::class ) ->addArgument( 'options' ) ->addArgument( 'beacon' ) ->addArgument( 'template_path' ); diff --git a/inc/Engine/Optimization/ServiceProvider.php b/inc/Engine/Optimization/ServiceProvider.php index 86964d46af..06e484336d 100644 --- a/inc/Engine/Optimization/ServiceProvider.php +++ b/inc/Engine/Optimization/ServiceProvider.php @@ -58,7 +58,7 @@ public function register(): void { [ 'options', new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_PATH', '' ) ), - new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_URL', '' ) ) + new StringArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_URL', '' ) ), ] ); $this->getContainer()->add( 'optimize_google_fonts', Combine::class ); @@ -66,22 +66,23 @@ public function register(): void { $this->getContainer()->addShared( 'combine_google_fonts_subscriber', Subscriber::class ) ->addArguments( [ - 'optimize_google_fonts', - 'optimize_google_fonts_v2', - 'options', - ] ); + 'optimize_google_fonts', + 'optimize_google_fonts_v2', + 'options', + ] + ); $this->getContainer()->addShared( 'minify_css_subscriber', Minify\CSS\Subscriber::class ) ->addArguments( [ 'options', - $filesystem + $filesystem, ] ); $this->getContainer()->addShared( 'minify_js_subscriber', Minify\JS\Subscriber::class ) ->addArguments( [ 'options', - $filesystem + $filesystem, ] ); $this->getContainer()->addShared( 'ie_conditionals_subscriber', IEConditionalSubscriber::class );