Skip to content
This repository was archived by the owner on Feb 23, 2024. It is now read-only.

Commit 6c2a9c2

Browse files
authored
Remove unnecessary package version reading of @wordpress/components (#1154)
* remove unnecessary package version reading of @wordpress/components * comment out unused variable
1 parent e777b0c commit 6c2a9c2

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

src/Domain/Bootstrap.php

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,26 +75,17 @@ function ( Container $container ) {
7575
$this->container->register(
7676
AssetDataRegistry::class,
7777
function( Container $container ) {
78-
$asset_api = $container->get( AssetApi::class );
79-
$js_package = \json_decode(
80-
// phpcs:disable WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
81-
\file_get_contents(
82-
$this->package->get_path( 'package.json' )
83-
),
84-
true
85-
);
86-
$woocommerce_components_version =
87-
isset( $js_package['dependencies']['@woocommerce/components'] )
88-
? $js_package['dependencies']['@woocommerce/components']
89-
: 0;
90-
$load_back_compat = '3.2.0' === $woocommerce_components_version
91-
|| (
92-
defined( 'WC_ADMIN_VERSION_NUMBER' )
93-
&& version_compare( WC_ADMIN_VERSION_NUMBER, '0.19.0', '<=' )
94-
);
95-
return $load_back_compat
96-
? new BackCompatAssetDataRegistry( $asset_api )
97-
: new AssetDataRegistry( $asset_api );
78+
$asset_api = $container->get( AssetApi::class );
79+
// phpcs:disable Squiz . PHP . CommentedOutCode . Found
80+
// @todo: this needs added back in once the @woocommerce/components
81+
// package has been updated.
82+
// $load_back_compat = defined( 'WC_ADMIN_VERSION_NUMBER' )
83+
// && version_compare( WC_ADMIN_VERSION_NUMBER, '0.19.0', '<=' );
84+
// return $load_back_compat
85+
// ? new BackCompatAssetDataRegistry( $asset_api )
86+
// : new AssetDataRegistry( $asset_api );
87+
// phpcs:enable
88+
return new BackCompatAssetDataRegistry( $asset_api );
9889
}
9990
);
10091

0 commit comments

Comments
 (0)