Upgrade to PHPUnit 10, add PHPCS with WPCS compliance, add phpcs CI job
All checks were successful
Create Release Package / PHP Lint (push) Successful in 48s
Create Release Package / PHP CodeSniffer (push) Successful in 52s
Create Release Package / PHP Unit (push) Successful in 53s
Create Release Package / build-release (push) Successful in 59s

- Upgrade PHPUnit 9.6 → 10, update phpunit.xml.dist schema
- Add PHPCS 3.13 with WordPress-Extra + PHPCompatibilityWP standards
- PHPCBF auto-fix + manual fixes for full WPCS compliance
- Add phpcs job to release workflow (parallel with lint)
- Pin composer platform to PHP 8.3 to prevent incompatible dep locks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-01 13:25:02 +01:00
parent a7d6a57f01
commit dea1b055b2
16 changed files with 2006 additions and 1365 deletions

View File

@@ -7,109 +7,109 @@
namespace Magdev\WcComposableProduct\Admin;
defined('ABSPATH') || exit;
defined( 'ABSPATH' ) || exit;
/**
* Settings class
*/
class Settings extends \WC_Settings_Page {
/**
* Constructor
*/
public function __construct() {
$this->id = 'composable_products';
$this->label = __('Composable Products', 'wc-composable-product');
/**
* Constructor
*/
public function __construct() {
$this->id = 'composable_products';
$this->label = __( 'Composable Products', 'wc-composable-product' );
parent::__construct();
}
parent::__construct();
}
/**
* Get settings array
*
* @return array
*/
public function get_settings() {
$settings = [
[
'title' => __('Composable Products Settings', 'wc-composable-product'),
'type' => 'title',
'desc' => __('Configure default settings for composable products.', 'wc-composable-product'),
'id' => 'wc_composable_settings',
],
[
'title' => __('Default Selection Limit', 'wc-composable-product'),
'desc' => __('Default number of items customers can select.', 'wc-composable-product'),
'id' => 'wc_composable_default_limit',
'type' => 'number',
'default' => '5',
'custom_attributes' => [
'min' => '1',
'step' => '1',
],
'desc_tip' => true,
],
[
'title' => __('Default Pricing Mode', 'wc-composable-product'),
'desc' => __('How to calculate the price of composable products.', 'wc-composable-product'),
'id' => 'wc_composable_default_pricing',
'type' => 'select',
'default' => 'sum',
'options' => [
'sum' => __('Sum of selected products', 'wc-composable-product'),
'fixed' => __('Fixed price', 'wc-composable-product'),
],
'desc_tip' => true,
],
[
'title' => __('Include Non-Public Products', 'wc-composable-product'),
'desc' => __('Allow draft and private products to appear in composable product selections. Useful when products should only be sold as part of a composition, not individually.', 'wc-composable-product'),
'id' => 'wc_composable_include_unpublished',
'type' => 'checkbox',
'default' => 'no',
],
[
'title' => __('Show Product Images', 'wc-composable-product'),
'desc' => __('Display product images in the selection interface.', 'wc-composable-product'),
'id' => 'wc_composable_show_images',
'type' => 'checkbox',
'default' => 'yes',
],
[
'title' => __('Show Product Prices', 'wc-composable-product'),
'desc' => __('Display individual product prices in the selection interface.', 'wc-composable-product'),
'id' => 'wc_composable_show_prices',
'type' => 'checkbox',
'default' => 'yes',
],
[
'title' => __('Show Total Price', 'wc-composable-product'),
'desc' => __('Display the total price as customers make selections.', 'wc-composable-product'),
'id' => 'wc_composable_show_total',
'type' => 'checkbox',
'default' => 'yes',
],
[
'type' => 'sectionend',
'id' => 'wc_composable_settings',
],
];
/**
* Get settings array
*
* @return array
*/
public function get_settings() {
$settings = array(
array(
'title' => __( 'Composable Products Settings', 'wc-composable-product' ),
'type' => 'title',
'desc' => __( 'Configure default settings for composable products.', 'wc-composable-product' ),
'id' => 'wc_composable_settings',
),
array(
'title' => __( 'Default Selection Limit', 'wc-composable-product' ),
'desc' => __( 'Default number of items customers can select.', 'wc-composable-product' ),
'id' => 'wc_composable_default_limit',
'type' => 'number',
'default' => '5',
'custom_attributes' => array(
'min' => '1',
'step' => '1',
),
'desc_tip' => true,
),
array(
'title' => __( 'Default Pricing Mode', 'wc-composable-product' ),
'desc' => __( 'How to calculate the price of composable products.', 'wc-composable-product' ),
'id' => 'wc_composable_default_pricing',
'type' => 'select',
'default' => 'sum',
'options' => array(
'sum' => __( 'Sum of selected products', 'wc-composable-product' ),
'fixed' => __( 'Fixed price', 'wc-composable-product' ),
),
'desc_tip' => true,
),
array(
'title' => __( 'Include Non-Public Products', 'wc-composable-product' ),
'desc' => __( 'Allow draft and private products to appear in composable product selections. Useful when products should only be sold as part of a composition, not individually.', 'wc-composable-product' ),
'id' => 'wc_composable_include_unpublished',
'type' => 'checkbox',
'default' => 'no',
),
array(
'title' => __( 'Show Product Images', 'wc-composable-product' ),
'desc' => __( 'Display product images in the selection interface.', 'wc-composable-product' ),
'id' => 'wc_composable_show_images',
'type' => 'checkbox',
'default' => 'yes',
),
array(
'title' => __( 'Show Product Prices', 'wc-composable-product' ),
'desc' => __( 'Display individual product prices in the selection interface.', 'wc-composable-product' ),
'id' => 'wc_composable_show_prices',
'type' => 'checkbox',
'default' => 'yes',
),
array(
'title' => __( 'Show Total Price', 'wc-composable-product' ),
'desc' => __( 'Display the total price as customers make selections.', 'wc-composable-product' ),
'id' => 'wc_composable_show_total',
'type' => 'checkbox',
'default' => 'yes',
),
array(
'type' => 'sectionend',
'id' => 'wc_composable_settings',
),
);
return apply_filters('wc_composable_settings', $settings);
}
return apply_filters( 'wc_composable_settings', $settings );
}
/**
* Output the settings
*/
public function output() {
$settings = $this->get_settings();
\WC_Admin_Settings::output_fields($settings);
}
/**
* Output the settings
*/
public function output() {
$settings = $this->get_settings();
\WC_Admin_Settings::output_fields( $settings );
}
/**
* Save settings
*/
public function save() {
$settings = $this->get_settings();
\WC_Admin_Settings::save_fields($settings);
}
/**
* Save settings
*/
public function save() {
$settings = $this->get_settings();
\WC_Admin_Settings::save_fields( $settings );
}
}