Skip to content

Commit

Permalink
Fixes dynamic property creation deprecation warnings with PHP8.2 (#2606)
Browse files Browse the repository at this point in the history
  • Loading branch information
krutidugade authored Aug 14, 2023
2 parents 7638ca2 + c35d94f commit b152860
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 1 deletion.
6 changes: 6 additions & 0 deletions class-wc-facebookcommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class WC_Facebookcommerce extends WooCommerce\Facebook\Framework\Plugin {
/** @var WooCommerce\Facebook\ExternalVersionUpdate */
private $external_version_update;

/** @var WooCommerce\Facebook\Feed\FeedConfigurationDetection instance. */
private $configuration_detection;

/** @var WooCommerce\Facebook\Products\FBCategories instance. */
private $fb_categories;

/**
* The Debug tools instance.
*
Expand Down
6 changes: 6 additions & 0 deletions facebook-commerce-messenger-chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
*/
class WC_Facebookcommerce_MessengerChat {

/** @var string Facebook Page ID. */
private $page_id;

/** @var string|null JS SDK Version. */
private $jssdk_version;

/**
* Class constructor.
*
Expand Down
9 changes: 9 additions & 0 deletions facebook-commerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,15 @@ class WC_Facebookcommerce_Integration extends WC_Integration {
/** @var WC_Facebookcommerce */
private $facebook_for_woocommerce;

/** @var WC_Facebookcommerce_EventsTracker instance. */
private $events_tracker;

/** @var WC_Facebookcommerce_MessengerChat instance. */
private $messenger_chat;

/** @var WC_Facebookcommerce_Background_Process instance. */
private $background_processor;

/**
* Init and hook in the integration.
*
Expand Down
2 changes: 2 additions & 0 deletions includes/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class Admin {
/** @var array screens ids where to include scripts */
protected $screen_ids = [];

/** @var Product_Sets the product set admin handler. */
protected $product_sets;

/**
* Admin constructor.
Expand Down
20 changes: 20 additions & 0 deletions includes/Admin/Enhanced_Catalog_Attribute_Fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,26 @@ class Enhanced_Catalog_Attribute_Fields {
const PAGE_TYPE_ADD_CATEGORY = 'add_category';
const PAGE_TYPE_EDIT_PRODUCT = 'edit_product';

/**
* @var string Facebook page type.
*/
private $page_type;

/**
* @var \WP_Term
*/
private $term;

/**
* @var \WC_Product
*/
private $product;

/**
* @var \WooCommerce\Facebook\Products\FBCategories
*/
private $category_handler;

public function __construct( $page_type, \WP_Term $term = null, \WC_Product $product = null ) {
$this->page_type = $page_type;
$this->term = $term;
Expand Down
7 changes: 7 additions & 0 deletions includes/ProductSync/ProductValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ class ProductValidator {
*/
protected $fb_product_parent;

/**
* The product object to validate.
*
* @var WC_Facebook_Product
*/
protected $facebook_product;

/**
* ProductValidator constructor.
*
Expand Down
5 changes: 5 additions & 0 deletions includes/fbbackground.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

class WC_Facebookcommerce_Background_Process extends WP_Background_Process {

/**
* @var WC_Facebookcommerce_Integration instance.
*/
private $commerce;

public function __construct( $commerce ) {
$this->commerce = $commerce; // Full WC_Facebookcommerce_Integration obj
}
Expand Down
40 changes: 40 additions & 0 deletions includes/fbproduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,46 @@ class WC_Facebook_Product {
'variation' => 1,
);

/**
* @var int WC_Product ID.
*/
private $id;

/**
* @var WC_Product
*/
public $woo_product;

/**
* @var string Facebook Product Description.
*/
private $fb_description;

/**
* @var array Gallery URLs.
*/
private $gallery_urls;

/**
* @var bool Use parent image for variable products.
*/
private $fb_use_parent_image;

/**
* @var string Product Description.
*/
private $main_description;

/**
* @var bool Sync short description.
*/
private $sync_short_description;

/**
* @var bool Product visibility on Facebook.
*/
public $fb_visibility;

public function __construct( $wpid, $parent_product = null ) {

if ( $wpid instanceof WC_Product ) {
Expand Down
7 changes: 6 additions & 1 deletion tests/Unit/WCFacebookCommerceIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,12 @@ function ( $use_pii ) {
public function test_load_background_sync_process() {
$this->integration->load_background_sync_process();

$this->assertInstanceOf( WC_Facebookcommerce_Background_Process::class, $this->integration->background_processor );
$ref = new \ReflectionClass( $this->integration );
$background_processor_prop = $ref->getProperty( 'background_processor' );
$background_processor_prop->setAccessible( true );
$background_processor = $background_processor_prop->getValue( $this->integration );

$this->assertInstanceOf(WC_Facebookcommerce_Background_Process::class, $background_processor);
$this->assertEquals(
10,
has_action(
Expand Down

0 comments on commit b152860

Please sign in to comment.