From 7cb2c809e7a45c2ac9a35fdc1e3f27dfb9f5773d Mon Sep 17 00:00:00 2001 From: Oleksandr Aratovskyi <79862886+oaratovskyi@users.noreply.github.com> Date: Thu, 28 Mar 2024 13:36:20 +0200 Subject: [PATCH 01/22] Remove ToS acceptance copy from all entrypoints in MOX (#8450) Co-authored-by: oaratovskyi --- ...move-tos-links-that-are-not-needed-anymore | 4 ++ client/connect-account-page/strings.tsx | 56 ------------------- includes/class-wc-payment-gateway-wcpay.php | 39 ++++--------- 3 files changed, 16 insertions(+), 83 deletions(-) create mode 100644 changelog/add-8167-remove-tos-links-that-are-not-needed-anymore diff --git a/changelog/add-8167-remove-tos-links-that-are-not-needed-anymore b/changelog/add-8167-remove-tos-links-that-are-not-needed-anymore new file mode 100644 index 00000000000..147be7effd1 --- /dev/null +++ b/changelog/add-8167-remove-tos-links-that-are-not-needed-anymore @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Remove ToS acceptance copy from all entrypoints in MOX diff --git a/client/connect-account-page/strings.tsx b/client/connect-account-page/strings.tsx index 2af5229ac6f..4719dc3b6d2 100644 --- a/client/connect-account-page/strings.tsx +++ b/client/connect-account-page/strings.tsx @@ -38,62 +38,6 @@ export default { 'Earn recurring revenue and get deposits into your bank account.', 'woocommerce-payments' ), - agreement: createInterpolateElement( - __( - 'By clicking “Finish setup”, you agree to the Terms of Service and acknowledge that you have read our Privacy Policy.', - 'woocommerce-payments' - ), - { - a1: ( - // eslint-disable-next-line jsx-a11y/anchor-has-content - - ), - a2: ( - // eslint-disable-next-line jsx-a11y/anchor-has-content - - ), - } - ), - agreementWithWooPay: createInterpolateElement( - __( - 'By clicking “Finish setup”, you agree to the Terms of Service (including WooPay merchant terms) and acknowledge that you have read our Privacy Policy.', - 'woocommerce-payments' - ), - { - a1: ( - // eslint-disable-next-line jsx-a11y/anchor-has-content - - ), - a2: ( - // eslint-disable-next-line jsx-a11y/anchor-has-content - - ), - a3: ( - // eslint-disable-next-line jsx-a11y/anchor-has-content - - ), - } - ), sandboxMode: { title: __( "I'm setting up a store for someone else.", diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 75a318ba7e3..0fc0fc28273 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -4210,38 +4210,23 @@ public function get_theme_icon() { * @return string */ public function get_method_description() { - $description_links = [ - 'br' => '
', - 'tosLink' => '
', - 'privacyLink' => '', - 'woopayMechantTosLink' => '', - ]; - - $description = WC_Payments_Utils::esc_interpolated_html( - sprintf( - /* translators: %1$s: WooPayments, tosLink: Link to terms of service page, privacyLink: Link to privacy policy page */ - __( - '%1$s gives your store flexibility to accept credit cards, debit cards, and Apple Pay. Enable popular local payment methods and other digital wallets like Google Pay to give customers even more choice.

- By using %1$s you agree to be bound by our Terms of Service and acknowledge that you have read our Privacy Policy', - 'woocommerce-payments' - ), - 'WooPayments' + $description = sprintf( + /* translators: %1$s: WooPayments */ + __( + '%1$s gives your store flexibility to accept credit cards, debit cards, and Apple Pay. Enable popular local payment methods and other digital wallets like Google Pay to give customers even more choice.', + 'woocommerce-payments' ), - $description_links + 'WooPayments' ); if ( WooPay_Utilities::is_store_country_available() ) { - $description = WC_Payments_Utils::esc_interpolated_html( - sprintf( - /* translators: %1$s: WooPayments, tosLink: Link to terms of service page, woopayMechantTosLink: Link to WooPay merchant terms, privacyLink: Link to privacy policy page */ - __( - 'Payments made simple — including WooPay, a new express checkout feature.

- By using %1$s you agree to be bound by our Terms of Service (including WooPay merchant terms) and acknowledge that you have read our Privacy Policy', - 'woocommerce-payments' - ), - 'WooPayments' + $description = sprintf( + /* translators: %s: WooPay, */ + __( + 'Payments made simple — including %s, a new express checkout feature.', + 'woocommerce-payments' ), - $description_links + 'WooPay' ); } From f6b8bf450edda5c7bd30a384939a3d705bfd1793 Mon Sep 17 00:00:00 2001 From: Cvetan Cvetanov Date: Thu, 28 Mar 2024 14:09:38 +0200 Subject: [PATCH 02/22] Resolve collision between WooPayments header and Woo Express survey banner (#8400) --- changelog/fix-8093-onboarding-collides-with-jitm-banners | 4 ++++ client/onboarding/style.scss | 5 +++++ 2 files changed, 9 insertions(+) create mode 100644 changelog/fix-8093-onboarding-collides-with-jitm-banners diff --git a/changelog/fix-8093-onboarding-collides-with-jitm-banners b/changelog/fix-8093-onboarding-collides-with-jitm-banners new file mode 100644 index 00000000000..324551cb9ce --- /dev/null +++ b/changelog/fix-8093-onboarding-collides-with-jitm-banners @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix collision between WooPayments header and Woo Express survey banner. diff --git a/client/onboarding/style.scss b/client/onboarding/style.scss index 9408cd1e1ef..7a5efb46b0c 100644 --- a/client/onboarding/style.scss +++ b/client/onboarding/style.scss @@ -186,4 +186,9 @@ body.wcpay-onboarding__body { color: $gray-700; } } + + // Hide Jetpack's JITM (Just in time messages) banners for onboarding. + .woocommerce-layout__jitm { + display: none; + } } From e3e58825b4eba703decbeaef5b28f639d7f66690 Mon Sep 17 00:00:00 2001 From: Guilherme Pressutto Date: Thu, 28 Mar 2024 10:42:54 -0300 Subject: [PATCH 03/22] Checking if field is required in isBillingInformationMissing (#8502) --- changelog/fix-optional-zip | 4 ++++ client/checkout/classic/event-handlers.js | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 changelog/fix-optional-zip diff --git a/changelog/fix-optional-zip b/changelog/fix-optional-zip new file mode 100644 index 00000000000..fbb0a99fa6b --- /dev/null +++ b/changelog/fix-optional-zip @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fixed optional billing field validation diff --git a/client/checkout/classic/event-handlers.js b/client/checkout/classic/event-handlers.js index eb390660e78..9892556506d 100644 --- a/client/checkout/classic/event-handlers.js +++ b/client/checkout/classic/event-handlers.js @@ -216,10 +216,16 @@ jQuery( function ( $ ) { // We need to just find one field with missing information. If even only one is missing, just return early. return Boolean( - billingFieldsToValidate.find( - ( fieldName ) => - ! document.querySelector( `#${ fieldName }` )?.value - ) + billingFieldsToValidate.find( ( fieldName ) => { + const $field = document.querySelector( `#${ fieldName }` ); + const $formRow = $field.closest( '.form-row' ); + const isRequired = $formRow.classList.contains( + 'validate-required' + ); + const hasValue = $field?.value; + + return isRequired && ! hasValue; + } ) ); } } ); From 6ba549208d2d0cbb107be9500eb5eba65e150ef7 Mon Sep 17 00:00:00 2001 From: Francesco Date: Thu, 28 Mar 2024 15:26:21 +0100 Subject: [PATCH 04/22] refactor: shortcode checkout wp-data dependency (#8512) --- ...ctor-shortcode-checkout-wp-data-dependency | 4 +++ client/checkout/blocks/payment-processor.js | 2 +- .../blocks/test/payment-processor.test.js | 3 +- client/checkout/blocks/utils.js | 35 +++++++++++++++++++ client/checkout/constants.js | 1 - client/checkout/utils/upe.js | 29 +-------------- 6 files changed, 42 insertions(+), 32 deletions(-) create mode 100644 changelog/refactor-shortcode-checkout-wp-data-dependency create mode 100644 client/checkout/blocks/utils.js diff --git a/changelog/refactor-shortcode-checkout-wp-data-dependency b/changelog/refactor-shortcode-checkout-wp-data-dependency new file mode 100644 index 00000000000..d7ad0858363 --- /dev/null +++ b/changelog/refactor-shortcode-checkout-wp-data-dependency @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +refactor: reduce wp-data dependency on shortcode checkout diff --git a/client/checkout/blocks/payment-processor.js b/client/checkout/blocks/payment-processor.js index 2dec9a22ae8..694a9064e0a 100644 --- a/client/checkout/blocks/payment-processor.js +++ b/client/checkout/blocks/payment-processor.js @@ -19,11 +19,11 @@ import { useEffect, useRef } from 'react'; import { usePaymentCompleteHandler } from './hooks'; import { getStripeElementOptions, - useCustomerData, blocksShowLinkButtonHandler, getBlocksEmailValue, isLinkEnabled, } from 'wcpay/checkout/utils/upe'; +import { useCustomerData } from './utils'; import enableStripeLinkPaymentMethod from 'wcpay/checkout/stripe-link'; import { getUPEConfig } from 'wcpay/utils/checkout'; import { validateElements } from 'wcpay/checkout/classic/payment-processing'; diff --git a/client/checkout/blocks/test/payment-processor.test.js b/client/checkout/blocks/test/payment-processor.test.js index c744c6d07b2..c94c7e432e9 100644 --- a/client/checkout/blocks/test/payment-processor.test.js +++ b/client/checkout/blocks/test/payment-processor.test.js @@ -12,8 +12,7 @@ import { PaymentElement } from '@stripe/react-stripe-js'; jest.mock( 'wcpay/checkout/classic/payment-processing', () => ( { validateElements: jest.fn().mockResolvedValue(), } ) ); -jest.mock( 'wcpay/checkout/utils/upe', () => ( { - ...jest.requireActual( 'wcpay/checkout/utils/upe' ), +jest.mock( 'wcpay/checkout/blocks/utils', () => ( { useCustomerData: jest.fn().mockReturnValue( { billingAddress: {} } ), } ) ); jest.mock( '../hooks', () => ( { diff --git a/client/checkout/blocks/utils.js b/client/checkout/blocks/utils.js new file mode 100644 index 00000000000..e23c1542825 --- /dev/null +++ b/client/checkout/blocks/utils.js @@ -0,0 +1,35 @@ +/** + * External dependencies + */ +import { useDispatch, useSelect } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import { WC_STORE_CART } from 'wcpay/checkout/constants'; + +/** + * + * Custom React hook that provides customer data and related functions for managing customer information. + * The hook retrieves customer data from the WC_STORE_CART selector and dispatches actions to modify billing and shipping addresses. + * + * @return {Object} An object containing customer data and functions for managing customer information. + */ +export const useCustomerData = () => { + const customerData = useSelect( ( select ) => + select( WC_STORE_CART ).getCustomerData() + ); + const { + setShippingAddress, + setBillingData, + setBillingAddress, + } = useDispatch( WC_STORE_CART ); + + return { + // Backward compatibility billingData/billingAddress + billingAddress: customerData.billingAddress || customerData.billingData, + // Backward compatibility setBillingData/setBillingAddress + setBillingAddress: setBillingAddress || setBillingData, + setShippingAddress, + }; +}; diff --git a/client/checkout/constants.js b/client/checkout/constants.js index e2e4c6dfe93..b2d4ac88fdc 100644 --- a/client/checkout/constants.js +++ b/client/checkout/constants.js @@ -11,7 +11,6 @@ export const PAYMENT_METHOD_NAME_AFFIRM = 'woocommerce_payments_affirm'; export const PAYMENT_METHOD_NAME_AFTERPAY = 'woocommerce_payments_afterpay_clearpay'; export const PAYMENT_METHOD_NAME_KLARNA = 'woocommerce_payments_klarna'; -export const PAYMENT_METHOD_NAME_UPE = 'woocommerce_payments_upe'; export const PAYMENT_METHOD_NAME_PAYMENT_REQUEST = 'woocommerce_payments_payment_request'; export const PAYMENT_METHOD_NAME_WOOPAY_EXPRESS_CHECKOUT = diff --git a/client/checkout/utils/upe.js b/client/checkout/utils/upe.js index 3773eeb5670..27876f1af5d 100644 --- a/client/checkout/utils/upe.js +++ b/client/checkout/utils/upe.js @@ -2,8 +2,7 @@ * Internal dependencies */ import { getUPEConfig } from 'wcpay/utils/checkout'; -import { WC_STORE_CART, getPaymentMethodsConstants } from '../constants'; -import { useDispatch, useSelect } from '@wordpress/data'; +import { getPaymentMethodsConstants } from '../constants'; /** * Generates terms parameter for UPE, with value set for reusable payment methods @@ -183,32 +182,6 @@ export function dispatchChangeEventFor( element ) { element.dispatchEvent( event ); } -/** - * - * Custom React hook that provides customer data and related functions for managing customer information. - * The hook retrieves customer data from the WC_STORE_CART selector and dispatches actions to modify billing and shipping addresses. - * - * @return {Object} An object containing customer data and functions for managing customer information. - */ -export const useCustomerData = () => { - const customerData = useSelect( ( select ) => - select( WC_STORE_CART ).getCustomerData() - ); - const { - setShippingAddress, - setBillingData, - setBillingAddress, - } = useDispatch( WC_STORE_CART ); - - return { - // Backward compatibility billingData/billingAddress - billingAddress: customerData.billingAddress || customerData.billingData, - // Backward compatibility setBillingData/setBillingAddress - setBillingAddress: setBillingAddress || setBillingData, - setShippingAddress, - }; -}; - /** * Returns the prepared set of options needed to initialize the Stripe elements for UPE in Block Checkout. * The initial options have all the fields set to 'never' to hide them from the UPE, because all the From 87c6cc68e2f8862267e48ff6963a6ad232b59bb3 Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Thu, 28 Mar 2024 15:07:51 -0400 Subject: [PATCH 05/22] Add BNPL to cart summary (#8427) --- changelog/add-8144-bnpl-cart-summary | 4 + client/cart/blocks/index.js | 12 ++ client/cart/blocks/product-details.js | 117 ++++++++++++++++++ client/checkout/upe-styles/index.js | 40 ++++++ .../bnpl-site-messaging/index.js | 96 +++++++++----- .../bnpl-site-messaging/style.scss | 17 +++ client/product-details/index.js | 47 +++++-- includes/class-wc-payment-gateway-wcpay.php | 16 ++- includes/class-wc-payments-checkout.php | 4 + ...ments-payment-method-messaging-element.php | 55 +++++--- includes/class-wc-payments-utils.php | 12 ++ includes/class-wc-payments.php | 30 +++++ package-lock.json | 20 +-- package.json | 2 +- webpack/shared.js | 1 + 15 files changed, 406 insertions(+), 67 deletions(-) create mode 100644 changelog/add-8144-bnpl-cart-summary create mode 100644 client/cart/blocks/index.js create mode 100644 client/cart/blocks/product-details.js diff --git a/changelog/add-8144-bnpl-cart-summary b/changelog/add-8144-bnpl-cart-summary new file mode 100644 index 00000000000..6d0fba70b5f --- /dev/null +++ b/changelog/add-8144-bnpl-cart-summary @@ -0,0 +1,4 @@ +Significance: minor +Type: add + +Add BNPL messaging to cart page. diff --git a/client/cart/blocks/index.js b/client/cart/blocks/index.js new file mode 100644 index 00000000000..8cb1e0dad4d --- /dev/null +++ b/client/cart/blocks/index.js @@ -0,0 +1,12 @@ +/** + * Internal dependencies + */ +import { renderBNPLCartMessaging } from './product-details'; + +const { registerPlugin } = window.wp.plugins; + +// Register BNPL site messaging on the cart block. +registerPlugin( 'bnpl-site-messaging', { + render: renderBNPLCartMessaging, + scope: 'woocommerce-checkout', +} ); diff --git a/client/cart/blocks/product-details.js b/client/cart/blocks/product-details.js new file mode 100644 index 00000000000..87e807d354e --- /dev/null +++ b/client/cart/blocks/product-details.js @@ -0,0 +1,117 @@ +/** + * External dependencies + */ +import { + Elements, + PaymentMethodMessagingElement, +} from '@stripe/react-stripe-js'; +import { select } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import { getAppearance, getFontRulesFromPage } from 'wcpay/checkout/upe-styles'; +import { getUPEConfig } from 'utils/checkout'; +import WCPayAPI from '../../checkout/api'; +import request from '../../checkout/utils/request'; +import { useEffect, useState } from 'react'; + +// Create an API object, which will be used throughout the checkout. +const api = new WCPayAPI( + { + publishableKey: getUPEConfig( 'publishableKey' ), + accountId: getUPEConfig( 'accountId' ), + forceNetworkSavedCards: getUPEConfig( 'forceNetworkSavedCards' ), + locale: getUPEConfig( 'locale' ), + }, + request +); + +const isInEditor = () => { + const editorStore = select( 'core/editor' ); + + return !! editorStore; +}; + +// BNPL only supports 2 decimal places. +const normalizeAmount = ( amount, decimalPlaces = 2 ) => { + return amount * Math.pow( 10, 2 - decimalPlaces ); +}; + +const { ExperimentalOrderMeta } = window.wc.blocksCheckout; + +const ProductDetail = ( { cart, context } ) => { + const [ appearance, setAppearance ] = useState( + getUPEConfig( 'upeBnplCartBlockAppearance' ) || {} + ); + + const [ fontRules ] = useState( getFontRulesFromPage() ); + + useEffect( () => { + async function generateUPEAppearance() { + // Generate UPE input styles. + let upeAppearance = getAppearance( 'bnpl_cart_block' ); + upeAppearance = await api.saveUPEAppearance( + upeAppearance, + 'bnpl_cart_block' + ); + setAppearance( upeAppearance ); + } + + if ( Object.keys( appearance ).length === 0 ) { + generateUPEAppearance(); + } + }, [ appearance ] ); + + if ( Object.keys( appearance ).length === 0 ) { + return null; + } + + if ( context !== 'woocommerce/cart' ) { + return null; + } + + const cartTotal = normalizeAmount( + cart.cartTotals.total_price, + wcSettings.currency.precision + ); + + const { + country, + paymentMethods, + currencyCode, + } = window.wcpayStripeSiteMessaging; + + const amount = parseInt( cartTotal, 10 ) || 0; + + const options = { + amount: amount, + currency: currencyCode || 'USD', + paymentMethodTypes: paymentMethods || [], + countryCode: country, // Customer's country or base country of the store. + }; + + const stripe = api.getStripe(); + + return ( +
+ + + +
+ ); +}; + +export const renderBNPLCartMessaging = () => { + if ( isInEditor() ) { + return null; + } + return ( + + + + ); +}; diff --git a/client/checkout/upe-styles/index.js b/client/checkout/upe-styles/index.js index 46e6e4ebc4e..255feaa3f55 100644 --- a/client/checkout/upe-styles/index.js +++ b/client/checkout/upe-styles/index.js @@ -74,6 +74,40 @@ const appearanceSelectors = { 'body', ], }, + bnplClassicCart: { + appendTarget: '.cart .quantity', + upeThemeInputSelector: '.cart .quantity .qty', + upeThemeLabelSelector: '.cart .quantity label', + rowElement: 'div', + validClasses: [ 'input-text' ], + invalidClasses: [ 'input-text', 'has-error' ], + backgroundSelectors: [ + '#payment-method-message', + '#main .entry-content .cart_totals', + '#main .entry-content', + '#main', + 'body', + ], + }, + bnplCartBlock: { + appendTarget: '.wc-block-cart .wc-block-components-quantity-selector', + upeThemeInputSelector: + '.wc-block-cart .wc-block-components-quantity-selector .wc-block-components-quantity-selector__input', + upeThemeLabelSelector: '.wc-block-components-text-input', + rowElement: 'div', + validClasses: [ 'wc-block-components-text-input' ], + invalidClasses: [ 'wc-block-components-text-input', 'has-error' ], + backgroundSelectors: [ + '.wc-block-components-bnpl-wrapper', + '.wc-block-components-order-meta', + '.wc-block-components-totals-wrapper', + '.wp-block-woocommerce-cart-order-summary-block', + '.wp-block-woocommerce-cart-totals-block', + '.wp-block-woocommerce-cart .wc-block-cart', + '.wp-block-woocommerce-cart', + 'body', + ], + }, /** * Update selectors to use alternate if not present on DOM. @@ -120,6 +154,12 @@ const appearanceSelectors = { case 'bnpl_product_page': appearanceSelector = this.bnplProductPage; break; + case 'bnpl_classic_cart': + appearanceSelector = this.bnplClassicCart; + break; + case 'bnpl_cart_block': + appearanceSelector = this.bnplCartBlock; + break; } return { diff --git a/client/product-details/bnpl-site-messaging/index.js b/client/product-details/bnpl-site-messaging/index.js index 58a719dcf3f..b0ebf24f054 100644 --- a/client/product-details/bnpl-site-messaging/index.js +++ b/client/product-details/bnpl-site-messaging/index.js @@ -16,15 +16,28 @@ import apiRequest from 'wcpay/checkout/utils/request'; * @param {Object} api The API object used to save the UPE configuration. * @return {Promise} The appearance object for the UPE. */ -async function initializeAppearance( api ) { - const appearance = getUPEConfig( 'upeBnplProductPageAppearance' ); +const elementsLocations = { + bnplProductPage: { + configKey: 'upeBnplProductPageAppearance', + appearanceKey: 'bnpl_product_page', + }, + bnplClassicCart: { + configKey: 'upeBnplClassicCartAppearance', + appearanceKey: 'bnpl_classic_cart', + }, +}; + +async function initializeAppearance( api, location ) { + const { configKey, appearanceKey } = elementsLocations[ location ]; + + const appearance = getUPEConfig( configKey ); if ( appearance ) { return Promise.resolve( appearance ); } return await api.saveUPEAppearance( - getAppearance( 'bnpl_product_page' ), - 'bnpl_product_page' + getAppearance( appearanceKey ), + appearanceKey ); } @@ -36,31 +49,52 @@ export const initializeBnplSiteMessaging = async () => { accountId, publishableKey, paymentMethods, + currencyCode, + isCart, + isCartBlock, + cartTotal, } = window.wcpayStripeSiteMessaging; - const api = new WCPayAPI( - { - publishableKey: publishableKey, - accountId: accountId, - locale: locale, - }, - apiRequest - ); - const options = { - amount: parseInt( productVariations.base_product.amount, 10 ) || 0, - currency: productVariations.base_product.currency || 'USD', - paymentMethodTypes: paymentMethods || [], - countryCode: country, // Customer's country or base country of the store. - }; - const elementsOptions = { - appearance: await initializeAppearance( api ), - fonts: getFontRulesFromPage(), - }; - const paymentMessageElement = api - .getStripe() - .elements( elementsOptions ) - .create( 'paymentMethodMessaging', options ); - paymentMessageElement.mount( '#payment-method-message' ); + let amount; + let elementLocation = 'bnplProductPage'; + + if ( isCart || isCartBlock ) { + amount = parseInt( cartTotal, 10 ) || 0; + elementLocation = 'bnplClassicCart'; + } else { + amount = parseInt( productVariations.base_product.amount, 10 ) || 0; + } + + let paymentMessageElement; + + if ( ! isCartBlock ) { + const api = new WCPayAPI( + { + publishableKey: publishableKey, + accountId: accountId, + locale: locale, + }, + apiRequest + ); + + const options = { + amount: amount, + currency: currencyCode || 'USD', + paymentMethodTypes: paymentMethods || [], + countryCode: country, // Customer's country or base country of the store. + }; + + const elementsOptions = { + appearance: await initializeAppearance( api, elementLocation ), + fonts: getFontRulesFromPage(), + }; + + paymentMessageElement = api + .getStripe() + .elements( elementsOptions ) + .create( 'paymentMethodMessaging', options ); + paymentMessageElement.mount( '#payment-method-message' ); + } // This function converts relative units (rem/em) to pixels based on the current font size. function convertToPixels( value, baseFontSize ) { @@ -80,10 +114,14 @@ export const initializeBnplSiteMessaging = async () => { const priceElement = document.querySelector( '.price' ) || // For non-block product templates. document.querySelector( '.wp-block-woocommerce-product-price' ); // For block product templates. + const cartTotalElement = document.querySelector( + '.cart_totals .shop_table' + ); // Only attempt to adjust the margins if the price element is found. - if ( priceElement ) { - const style = window.getComputedStyle( priceElement ); + if ( priceElement || cartTotalElement ) { + const element = priceElement || cartTotalElement; + const style = window.getComputedStyle( element ); let bottomMargin = style.marginBottom; // Get the computed font size of the price element for 'em' calculations. diff --git a/client/product-details/bnpl-site-messaging/style.scss b/client/product-details/bnpl-site-messaging/style.scss index f74bb78a339..6ae65d7555c 100644 --- a/client/product-details/bnpl-site-messaging/style.scss +++ b/client/product-details/bnpl-site-messaging/style.scss @@ -15,3 +15,20 @@ margin-bottom: var( --wc-bnpl-margin-bottom ); } } + +.cart_totals { + &:has( + #payment-method-message.ready ) { + margin-bottom: 0; + } + + #payment-method-message.ready { + margin-bottom: var( --wc-bnpl-margin-bottom ); + padding: 0 1em; + } +} + +.wc-block-components-totals-wrapper.slot-wrapper + .wc-block-components-bnpl-wrapper { + padding-left: 17px; + padding-right: 17px; +} diff --git a/client/product-details/index.js b/client/product-details/index.js index ef177740c5b..4ed333ad46d 100644 --- a/client/product-details/index.js +++ b/client/product-details/index.js @@ -5,6 +5,8 @@ * Internal dependencies */ import { initializeBnplSiteMessaging } from './bnpl-site-messaging'; +import request from 'wcpay/checkout/utils/request'; +import { buildAjaxURL } from 'wcpay/payment-request/utils'; jQuery( async function ( $ ) { /** @@ -18,15 +20,29 @@ jQuery( async function ( $ ) { * * If this variable is not set, the script will exit early to prevent further execution. */ - if ( ! window.wcpayStripeSiteMessaging ) { + if ( + ! window.wcpayStripeSiteMessaging || + window.wcpayStripeSiteMessaging.isCartBlock + ) { return; } - const { productVariations, productId } = window.wcpayStripeSiteMessaging; const { - amount: baseProductAmount = 0, - currency: productCurrency, - } = productVariations[ productId ]; + productVariations, + productId, + isCart, + } = window.wcpayStripeSiteMessaging; + + let baseProductAmount; + let productCurrency; + + if ( ! isCart ) { + const { amount, currency } = productVariations[ productId ]; + + baseProductAmount = amount || 0; + productCurrency = currency; + } + const QUANTITY_INPUT_SELECTOR = '.quantity input[type=number]'; const SINGLE_VARIATION_SELECTOR = '.single_variation_wrap'; const VARIATIONS_SELECTOR = '.variations'; @@ -62,11 +78,9 @@ jQuery( async function ( $ ) { const updateBnplPaymentMessage = ( amount, currency, quantity = 1 ) => { const totalAmount = parseIntOrReturnZero( amount ) * parseIntOrReturnZero( quantity ); - if ( totalAmount <= 0 || ! currency ) { return; } - bnplPaymentMessageElement.update( { amount: totalAmount, currency } ); }; @@ -83,6 +97,18 @@ jQuery( async function ( $ ) { ); }; + const bnplGetCartTotal = () => { + return request( + buildAjaxURL( + window.wcpayStripeSiteMessaging.wcAjaxUrl, + 'get_cart_total' + ), + { + security: window.wcpayStripeSiteMessaging.nonce, + } + ); + }; + // Update BNPL message based on the quantity change quantityInput.on( 'change', ( event ) => { let amount = baseProductAmount; @@ -99,6 +125,13 @@ jQuery( async function ( $ ) { updateBnplPaymentMessage( amount, productCurrency, event.target.value ); } ); + $( document.body ).on( 'updated_cart_totals', () => { + bnplGetCartTotal().then( ( response ) => { + window.wcpayStripeSiteMessaging.cartTotal = response.total; + initializeBnplSiteMessaging(); + } ); + } ); + // Handle BNPL messaging for variable products. if ( hasVariations ) { // Update BNPL message based on product variation diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 0fc0fc28273..82f63acce9c 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -118,9 +118,13 @@ class WC_Payment_Gateway_WCPay extends WC_Payment_Gateway_CC { const UPE_APPEARANCE_TRANSIENT = 'wcpay_upe_appearance'; const WC_BLOCKS_UPE_APPEARANCE_TRANSIENT = 'wcpay_wc_blocks_upe_appearance'; const UPE_BNPL_PRODUCT_PAGE_APPEARANCE_TRANSIENT = 'wcpay_upe_bnpl_product_page_appearance'; + const UPE_BNPL_CLASSIC_CART_APPEARANCE_TRANSIENT = 'wcpay_upe_bnpl_classic_cart_appearance'; + const UPE_BNPL_CART_BLOCK_APPEARANCE_TRANSIENT = 'wcpay_upe_bnpl_cart_block_appearance'; const UPE_APPEARANCE_THEME_TRANSIENT = 'wcpay_upe_appearance_theme'; const WC_BLOCKS_UPE_APPEARANCE_THEME_TRANSIENT = 'wcpay_wc_blocks_upe_appearance_theme'; const UPE_BNPL_PRODUCT_PAGE_APPEARANCE_THEME_TRANSIENT = 'wcpay_upe_bnpl_product_page_appearance_theme'; + const UPE_BNPL_CLASSIC_CART_APPEARANCE_THEME_TRANSIENT = 'wcpay_upe_bnpl_classic_cart_appearance_theme'; + const UPE_BNPL_CART_BLOCK_APPEARANCE_THEME_TRANSIENT = 'wcpay_upe_bnpl_cart_block_appearance_theme'; /** * Client for making requests to the WooCommerce Payments API @@ -3887,7 +3891,7 @@ public function save_upe_appearance_ajax() { $elements_location = isset( $_POST['elements_location'] ) ? wc_clean( wp_unslash( $_POST['elements_location'] ) ) : null; $appearance = isset( $_POST['appearance'] ) ? json_decode( wc_clean( wp_unslash( $_POST['appearance'] ) ) ) : null; - $valid_locations = [ 'blocks_checkout', 'shortcode_checkout', 'bnpl_product_page' ]; + $valid_locations = [ 'blocks_checkout', 'shortcode_checkout', 'bnpl_product_page', 'bnpl_classic_cart', 'bnpl_cart_block' ]; if ( ! $elements_location || ! in_array( $elements_location, $valid_locations, true ) ) { throw new Exception( __( 'Unable to update UPE appearance values at this time.', 'woocommerce-payments' ) @@ -3909,7 +3913,7 @@ public function save_upe_appearance_ajax() { /** * This filter is only called on "save" of the appearance, to avoid calling it on every page load. * If you apply changes through this filter, you'll need to clear the transient data to see them at checkout. - * $elements_location can be 'blocks_checkout', 'shortcode_checkout', or 'bnpl_product_page'. + * $elements_location can be 'blocks_checkout', 'shortcode_checkout', 'bnpl_product_page', 'bnpl_classic_cart', 'bnpl_cart_block'. * * @since 7.4.0 */ @@ -3919,11 +3923,15 @@ public function save_upe_appearance_ajax() { 'shortcode_checkout' => self::UPE_APPEARANCE_TRANSIENT, 'blocks_checkout' => self::WC_BLOCKS_UPE_APPEARANCE_TRANSIENT, 'bnpl_product_page' => self::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_TRANSIENT, + 'bnpl_classic_cart' => self::UPE_BNPL_CLASSIC_CART_APPEARANCE_TRANSIENT, + 'bnpl_cart_block' => self::UPE_BNPL_CART_BLOCK_APPEARANCE_TRANSIENT, ][ $elements_location ]; $appearance_theme_transient = [ 'shortcode_checkout' => self::UPE_APPEARANCE_THEME_TRANSIENT, 'blocks_checkout' => self::WC_BLOCKS_UPE_APPEARANCE_THEME_TRANSIENT, 'bnpl_product_page' => self::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_THEME_TRANSIENT, + 'bnpl_classic_cart' => self::UPE_BNPL_CLASSIC_CART_APPEARANCE_THEME_TRANSIENT, + 'bnpl_cart_block' => self::UPE_BNPL_CART_BLOCK_APPEARANCE_THEME_TRANSIENT, ][ $elements_location ]; if ( null !== $appearance ) { @@ -3952,9 +3960,13 @@ public function clear_upe_appearance_transient() { delete_transient( self::UPE_APPEARANCE_TRANSIENT ); delete_transient( self::WC_BLOCKS_UPE_APPEARANCE_TRANSIENT ); delete_transient( self::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_TRANSIENT ); + delete_transient( self::UPE_BNPL_CLASSIC_CART_APPEARANCE_TRANSIENT ); + delete_transient( self::UPE_BNPL_CART_BLOCK_APPEARANCE_TRANSIENT ); delete_transient( self::UPE_APPEARANCE_THEME_TRANSIENT ); delete_transient( self::WC_BLOCKS_UPE_APPEARANCE_THEME_TRANSIENT ); delete_transient( self::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_THEME_TRANSIENT ); + delete_transient( self::UPE_BNPL_CLASSIC_CART_APPEARANCE_THEME_TRANSIENT ); + delete_transient( self::UPE_BNPL_CART_BLOCK_APPEARANCE_THEME_TRANSIENT ); } /** diff --git a/includes/class-wc-payments-checkout.php b/includes/class-wc-payments-checkout.php index 536b6715d75..360b9ac07b7 100644 --- a/includes/class-wc-payments-checkout.php +++ b/includes/class-wc-payments-checkout.php @@ -221,6 +221,10 @@ public function get_payment_fields_js_config() { $payment_fields['upeAppearance'] = get_transient( WC_Payment_Gateway_WCPay::UPE_APPEARANCE_TRANSIENT ); $payment_fields['upeBnplProductPageAppearance'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_TRANSIENT ); $payment_fields['upeBnplProductPageAppearanceTheme'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_PRODUCT_PAGE_APPEARANCE_THEME_TRANSIENT ); + $payment_fields['upeBnplClassicCartAppearance'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_CLASSIC_CART_APPEARANCE_TRANSIENT ); + $payment_fields['upeBnplClassicCartAppearanceTheme'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_CLASSIC_CART_APPEARANCE_THEME_TRANSIENT ); + $payment_fields['upeBnplCartBlockAppearance'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_CART_BLOCK_APPEARANCE_TRANSIENT ); + $payment_fields['upeBnplCartBlockAppearanceTheme'] = get_transient( WC_Payment_Gateway_WCPay::UPE_BNPL_CART_BLOCK_APPEARANCE_THEME_TRANSIENT ); $payment_fields['wcBlocksUPEAppearance'] = get_transient( WC_Payment_Gateway_WCPay::WC_BLOCKS_UPE_APPEARANCE_TRANSIENT ); $payment_fields['wcBlocksUPEAppearanceTheme'] = get_transient( WC_Payment_Gateway_WCPay::WC_BLOCKS_UPE_APPEARANCE_THEME_TRANSIENT ); $payment_fields['cartContainsSubscription'] = $this->gateway->is_subscription_item_in_cart(); diff --git a/includes/class-wc-payments-payment-method-messaging-element.php b/includes/class-wc-payments-payment-method-messaging-element.php index 7148e5d8c52..d27409d1be0 100644 --- a/includes/class-wc-payments-payment-method-messaging-element.php +++ b/includes/class-wc-payments-payment-method-messaging-element.php @@ -42,27 +42,38 @@ public function __construct( WC_Payments_Account $account, WC_Payment_Gateway_WC /** * Initializes the payment method messaging element. * - * @return string The HTML markup for the payment method message container. + * @return string|void The HTML markup for the payment method message container. */ - public function init(): string { + public function init() { + + $is_cart_block = WC_Payments_Utils::is_cart_block(); + + if ( ! is_product() && ! is_cart() && ! $is_cart_block ) { + return; + } + global $product; - $currency_code = get_woocommerce_currency(); - $store_country = WC()->countries->get_base_country(); - $billing_country = WC()->customer->get_billing_country(); + $currency_code = get_woocommerce_currency(); + $store_country = WC()->countries->get_base_country(); + $billing_country = WC()->customer->get_billing_country(); + $cart_total = WC()->cart->total; + $product_variations = []; - $product_variations = [ - 'base_product' => [ - 'amount' => WC_Payments_Utils::prepare_amount( $product->get_price(), $currency_code ), - 'currency' => $currency_code, - ], - ]; - foreach ( $product->get_children() as $variation_id ) { - $variation = wc_get_product( $variation_id ); - if ( $variation ) { - $product_variations[ $variation_id ] = [ - 'amount' => WC_Payments_Utils::prepare_amount( $variation->get_price(), $currency_code ), + if ( $product ) { + $product_variations = [ + 'base_product' => [ + 'amount' => WC_Payments_Utils::prepare_amount( $product->get_price(), $currency_code ), 'currency' => $currency_code, - ]; + ], + ]; + foreach ( $product->get_children() as $variation_id ) { + $variation = wc_get_product( $variation_id ); + if ( $variation ) { + $product_variations[ $variation_id ] = [ + 'amount' => WC_Payments_Utils::prepare_amount( $variation->get_price(), $currency_code ), + 'currency' => $currency_code, + ]; + } } } @@ -94,6 +105,12 @@ public function init(): string { 'accountId' => $this->account->get_stripe_account_id(), 'publishableKey' => $this->account->get_publishable_key( WC_Payments::mode()->is_test() ), 'paymentMethods' => array_values( $bnpl_payment_methods ), + 'currencyCode' => $currency_code, + 'isCart' => is_cart(), + 'isCartBlock' => $is_cart_block, + 'cartTotal' => WC_Payments_Utils::prepare_amount( $cart_total, $currency_code ), + 'nonce' => wp_create_nonce( 'wcpay-get-cart-total' ), + 'wcAjaxUrl' => WC_AJAX::get_endpoint( '%%endpoint%%' ), ] ); @@ -107,6 +124,8 @@ public function init(): string { 'before' ); - return '
'; + if ( ! $is_cart_block ) { + return '
'; + } } } diff --git a/includes/class-wc-payments-utils.php b/includes/class-wc-payments-utils.php index 8b58715df8b..83e845fc9cd 100644 --- a/includes/class-wc-payments-utils.php +++ b/includes/class-wc-payments-utils.php @@ -1097,4 +1097,16 @@ public static function convert_to_server_locale( string $locale ): string { public static function is_cart_page(): bool { return is_cart() || has_block( 'woocommerce/cart' ); } + + /** + * Block based themes display the cart block even when the cart shortcode is used. has_block() isn't effective + * in this case because it checks the page content for the block, which isn't present. + * + * @return bool + * + * @psalm-suppress UndefinedFunction + */ + public static function is_cart_block(): bool { + return has_block( 'woocommerce/cart' ) || ( wp_is_block_theme() && is_cart() ); + } } diff --git a/includes/class-wc-payments.php b/includes/class-wc-payments.php index 9402cd5c695..cff5cbcd618 100644 --- a/includes/class-wc-payments.php +++ b/includes/class-wc-payments.php @@ -572,6 +572,9 @@ public static function init() { ); if ( [] !== $enabled_bnpl_payment_methods ) { add_action( 'woocommerce_single_product_summary', [ __CLASS__, 'load_stripe_bnpl_site_messaging' ], 10 ); + add_action( 'woocommerce_proceed_to_checkout', [ __CLASS__, 'load_stripe_bnpl_site_messaging' ], 10 ); + add_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after', [ __CLASS__, 'load_stripe_bnpl_site_messaging' ] ); + add_action( 'wc_ajax_wcpay_get_cart_total', [ __CLASS__, 'ajax_get_cart_total' ] ); } add_filter( 'woocommerce_payment_gateways', [ __CLASS__, 'register_gateway' ] ); @@ -1603,6 +1606,28 @@ public static function ajax_get_woopay_signature() { ); } + /** + * Get cart total. + */ + public static function ajax_get_cart_total() { + check_ajax_referer( 'wcpay-get-cart-total', 'security' ); + + if ( ! defined( 'WOOCOMMERCE_CART' ) ) { + define( 'WOOCOMMERCE_CART', true ); + } + + if ( ! defined( 'WOOCOMMERCE_CHECKOUT' ) ) { + define( 'WOOCOMMERCE_CHECKOUT', true ); + } + + WC()->cart->calculate_totals(); + + $cart_total = WC()->cart->total; + $currency_code = get_woocommerce_currency(); + + wp_send_json( [ 'total' => WC_Payments_Utils::prepare_amount( $cart_total, $currency_code ) ] ); + } + /** * Adds custom email field. */ @@ -1664,6 +1689,11 @@ public static function enqueue_cart_scripts() { self::register_script_with_dependencies( 'WCPAY_CART', 'dist/cart' ); wp_enqueue_script( 'WCPAY_CART' ); + + if ( WC_Payments_Utils::is_cart_block() ) { + self::register_script_with_dependencies( 'WCPAY_CART_BLOCK', 'dist/cart-block', [ 'wc-blocks-integration' ] ); + wp_enqueue_script( 'WCPAY_CART_BLOCK' ); + } } /** diff --git a/package-lock.json b/package-lock.json index 9d58c977708..25eefb9d521 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "dependencies": { "@automattic/interpolate-components": "1.2.1", "@fingerprintjs/fingerprintjs": "3.4.1", - "@stripe/react-stripe-js": "1.4.1", + "@stripe/react-stripe-js": "2.5.1", "@stripe/stripe-js": "1.15.1", "@woocommerce/explat": "2.3.0", "@woocommerce/number": "2.4.0", @@ -7817,16 +7817,16 @@ } }, "node_modules/@stripe/react-stripe-js": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-1.4.1.tgz", - "integrity": "sha512-FjcVrhf72+9fUL3Lz3xi02ni9tzH1A1x6elXlr6tvBDgSD55oPJuodoP8eC7xTnBIKq0olF5uJvgtkJyDCdzjA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-2.5.1.tgz", + "integrity": "sha512-95BwDhOkl1TwIn5sldWW35GYt6wx+uYuwGjebaMOpOdHGyBKcDnBhTjIww+bUdmA2oCmpUqKnoB4OZJuqK8tJA==", "dependencies": { "prop-types": "^15.7.2" }, "peerDependencies": { - "@stripe/stripe-js": "^1.13.0", - "react": "^16.8.0 || ^17.0.0", - "react-dom": "^16.8.0 || ^17.0.0" + "@stripe/stripe-js": "^1.44.1 || ^2.0.0 || ^3.0.0", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, "node_modules/@stripe/stripe-js": { @@ -48406,9 +48406,9 @@ } }, "@stripe/react-stripe-js": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-1.4.1.tgz", - "integrity": "sha512-FjcVrhf72+9fUL3Lz3xi02ni9tzH1A1x6elXlr6tvBDgSD55oPJuodoP8eC7xTnBIKq0olF5uJvgtkJyDCdzjA==", + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/@stripe/react-stripe-js/-/react-stripe-js-2.5.1.tgz", + "integrity": "sha512-95BwDhOkl1TwIn5sldWW35GYt6wx+uYuwGjebaMOpOdHGyBKcDnBhTjIww+bUdmA2oCmpUqKnoB4OZJuqK8tJA==", "requires": { "prop-types": "^15.7.2" } diff --git a/package.json b/package.json index 419dcd70001..a2c1870eec9 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "dependencies": { "@automattic/interpolate-components": "1.2.1", "@fingerprintjs/fingerprintjs": "3.4.1", - "@stripe/react-stripe-js": "1.4.1", + "@stripe/react-stripe-js": "2.5.1", "@stripe/stripe-js": "1.15.1", "@woocommerce/explat": "2.3.0", "@woocommerce/number": "2.4.0", diff --git a/webpack/shared.js b/webpack/shared.js index 5c7401f0c16..63bff86aa23 100644 --- a/webpack/shared.js +++ b/webpack/shared.js @@ -36,6 +36,7 @@ module.exports = { 'subscription-product-onboarding-toast': './client/subscription-product-onboarding/toast.js', 'product-details': './client/product-details/index.js', + 'cart-block': './client/cart/blocks/index.js', }, // Override webpack public path dynamically on every entry. // Required for chunks loading to work on sites with JS concatenation. From 660a6302dc439aed8751c547952d8724647bb475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3fer=20Reykjal=C3=ADn?= <13835680+reykjalin@users.noreply.github.com> Date: Sat, 30 Mar 2024 01:55:12 +0000 Subject: [PATCH 06/22] Revert the phpcs update revert PR (#8460) Co-authored-by: Vladimir Reznichenko Co-authored-by: Marcin Bot Co-authored-by: Zvonimir Maglica --- changelog/fix-8465-fix-phpcs-reports | 4 + changelog/tweak-revert-phpcs-update-revert-pr | 4 + composer.json | 4 +- composer.lock | 792 +++++++++++------- .../class-wc-payments-admin-settings.php | 2 +- includes/admin/class-wc-payments-admin.php | 6 +- ...ss-wc-rest-payments-capital-controller.php | 1 - ...s-wc-rest-payments-customer-controller.php | 1 - ...lass-wc-rest-payments-files-controller.php | 6 +- ...ass-wc-rest-payments-orders-controller.php | 4 +- ...st-payments-payment-intents-controller.php | 1 - ...ents-payment-intents-create-controller.php | 2 - ...lass-wc-rest-woopay-session-controller.php | 1 - .../tasks/class-wc-payments-task-disputes.php | 5 +- includes/admin/tracks/tracks-loader.php | 2 +- ...s-duplicate-payment-prevention-service.php | 2 +- includes/class-experimental-abtest.php | 1 - includes/class-payment-information.php | 2 +- includes/class-wc-payment-gateway-wcpay.php | 6 +- includes/class-wc-payments-account.php | 28 +- ...s-wc-payments-action-scheduler-service.php | 3 +- .../class-wc-payments-captured-event-note.php | 3 +- includes/class-wc-payments-checkout.php | 3 +- includes/class-wc-payments-db.php | 3 +- .../class-wc-payments-dependency-service.php | 2 - includes/class-wc-payments-file-service.php | 3 +- includes/class-wc-payments-fraud-service.php | 2 +- .../class-wc-payments-incentives-service.php | 2 +- .../class-wc-payments-onboarding-service.php | 2 +- includes/class-wc-payments-order-service.php | 28 +- .../class-wc-payments-session-service.php | 2 +- includes/class-wc-payments-status.php | 41 +- includes/class-wc-payments-utils.php | 2 +- ...wc-payments-webhook-processing-service.php | 4 +- includes/class-wc-payments.php | 5 +- .../blocks/class-blocks-data-extractor.php | 2 +- includes/constants/class-base-constant.php | 4 +- includes/core/class-mode.php | 8 +- includes/core/server/class-request.php | 102 ++- includes/core/server/class-response.php | 2 +- ...ass-create-and-confirm-setup-intention.php | 3 +- .../core/server/request/class-generic.php | 2 - .../server/request/class-list-disputes.php | 3 - .../class-list-fraud-outcome-transactions.php | 6 +- .../request/class-list-transactions.php | 4 +- .../server/request/class-request-utils.php | 1 - ...ss-woopay-create-and-confirm-intention.php | 1 - ...pay-create-and-confirm-setup-intention.php | 1 - .../server/request/trait-date-parameters.php | 2 - .../core/server/request/trait-order-info.php | 2 - ...class-wc-payments-customer-service-api.php | 4 +- ...xpress-checkout-button-display-handler.php | 2 +- .../class-fraud-risk-tools.php | 4 +- .../fraud-prevention/models/class-check.php | 4 +- ...ts-in-person-payments-receipts-service.php | 7 +- ...-payments-printed-receipt-sample-order.php | 1 - .../html-in-person-payment-receipt.php | 12 +- ...ed-payment-request-button-sizes-update.php | 1 - .../class-update-service-data-from-server.php | 1 - .../WooCommerceNameYourPrice.php | 1 - includes/multi-currency/Currency.php | 2 +- includes/multi-currency/MultiCurrency.php | 11 +- .../multi-currency/StorefrontIntegration.php | 1 - includes/multi-currency/UserSettings.php | 1 - ...ss-wc-payments-notes-set-up-stripelink.php | 2 +- .../class-wc-payments-remote-note-service.php | 4 +- .../class-bancontact-payment-method.php | 1 - .../class-cc-payment-method.php | 1 - ...ents-reports-authorizations-controller.php | 2 - ...yments-reports-transactions-controller.php | 2 - .../class-wc-payments-api-client.php | 18 +- phpcs.xml.dist | 52 +- src/Container.php | 2 +- .../DelegateContainer/LegacyContainer.php | 2 +- .../ExtendedContainer.php | 8 +- src/Internal/Logger.php | 18 +- src/Internal/Payment/Change.php | 3 +- src/Internal/Payment/PaymentContext.php | 4 +- src/Internal/Payment/PaymentRequest.php | 6 +- .../Payment/State/AbstractPaymentState.php | 10 +- src/Internal/Payment/State/InitialState.php | 6 +- src/Internal/Payment/State/StateFactory.php | 10 +- src/Internal/Payment/Transition.php | 10 +- src/Internal/Proxy/LegacyProxy.php | 2 +- .../DuplicatePaymentPreventionService.php | 2 +- src/Internal/Service/Level3Service.php | 4 +- src/Internal/Service/MinimumAmountService.php | 2 +- src/Internal/Service/OrderService.php | 13 +- .../Service/PaymentContextLoggerService.php | 6 +- tests/WCPAY_UnitTestCase.php | 4 +- .../test-class-wc-payments-task-disputes.php | 2 - ...ass-wc-rest-payments-orders-controller.php | 10 +- ...st-payments-payment-intents-controller.php | 1 - ...ss-wc-rest-payments-readers-controller.php | 1 - tests/unit/bootstrap.php | 8 +- ...e-create-and-confirm-intention-request.php | 2 +- ...st-class-core-create-intention-request.php | 2 +- ...ss-core-create-setup-intention-request.php | 2 - .../test-class-core-paginated-request.php | 2 - .../test-class-core-refund-charge-request.php | 1 - .../test-class-core-request-generic.php | 1 - .../request/test-class-core-request.php | 8 +- .../server/request/test-class-get-request.php | 2 +- ...test-class-list-authorizations-request.php | 1 - .../test-class-list-deposits-request.php | 1 - .../test-class-list-disputes-request.php | 2 - .../test-class-list-documents-request.php | 1 - ...ist-fraud-outcome-transactions-request.php | 1 - .../test-class-list-transactions-request.php | 1 - .../server/request/test-trait-order-info.php | 2 +- ...class-wc-payments-customer-service-api.php | 2 - tests/unit/core/test-class-mode.php | 4 +- ...est-class-buyer-fingerprinting-service.php | 2 +- .../test-class-fraud-prevention-service.php | 1 - .../helpers/class-wc-helper-subscription.php | 3 +- .../helpers/class-wc-mock-wc-data-store.php | 2 - tests/unit/helpers/class-wc-mock-wc-data.php | 2 +- .../test-class-woocommerce-deposits.php | 5 +- ...t-class-woocommerce-points-and-rewards.php | 1 - .../multi-currency/test-class-analytics.php | 9 +- .../test-class-frontend-prices.php | 4 +- .../multi-currency/test-class-geolocation.php | 16 +- .../test-class-multi-currency.php | 19 +- .../multi-currency/test-class-settings.php | 1 - ...-class-wc-payments-remote-note-service.php | 4 +- ...ents-reports-authorizations-controller.php | 1 - .../Internal/Payment/PaymentContextTest.php | 1 - .../unit/src/Internal/Payment/RouterTest.php | 4 +- .../Payment/State/InitialStateTest.php | 2 +- .../Payment/State/ProcessedStateTest.php | 1 - .../DuplicatePaymentPreventionServiceTest.php | 4 +- .../Service/FraudPreventionServiceTest.php | 2 +- .../Internal/Service/Level3ServiceTest.php | 14 +- .../src/Internal/Service/OrderServiceTest.php | 1 - .../PaymentContextLoggerServiceTest.php | 1 - tests/unit/test-class-base-constant.php | 1 - .../unit/test-class-compatibility-service.php | 4 +- tests/unit/test-class-database-cache.php | 20 +- tests/unit/test-class-experimental-abtest.php | 2 +- ...wc-payment-gateway-wcpay-payment-types.php | 3 +- ...-payment-gateway-wcpay-process-payment.php | 2 +- ...c-payment-gateway-wcpay-process-refund.php | 2 +- ...ay-wcpay-subscriptions-process-payment.php | 1 - .../test-class-wc-payment-gateway-wcpay.php | 8 +- ...-class-wc-payments-captured-event-note.php | 2 +- ...est-class-wc-payments-customer-service.php | 1 - tests/unit/test-class-wc-payments-db.php | 1 - ...t-class-wc-payments-dependency-service.php | 3 - ...xpress-checkout-button-display-handler.php | 2 +- ...ayments-express-checkout-button-helper.php | 2 +- ...t-class-wc-payments-incentives-service.php | 4 +- .../test-class-wc-payments-order-service.php | 4 +- ...ayments-payment-request-button-handler.php | 10 +- .../test-class-wc-payments-token-service.php | 2 - tests/unit/test-class-wc-payments-utils.php | 1 - ...wc-payments-webhook-processing-service.php | 9 +- ...c-payments-webhook-reliability-service.php | 4 +- ...lass-wc-payments-woopay-button-handler.php | 2 +- .../test-class-wc-payments-api-client.php | 1 - .../test-class-woopay-adapted-extensions.php | 6 +- .../test-class-woopay-order-status-sync.php | 2 - woocommerce-payments.php | 6 +- 162 files changed, 923 insertions(+), 707 deletions(-) create mode 100644 changelog/fix-8465-fix-phpcs-reports create mode 100644 changelog/tweak-revert-phpcs-update-revert-pr diff --git a/changelog/fix-8465-fix-phpcs-reports b/changelog/fix-8465-fix-phpcs-reports new file mode 100644 index 00000000000..ba6f6f92223 --- /dev/null +++ b/changelog/fix-8465-fix-phpcs-reports @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Fixed phpcs errors diff --git a/changelog/tweak-revert-phpcs-update-revert-pr b/changelog/tweak-revert-phpcs-update-revert-pr new file mode 100644 index 00000000000..4835ea31aca --- /dev/null +++ b/changelog/tweak-revert-phpcs-update-revert-pr @@ -0,0 +1,4 @@ +Significance: patch +Type: dev + +Updated PHPCS and sniffs used for static analysis diff --git a/composer.json b/composer.json index dccb7b15259..6f5a33a51f6 100644 --- a/composer.json +++ b/composer.json @@ -32,7 +32,7 @@ "require-dev": { "composer/installers": "1.10.0", "phpunit/phpunit": "9.5.14", - "woocommerce/woocommerce-sniffs": "0.1.0", + "woocommerce/woocommerce-sniffs": "1.0.0", "woocommerce/action-scheduler": "3.1.6", "kalessil/production-dependencies-guard": "dev-master", "vimeo/psalm": "4.13.1", @@ -44,7 +44,7 @@ "automattic/jetpack-changelogger": "3.3.2", "spatie/phpunit-watcher": "1.23", "woocommerce/qit-cli": "0.4.0", - "slevomat/coding-standard": "8.0.0", + "slevomat/coding-standard": "8.15.0", "dg/bypass-finals": "1.5.1" }, "scripts": { diff --git a/composer.lock b/composer.lock index 863f69916ca..52fa3d76c9d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c77c6f448183a14790ec1fee9fc3636e", + "content-hash": "3d04b7b6ae84cf0a7ffe20f8336de82a", "packages": [ { "name": "automattic/jetpack-a8c-mc-stats", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-a8c-mc-stats.git", - "reference": "6ce7a1e1eba796643d7d32dc49057c7bb8e3233c" + "reference": "64748d02bf646e6b000f79dc8e4ea127bbd8df14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-a8c-mc-stats/zipball/6ce7a1e1eba796643d7d32dc49057c7bb8e3233c", - "reference": "6ce7a1e1eba796643d7d32dc49057c7bb8e3233c", + "url": "https://api.github.com/repos/Automattic/jetpack-a8c-mc-stats/zipball/64748d02bf646e6b000f79dc8e4ea127bbd8df14", + "reference": "64748d02bf646e6b000f79dc8e4ea127bbd8df14", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "yoast/phpunit-polyfills": "1.1.0" }, "suggest": { @@ -52,9 +52,9 @@ ], "description": "Used to record internal usage stats for Automattic. Not visible to site owners.", "support": { - "source": "https://github.com/Automattic/jetpack-a8c-mc-stats/tree/v2.0.0" + "source": "https://github.com/Automattic/jetpack-a8c-mc-stats/tree/v2.0.1" }, - "time": "2023-11-20T20:02:34+00:00" + "time": "2024-03-12T22:00:11+00:00" }, { "name": "automattic/jetpack-admin-ui", @@ -114,24 +114,24 @@ }, { "name": "automattic/jetpack-assets", - "version": "v2.0.4", + "version": "v2.1.4", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-assets.git", - "reference": "ae8944abdb7a8da7137dedb9b4fe2afd81ed2d72" + "reference": "06614b6daf1229002ca80dae982421c74c351a83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-assets/zipball/ae8944abdb7a8da7137dedb9b4fe2afd81ed2d72", - "reference": "ae8944abdb7a8da7137dedb9b4fe2afd81ed2d72", + "url": "https://api.github.com/repos/Automattic/jetpack-assets/zipball/06614b6daf1229002ca80dae982421c74c351a83", + "reference": "06614b6daf1229002ca80dae982421c74c351a83", "shasum": "" }, "require": { - "automattic/jetpack-constants": "^2.0.0", + "automattic/jetpack-constants": "^2.0.1", "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.5", + "automattic/jetpack-changelogger": "^4.1.1", "brain/monkey": "2.6.1", "wikimedia/testing-access-wrapper": "^1.0 || ^2.0 || ^3.0", "yoast/phpunit-polyfills": "1.1.0" @@ -148,7 +148,7 @@ "link-template": "https://github.com/Automattic/jetpack-assets/compare/v${old}...v${new}" }, "branch-alias": { - "dev-trunk": "2.0.x-dev" + "dev-trunk": "2.1.x-dev" } }, "autoload": { @@ -165,9 +165,9 @@ ], "description": "Asset management utilities for Jetpack ecosystem packages", "support": { - "source": "https://github.com/Automattic/jetpack-assets/tree/v2.0.4" + "source": "https://github.com/Automattic/jetpack-assets/tree/v2.1.4" }, - "time": "2024-01-04T15:59:44+00:00" + "time": "2024-03-12T22:01:21+00:00" }, { "name": "automattic/jetpack-autoloader", @@ -333,23 +333,23 @@ }, { "name": "automattic/jetpack-constants", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-constants.git", - "reference": "d4244e33d2d18902951af05ca5dbb689a23c9cdc" + "reference": "b159a8777450721a2e898a80930be1fdf59bae92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/d4244e33d2d18902951af05ca5dbb689a23c9cdc", - "reference": "d4244e33d2d18902951af05ca5dbb689a23c9cdc", + "url": "https://api.github.com/repos/Automattic/jetpack-constants/zipball/b159a8777450721a2e898a80930be1fdf59bae92", + "reference": "b159a8777450721a2e898a80930be1fdf59bae92", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "1.1.0" }, @@ -378,9 +378,9 @@ ], "description": "A wrapper for defining constants in a more testable way.", "support": { - "source": "https://github.com/Automattic/jetpack-constants/tree/v2.0.0" + "source": "https://github.com/Automattic/jetpack-constants/tree/v2.0.1" }, - "time": "2023-11-20T20:02:28+00:00" + "time": "2024-03-12T22:00:13+00:00" }, { "name": "automattic/jetpack-identity-crisis", @@ -444,23 +444,23 @@ }, { "name": "automattic/jetpack-ip", - "version": "v0.2.1", + "version": "v0.2.2", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-ip.git", - "reference": "2c4c7c237ae8628b64edbe920f6ceef9be15d7dc" + "reference": "b3efffb57901e236c3c1e7299b575563e1937013" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-ip/zipball/2c4c7c237ae8628b64edbe920f6ceef9be15d7dc", - "reference": "2c4c7c237ae8628b64edbe920f6ceef9be15d7dc", + "url": "https://api.github.com/repos/Automattic/jetpack-ip/zipball/b3efffb57901e236c3c1e7299b575563e1937013", + "reference": "b3efffb57901e236c3c1e7299b575563e1937013", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.2", + "automattic/jetpack-changelogger": "^4.1.1", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "1.1.0" }, @@ -493,29 +493,29 @@ ], "description": "Utilities for working with IP addresses.", "support": { - "source": "https://github.com/Automattic/jetpack-ip/tree/v0.2.1" + "source": "https://github.com/Automattic/jetpack-ip/tree/v0.2.2" }, - "time": "2023-11-21T18:58:12+00:00" + "time": "2024-03-12T22:00:05+00:00" }, { "name": "automattic/jetpack-logo", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-logo.git", - "reference": "21890dd130cae1365d6e59cf01db74e453e72d10" + "reference": "9b51eeedafcd024dd0eb74e2da0ab26d42ae4207" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-logo/zipball/21890dd130cae1365d6e59cf01db74e453e72d10", - "reference": "21890dd130cae1365d6e59cf01db74e453e72d10", + "url": "https://api.github.com/repos/Automattic/jetpack-logo/zipball/9b51eeedafcd024dd0eb74e2da0ab26d42ae4207", + "reference": "9b51eeedafcd024dd0eb74e2da0ab26d42ae4207", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "yoast/phpunit-polyfills": "1.1.0" }, "suggest": { @@ -543,29 +543,29 @@ ], "description": "A logo for Jetpack", "support": { - "source": "https://github.com/Automattic/jetpack-logo/tree/v2.0.0" + "source": "https://github.com/Automattic/jetpack-logo/tree/v2.0.1" }, - "time": "2023-11-20T20:02:31+00:00" + "time": "2024-03-12T22:00:14+00:00" }, { "name": "automattic/jetpack-password-checker", - "version": "v0.3.0", + "version": "v0.3.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-password-checker.git", - "reference": "43120a1ddc032a9141ff02cc3ac7a7eac936d9f9" + "reference": "d9be23791e6f38debeacbf74174903f223ddfd89" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-password-checker/zipball/43120a1ddc032a9141ff02cc3ac7a7eac936d9f9", - "reference": "43120a1ddc032a9141ff02cc3ac7a7eac936d9f9", + "url": "https://api.github.com/repos/Automattic/jetpack-password-checker/zipball/d9be23791e6f38debeacbf74174903f223ddfd89", + "reference": "d9be23791e6f38debeacbf74174903f223ddfd89", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "automattic/wordbless": "@dev", "yoast/phpunit-polyfills": "1.1.0" }, @@ -595,30 +595,30 @@ ], "description": "Password Checker.", "support": { - "source": "https://github.com/Automattic/jetpack-password-checker/tree/v0.3.0" + "source": "https://github.com/Automattic/jetpack-password-checker/tree/v0.3.1" }, - "time": "2023-11-20T20:02:33+00:00" + "time": "2024-03-14T20:42:38+00:00" }, { "name": "automattic/jetpack-redirect", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-redirect.git", - "reference": "8f1bbfd4b046b8a0ae7b156007c2ef56a0ddbf76" + "reference": "24742b555faf49ec811e263653da898184c72366" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-redirect/zipball/8f1bbfd4b046b8a0ae7b156007c2ef56a0ddbf76", - "reference": "8f1bbfd4b046b8a0ae7b156007c2ef56a0ddbf76", + "url": "https://api.github.com/repos/Automattic/jetpack-redirect/zipball/24742b555faf49ec811e263653da898184c72366", + "reference": "24742b555faf49ec811e263653da898184c72366", "shasum": "" }, "require": { - "automattic/jetpack-status": "^2.0.0", + "automattic/jetpack-status": "^2.1.2", "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "1.1.0" }, @@ -647,29 +647,29 @@ ], "description": "Utilities to build URLs to the jetpack.com/redirect/ service", "support": { - "source": "https://github.com/Automattic/jetpack-redirect/tree/v2.0.0" + "source": "https://github.com/Automattic/jetpack-redirect/tree/v2.0.1" }, - "time": "2023-11-20T20:03:01+00:00" + "time": "2024-03-12T22:00:44+00:00" }, { "name": "automattic/jetpack-roles", - "version": "v2.0.0", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-roles.git", - "reference": "967e52052a17123a23f4112da3d8e7e995467cb2" + "reference": "a9b52f59a3c32b6413e6aa859a6a964ba969eec9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-roles/zipball/967e52052a17123a23f4112da3d8e7e995467cb2", - "reference": "967e52052a17123a23f4112da3d8e7e995467cb2", + "url": "https://api.github.com/repos/Automattic/jetpack-roles/zipball/a9b52f59a3c32b6413e6aa859a6a964ba969eec9", + "reference": "a9b52f59a3c32b6413e6aa859a6a964ba969eec9", "shasum": "" }, "require": { "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.0", + "automattic/jetpack-changelogger": "^4.1.1", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "1.1.0" }, @@ -698,31 +698,31 @@ ], "description": "Utilities, related with user roles and capabilities.", "support": { - "source": "https://github.com/Automattic/jetpack-roles/tree/v2.0.0" + "source": "https://github.com/Automattic/jetpack-roles/tree/v2.0.1" }, - "time": "2023-11-20T20:02:32+00:00" + "time": "2024-03-12T22:00:06+00:00" }, { "name": "automattic/jetpack-status", - "version": "v2.1.0", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/Automattic/jetpack-status.git", - "reference": "badaae2ef5345629f5333938e32a649bf946d688" + "reference": "a17f33f601303615f0b5e4cb9a23c0817243c68f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Automattic/jetpack-status/zipball/badaae2ef5345629f5333938e32a649bf946d688", - "reference": "badaae2ef5345629f5333938e32a649bf946d688", + "url": "https://api.github.com/repos/Automattic/jetpack-status/zipball/a17f33f601303615f0b5e4cb9a23c0817243c68f", + "reference": "a17f33f601303615f0b5e4cb9a23c0817243c68f", "shasum": "" }, "require": { - "automattic/jetpack-constants": "^2.0.0", + "automattic/jetpack-constants": "^2.0.1", "php": ">=7.0" }, "require-dev": { - "automattic/jetpack-changelogger": "^4.0.5", - "automattic/jetpack-ip": "^0.2.1", + "automattic/jetpack-changelogger": "^4.1.1", + "automattic/jetpack-ip": "^0.2.2", "brain/monkey": "2.6.1", "yoast/phpunit-polyfills": "1.1.0" }, @@ -751,9 +751,9 @@ ], "description": "Used to retrieve information about the current status of Jetpack and the site overall.", "support": { - "source": "https://github.com/Automattic/jetpack-status/tree/v2.1.0" + "source": "https://github.com/Automattic/jetpack-status/tree/v2.1.2" }, - "time": "2024-01-18T21:49:55+00:00" + "time": "2024-03-12T22:00:42+00:00" }, { "name": "automattic/jetpack-sync", @@ -1800,35 +1800,38 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.0", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e8d808670b8f882188368faaf1144448c169c0b7", - "reference": "e8d808670b8f882188368faaf1144448c169c0b7", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2 || ^3 || 4.0.x-dev" + "php": ">=5.4", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -1841,6 +1844,10 @@ "email": "franck.nijhof@dealerdirect.com", "homepage": "http://www.frenck.nl", "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -1852,6 +1859,7 @@ "codesniffer", "composer", "installer", + "phpcbf", "phpcs", "plugin", "qa", @@ -1863,10 +1871,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2020-06-25T14:57:39+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "dg/bypass-finals", @@ -1958,6 +1966,53 @@ }, "time": "2019-12-04T15:06:13+00:00" }, + { + "name": "doctrine/deprecations", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "reference": "dfbaa3c2d2e9a9df1118213f3b8b0c597bb99fab", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "1.4.10 || 1.10.15", + "phpstan/phpstan-phpunit": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "psalm/plugin-phpunit": "0.18.4", + "psr/log": "^1 || ^2 || ^3", + "vimeo/psalm": "4.30.0 || 5.12.0" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "lib/Doctrine/Deprecations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.3" + }, + "time": "2024-01-30T19:34:25+00:00" + }, { "name": "doctrine/instantiator", "version": "1.5.0", @@ -2521,20 +2576,21 @@ }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -2575,9 +2631,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -2839,16 +2901,16 @@ }, { "name": "phpcompatibility/phpcompatibility-wp", - "version": "2.1.0", + "version": "2.1.4", "source": { "type": "git", "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", - "reference": "41bef18ba688af638b7310666db28e1ea9158b2f" + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f", - "reference": "41bef18ba688af638b7310666db28e1ea9158b2f", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", + "reference": "b6c1e3ee1c35de6c41a511d5eb9bd03e447480a5", "shasum": "" }, "require": { @@ -2856,10 +2918,10 @@ "phpcompatibility/phpcompatibility-paragonie": "^1.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5" + "dealerdirect/phpcodesniffer-composer-installer": "^0.7" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." }, "type": "phpcodesniffer-standard", @@ -2883,13 +2945,180 @@ "compatibility", "phpcs", "standards", + "static analysis", "wordpress" ], "support": { "issues": "https://github.com/PHPCompatibility/PHPCompatibilityWP/issues", "source": "https://github.com/PHPCompatibility/PHPCompatibilityWP" }, - "time": "2019-08-28T14:22:28+00:00" + "time": "2022-10-24T09:00:36+00:00" + }, + { + "name": "phpcsstandards/phpcsextra", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSExtra.git", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "reference": "11d387c6642b6e4acaf0bd9bf5203b8cca1ec489", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "phpcsstandards/phpcsutils": "^1.0.9", + "squizlabs/php_codesniffer": "^3.8.0" + }, + "require-dev": { + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "phpcsstandards/phpcsdevtools": "^1.2.1", + "phpunit/phpunit": "^4.5 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSExtra/graphs/contributors" + } + ], + "description": "A collection of sniffs and standards for use with PHP_CodeSniffer.", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHPCSExtra/issues", + "security": "https://github.com/PHPCSStandards/PHPCSExtra/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSExtra" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T16:49:07+00:00" + }, + { + "name": "phpcsstandards/phpcsutils", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHPCSUtils.git", + "reference": "908247bc65010c7b7541a9551e002db12e9dae70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/908247bc65010c7b7541a9551e002db12e9dae70", + "reference": "908247bc65010c7b7541a9551e002db12e9dae70", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.1 || ^0.5 || ^0.6.2 || ^0.7 || ^1.0", + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.8.0 || 4.0.x-dev@dev" + }, + "require-dev": { + "ext-filter": "*", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcsstandards/phpcsdevcs": "^1.1.6", + "yoast/phpunit-polyfills": "^1.1.0 || ^2.0.0" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-stable": "1.x-dev", + "dev-develop": "1.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPCSUtils/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHPCSUtils/graphs/contributors" + } + ], + "description": "A suite of utility functions for use with PHP_CodeSniffer", + "homepage": "https://phpcsutils.com/", + "keywords": [ + "PHP_CodeSniffer", + "phpcbf", + "phpcodesniffer-standard", + "phpcs", + "phpcs3", + "standards", + "static analysis", + "tokens", + "utility" + ], + "support": { + "docs": "https://phpcsutils.com/", + "issues": "https://github.com/PHPCSStandards/PHPCSUtils/issues", + "security": "https://github.com/PHPCSStandards/PHPCSUtils/security/policy", + "source": "https://github.com/PHPCSStandards/PHPCSUtils" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T14:50:00+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3003,25 +3232,33 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.6.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "77a32518733312af16a44300404e945338981de3" + "reference": "153ae662783729388a584b4361f2545e4d841e3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/77a32518733312af16a44300404e945338981de3", - "reference": "77a32518733312af16a44300404e945338981de3", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/153ae662783729388a584b4361f2545e4d841e3c", + "reference": "153ae662783729388a584b4361f2545e4d841e3c", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.13" }, "require-dev": { "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" }, "type": "library", "extra": { @@ -3047,30 +3284,30 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.2" }, - "time": "2022-03-15T21:29:03+00:00" + "time": "2024-02-23T11:10:43+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.18.0", + "version": "v1.19.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c" + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d4f454f7e1193933f04e6500de3e79191648ed0c", - "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/67a759e7d8746d501c41536ba40cd9c0a07d6a87", + "reference": "67a759e7d8746d501c41536ba40cd9c0a07d6a87", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0 || ^5.0", - "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0 || ^6.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0 || ^6.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", @@ -3116,22 +3353,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.18.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.19.0" }, - "time": "2023-12-07T16:22:33+00:00" + "time": "2024-02-29T11:52:51+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.25.0", + "version": "1.26.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240" + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240", - "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/231e3186624c03d7e7c890ec662b81e6b0405227", + "reference": "231e3186624c03d7e7c890ec662b81e6b0405227", "shasum": "" }, "require": { @@ -3163,22 +3400,22 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.26.0" }, - "time": "2024-01-04T17:06:16+00:00" + "time": "2024-02-23T16:05:55+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.30", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", - "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { @@ -3235,7 +3472,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -3243,7 +3480,7 @@ "type": "github" } ], - "time": "2023-12-22T06:47:57+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3885,16 +4122,16 @@ }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -3929,7 +4166,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -3937,7 +4174,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -4183,16 +4420,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -4237,7 +4474,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -4245,7 +4482,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -4312,16 +4549,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -4377,7 +4614,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -4385,20 +4622,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -4441,7 +4678,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -4449,7 +4686,7 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", @@ -4685,16 +4922,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -4706,7 +4943,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -4727,8 +4964,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -4736,7 +4972,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -4849,42 +5085,42 @@ }, { "name": "slevomat/coding-standard", - "version": "8.0.0", + "version": "8.15.0", "source": { "type": "git", "url": "https://github.com/slevomat/coding-standard.git", - "reference": "84cc1693467996d0fc0838d4d4594eb9890ab295" + "reference": "7d1d957421618a3803b593ec31ace470177d7817" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/84cc1693467996d0fc0838d4d4594eb9890ab295", - "reference": "84cc1693467996d0fc0838d4d4594eb9890ab295", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/7d1d957421618a3803b593ec31ace470177d7817", + "reference": "7d1d957421618a3803b593ec31ace470177d7817", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7", + "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7 || ^1.0", "php": "^7.2 || ^8.0", - "phpstan/phpdoc-parser": "^1.6.2", - "squizlabs/php_codesniffer": "^3.7.0" + "phpstan/phpdoc-parser": "^1.23.1", + "squizlabs/php_codesniffer": "^3.9.0" }, "require-dev": { - "phing/phing": "2.17.3", + "phing/phing": "2.17.4", "php-parallel-lint/php-parallel-lint": "1.3.2", - "phpstan/phpstan": "1.4.10|1.7.14", - "phpstan/phpstan-deprecation-rules": "1.0.0", - "phpstan/phpstan-phpunit": "1.0.0|1.1.1", - "phpstan/phpstan-strict-rules": "1.2.3", - "phpunit/phpunit": "7.5.20|8.5.21|9.5.20" + "phpstan/phpstan": "1.10.60", + "phpstan/phpstan-deprecation-rules": "1.1.4", + "phpstan/phpstan-phpunit": "1.3.16", + "phpstan/phpstan-strict-rules": "1.5.2", + "phpunit/phpunit": "8.5.21|9.6.8|10.5.11" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "7.x-dev" + "dev-master": "8.x-dev" } }, "autoload": { "psr-4": { - "SlevomatCodingStandard\\": "SlevomatCodingStandard" + "SlevomatCodingStandard\\": "SlevomatCodingStandard/" } }, "notification-url": "https://packagist.org/downloads/", @@ -4892,9 +5128,13 @@ "MIT" ], "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "keywords": [ + "dev", + "phpcs" + ], "support": { "issues": "https://github.com/slevomat/coding-standard/issues", - "source": "https://github.com/slevomat/coding-standard/tree/8.0.0" + "source": "https://github.com/slevomat/coding-standard/tree/8.15.0" }, "funding": [ { @@ -4906,7 +5146,7 @@ "type": "tidelift" } ], - "time": "2022-06-17T13:13:47+00:00" + "time": "2024-03-09T15:20:58+00:00" }, { "name": "spatie/phpunit-watcher", @@ -4972,16 +5212,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.1", + "version": "3.9.0", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", - "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", "shasum": "" }, "require": { @@ -5048,20 +5288,20 @@ "type": "open_collective" } ], - "time": "2024-01-11T20:47:48+00:00" + "time": "2024-02-16T15:06:51+00:00" }, { "name": "symfony/console", - "version": "v5.4.35", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931" + "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/dbdf6adcb88d5f83790e1efb57ef4074309d3931", - "reference": "dbdf6adcb88d5f83790e1efb57ef4074309d3931", + "url": "https://api.github.com/repos/symfony/console/zipball/39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", + "reference": "39f75d9d73d0c11952fdcecf4877b4d0f62a8f6e", "shasum": "" }, "require": { @@ -5131,7 +5371,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.35" + "source": "https://github.com/symfony/console/tree/v5.4.36" }, "funding": [ { @@ -5147,7 +5387,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T14:28:09+00:00" + "time": "2024-02-20T16:33:57+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5281,16 +5521,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -5304,9 +5544,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5343,7 +5580,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -5359,20 +5596,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "875e90aeea2777b6f135677f618529449334a612" + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/875e90aeea2777b6f135677f618529449334a612", - "reference": "875e90aeea2777b6f135677f618529449334a612", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/32a9da87d7b3245e09ac426c83d334ae9f06f80f", + "reference": "32a9da87d7b3245e09ac426c83d334ae9f06f80f", "shasum": "" }, "require": { @@ -5383,9 +5620,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5424,7 +5658,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.29.0" }, "funding": [ { @@ -5440,20 +5674,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92" + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", - "reference": "8c4ad05dd0120b6a53c1ca374dca2ad0a1c4ed92", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/bc45c394692b948b4d383a08d7753968bed9a83d", + "reference": "bc45c394692b948b4d383a08d7753968bed9a83d", "shasum": "" }, "require": { @@ -5464,9 +5698,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5508,7 +5739,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.29.0" }, "funding": [ { @@ -5524,20 +5755,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -5551,9 +5782,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5591,7 +5819,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -5607,20 +5835,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5" + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fe2f306d1d9d346a7fee353d0d5012e401e984b5", - "reference": "fe2f306d1d9d346a7fee353d0d5012e401e984b5", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", "shasum": "" }, "require": { @@ -5628,9 +5856,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5670,7 +5895,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.29.0" }, "funding": [ { @@ -5686,20 +5911,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -5707,9 +5932,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -5753,7 +5975,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -5769,20 +5991,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/process", - "version": "v5.4.35", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb" + "reference": "4fdf34004f149cc20b2f51d7d119aa500caad975" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cbc28e34015ad50166fc2f9c8962d28d0fe861eb", - "reference": "cbc28e34015ad50166fc2f9c8962d28d0fe861eb", + "url": "https://api.github.com/repos/symfony/process/zipball/4fdf34004f149cc20b2f51d7d119aa500caad975", + "reference": "4fdf34004f149cc20b2f51d7d119aa500caad975", "shasum": "" }, "require": { @@ -5815,7 +6037,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.35" + "source": "https://github.com/symfony/process/tree/v5.4.36" }, "funding": [ { @@ -5831,7 +6053,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-02-12T15:49:53+00:00" }, { "name": "symfony/service-contracts", @@ -5918,16 +6140,16 @@ }, { "name": "symfony/string", - "version": "v5.4.35", + "version": "v5.4.36", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2" + "reference": "4e232c83622bd8cd32b794216aa29d0d266d353b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/c209c4d0559acce1c9a2067612cfb5d35756edc2", - "reference": "c209c4d0559acce1c9a2067612cfb5d35756edc2", + "url": "https://api.github.com/repos/symfony/string/zipball/4e232c83622bd8cd32b794216aa29d0d266d353b", + "reference": "4e232c83622bd8cd32b794216aa29d0d266d353b", "shasum": "" }, "require": { @@ -5984,7 +6206,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.35" + "source": "https://github.com/symfony/string/tree/v5.4.36" }, "funding": [ { @@ -6000,7 +6222,7 @@ "type": "tidelift" } ], - "time": "2024-01-23T13:51:25+00:00" + "time": "2024-02-01T08:49:30+00:00" }, { "name": "symfony/yaml", @@ -6079,16 +6301,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -6117,7 +6339,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -6125,7 +6347,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" }, { "name": "vimeo/psalm", @@ -6471,74 +6693,77 @@ }, { "name": "woocommerce/woocommerce-sniffs", - "version": "0.1.0", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/woocommerce/woocommerce-sniffs.git", - "reference": "b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79" + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79", - "reference": "b72b7dd2e70aa6aed16f80cdae5b1e6cce2e4c79", + "url": "https://api.github.com/repos/woocommerce/woocommerce-sniffs/zipball/3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", + "reference": "3a65b917ff5ab5e65609e5dcb7bc62f9455bbef8", "shasum": "" }, "require": { - "dealerdirect/phpcodesniffer-composer-installer": "0.7.0", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0.0", "php": ">=7.0", - "phpcompatibility/phpcompatibility-wp": "2.1.0", - "wp-coding-standards/wpcs": "2.3.0" + "phpcompatibility/phpcompatibility-wp": "^2.1.0", + "wp-coding-standards/wpcs": "^3.0.0" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "authors": [ - { - "name": "Claudio Sanches", - "email": "claudio@automattic.com" - } - ], "description": "WooCommerce sniffs", "keywords": [ "phpcs", "standards", + "static analysis", "woocommerce", "wordpress" ], "support": { "issues": "https://github.com/woocommerce/woocommerce-sniffs/issues", - "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/master" + "source": "https://github.com/woocommerce/woocommerce-sniffs/tree/1.0.0" }, - "time": "2020-08-06T18:23:45+00:00" + "time": "2023-09-29T13:52:33+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.3.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "7da1894633f168fe244afc6de00d141f27517b62" + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62", - "reference": "7da1894633f168fe244afc6de00d141f27517b62", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b4caf9689f1a0e4a4c632679a44e638c1c67aff1", + "reference": "b4caf9689f1a0e4a4c632679a44e638c1c67aff1", "shasum": "" }, "require": { + "ext-filter": "*", + "ext-libxml": "*", + "ext-tokenizer": "*", + "ext-xmlreader": "*", "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" + "phpcsstandards/phpcsextra": "^1.1.0", + "phpcsstandards/phpcsutils": "^1.0.8", + "squizlabs/php_codesniffer": "^3.7.2" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.0", - "phpcsstandards/phpcsdevtools": "^1.0", + "phpcsstandards/phpcsdevtools": "^1.2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "ext-iconv": "For improved results", + "ext-mbstring": "For improved results" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -6555,6 +6780,7 @@ "keywords": [ "phpcs", "standards", + "static analysis", "wordpress" ], "support": { @@ -6562,7 +6788,13 @@ "source": "https://github.com/WordPress/WordPress-Coding-Standards", "wiki": "https://github.com/WordPress/WordPress-Coding-Standards/wiki" }, - "time": "2020-05-13T23:57:56+00:00" + "funding": [ + { + "url": "https://opencollective.com/thewpcc/contribute/wp-php-63406", + "type": "custom" + } + ], + "time": "2023-09-14T07:06:09+00:00" }, { "name": "yoast/phpunit-polyfills", diff --git a/includes/admin/class-wc-payments-admin-settings.php b/includes/admin/class-wc-payments-admin-settings.php index 49a062a57ee..cec7ca48b17 100644 --- a/includes/admin/class-wc-payments-admin-settings.php +++ b/includes/admin/class-wc-payments-admin-settings.php @@ -57,7 +57,7 @@ public function display_test_mode_notice() {

assign_hook( 'wcpay_get_dispute_status_counts' ); return $request->send(); @@ -1249,7 +1249,7 @@ private function get_uncaptured_transactions_count() { $test_mode = WC_Payments::mode()->is_test(); $cache_key = $test_mode ? DATABASE_CACHE::AUTHORIZATION_SUMMARY_KEY_TEST_MODE : DATABASE_CACHE::AUTHORIZATION_SUMMARY_KEY; - $send_callback = function() { + $send_callback = function () { $request = Request::get( WC_Payments_API_Client::AUTHORIZATIONS_API . '/summary' ); $request->assign_hook( 'wc_pay_get_authorizations_summary' ); return $request->send(); diff --git a/includes/admin/class-wc-rest-payments-capital-controller.php b/includes/admin/class-wc-rest-payments-capital-controller.php index b1635dfeb63..056156011b3 100644 --- a/includes/admin/class-wc-rest-payments-capital-controller.php +++ b/includes/admin/class-wc-rest-payments-capital-controller.php @@ -62,5 +62,4 @@ public function get_loans() { $request->assign_hook( 'wcpay_get_loans_request' ); return $request->handle_rest_request(); } - } diff --git a/includes/admin/class-wc-rest-payments-customer-controller.php b/includes/admin/class-wc-rest-payments-customer-controller.php index e5a109e9d20..c0f43a97003 100644 --- a/includes/admin/class-wc-rest-payments-customer-controller.php +++ b/includes/admin/class-wc-rest-payments-customer-controller.php @@ -277,5 +277,4 @@ public function get_item_schema() { ], ]; } - } diff --git a/includes/admin/class-wc-rest-payments-files-controller.php b/includes/admin/class-wc-rest-payments-files-controller.php index db41002e1df..e66eedefffd 100644 --- a/includes/admin/class-wc-rest-payments-files-controller.php +++ b/includes/admin/class-wc-rest-payments-files-controller.php @@ -62,7 +62,6 @@ public function register_routes() { 'permission_callback' => [], ] ); - } /** @@ -118,7 +117,7 @@ public function get_file( WP_REST_Request $request ) { */ add_filter( 'rest_pre_serve_request', - function ( bool $served, WP_HTTP_Response $response ) : bool { + function ( bool $served, WP_HTTP_Response $response ): bool { echo $response->get_data(); // @codingStandardsIgnoreLine return true; }, @@ -134,7 +133,6 @@ function ( bool $served, WP_HTTP_Response $response ) : bool { 'Content-Disposition' => 'inline', ] ); - } /** @@ -191,7 +189,7 @@ public function get_file_content( WP_REST_Request $request ) { * * @return WP_Error */ - private function file_error_response( WP_Error $error ) : WP_Error { + private function file_error_response( WP_Error $error ): WP_Error { $error_status_code = 'resource_missing' === $error->get_error_code() ? WP_Http::NOT_FOUND : WP_Http::INTERNAL_SERVER_ERROR; return new WP_Error( $error->get_error_code(), diff --git a/includes/admin/class-wc-rest-payments-orders-controller.php b/includes/admin/class-wc-rest-payments-orders-controller.php index e23f1ebfcff..093004d37b2 100644 --- a/includes/admin/class-wc-rest-payments-orders-controller.php +++ b/includes/admin/class-wc-rest-payments-orders-controller.php @@ -418,7 +418,7 @@ public function create_terminal_intent( $request ) { * @return array|null * @throws \Exception */ - public function get_terminal_intent_payment_method( $request, array $default_value = [ Payment_Method::CARD_PRESENT ] ) :array { + public function get_terminal_intent_payment_method( $request, array $default_value = [ Payment_Method::CARD_PRESENT ] ): array { $payment_methods = $request->get_param( 'payment_methods' ); if ( null === $payment_methods ) { return $default_value; @@ -446,7 +446,7 @@ public function get_terminal_intent_payment_method( $request, array $default_val * @return string|null * @throws \Exception */ - public function get_terminal_intent_capture_method( $request, string $default_value = 'manual' ) : string { + public function get_terminal_intent_capture_method( $request, string $default_value = 'manual' ): string { $capture_method = $request->get_param( 'capture_method' ); if ( null === $capture_method ) { return $default_value; diff --git a/includes/admin/class-wc-rest-payments-payment-intents-controller.php b/includes/admin/class-wc-rest-payments-payment-intents-controller.php index 53d02e8afa3..670d15a3089 100644 --- a/includes/admin/class-wc-rest-payments-payment-intents-controller.php +++ b/includes/admin/class-wc-rest-payments-payment-intents-controller.php @@ -51,5 +51,4 @@ public function get_payment_intent( $request ) { return $this->forward_request( 'get_intent', [ $payment_intent_id ] ); } - } diff --git a/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php b/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php index 882cda6ab5b..972717724a8 100644 --- a/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php +++ b/includes/admin/class-wc-rest-payments-payment-intents-create-controller.php @@ -371,6 +371,4 @@ public function prepare_item_for_response( $item, $request ) { return rest_ensure_response( $prepared_item ); } - - } diff --git a/includes/admin/class-wc-rest-woopay-session-controller.php b/includes/admin/class-wc-rest-woopay-session-controller.php index 3dd0fd8b1f7..24eb0b827d2 100644 --- a/includes/admin/class-wc-rest-woopay-session-controller.php +++ b/includes/admin/class-wc-rest-woopay-session-controller.php @@ -93,4 +93,3 @@ private function is_request_from_woopay(): bool { return isset( $_SERVER['HTTP_USER_AGENT'] ) && 'WooPay' === $_SERVER['HTTP_USER_AGENT']; } } - diff --git a/includes/admin/tasks/class-wc-payments-task-disputes.php b/includes/admin/tasks/class-wc-payments-task-disputes.php index abc24c5df95..b7212ec7623 100644 --- a/includes/admin/tasks/class-wc-payments-task-disputes.php +++ b/includes/admin/tasks/class-wc-payments-task-disputes.php @@ -207,7 +207,6 @@ public function get_additional_info() { ), count( (array) $this->disputes_due_within_7d ) ); - } /** @@ -325,7 +324,7 @@ private function get_disputes_needing_response_within_days( $num_days ) { private function get_disputes_needing_response() { return $this->database_cache->get_or_add( Database_Cache::ACTIVE_DISPUTES_KEY, - function() { + function () { $response = $this->api_client->get_disputes( [ 'pagesize' => 50, @@ -338,7 +337,7 @@ function() { // sort by due_by date ascending. usort( $active_disputes, - function( $a, $b ) { + function ( $a, $b ) { $a_due_by = new \DateTime( $a['due_by'] ); $b_due_by = new \DateTime( $b['due_by'] ); diff --git a/includes/admin/tracks/tracks-loader.php b/includes/admin/tracks/tracks-loader.php index 21fcb1278e1..93ebbe2049e 100644 --- a/includes/admin/tracks/tracks-loader.php +++ b/includes/admin/tracks/tracks-loader.php @@ -24,7 +24,7 @@ function record_tracker_events() { // Loaded on admin_init to ensure that we are in admin and that WC_Tracks is loaded. add_action( 'admin_init', - function() { + function () { if ( ! class_exists( 'WC_Tracks' ) ) { return; } diff --git a/includes/class-duplicate-payment-prevention-service.php b/includes/class-duplicate-payment-prevention-service.php index 35ac1896234..50a704793d1 100644 --- a/includes/class-duplicate-payment-prevention-service.php +++ b/includes/class-duplicate-payment-prevention-service.php @@ -96,7 +96,7 @@ public function check_payment_intent_attached_to_order_succeeded( WC_Order $orde } catch ( Exception $e ) { Logger::error( 'Failed to fetch attached payment intent: ' . $e ); return; - }; + } if ( ! $intent->is_authorized() ) { return; diff --git a/includes/class-experimental-abtest.php b/includes/class-experimental-abtest.php index fbbe80775c3..cf7e785656c 100644 --- a/includes/class-experimental-abtest.php +++ b/includes/class-experimental-abtest.php @@ -170,4 +170,3 @@ protected function request_variation( $test_name ) { return $get; } } - diff --git a/includes/class-payment-information.php b/includes/class-payment-information.php index 1f95a05887d..38191bf7ded 100644 --- a/includes/class-payment-information.php +++ b/includes/class-payment-information.php @@ -134,7 +134,7 @@ public function __construct( if ( empty( $payment_method ) && empty( $token ) && ! \WC_Payments::is_network_saved_cards_enabled() ) { // If network-wide cards are enabled, a payment method or token may not be specified and the platform default one will be used. throw new Invalid_Payment_Method_Exception( - __( 'Invalid or missing payment details. Please ensure the provided payment method is correctly entered.', 'woocommerce-payments' ), + esc_html__( 'Invalid or missing payment details. Please ensure the provided payment method is correctly entered.', 'woocommerce-payments' ), 'payment_method_not_provided' ); } diff --git a/includes/class-wc-payment-gateway-wcpay.php b/includes/class-wc-payment-gateway-wcpay.php index 82f63acce9c..fd8e55282d8 100644 --- a/includes/class-wc-payment-gateway-wcpay.php +++ b/includes/class-wc-payment-gateway-wcpay.php @@ -2003,7 +2003,7 @@ public function get_payment_method_to_use_for_intent() { * @param Payment_Information $payment_information Payment information object for transaction. * @return array List of payment methods. */ - public function get_payment_method_types( $payment_information ) : array { + public function get_payment_method_types( $payment_information ): array { $requested_payment_method = sanitize_text_field( wp_unslash( $_POST['payment_method'] ?? '' ) ); // phpcs:ignore WordPress.Security.NonceVerification $token = $payment_information->get_payment_token(); @@ -3817,7 +3817,7 @@ public function get_payment_method_ids_enabled_at_checkout( $order_id = null, $f in_array( Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID, $enabled_payment_methods, true ) ) { $enabled_payment_methods = array_filter( $enabled_payment_methods, - static function( $method ) { + static function ( $method ) { return Link_Payment_Method::PAYMENT_METHOD_STRIPE_ID !== $method; } ); @@ -4297,7 +4297,7 @@ private function upe_needs_redirection( $payment_methods ) { * @return void */ private function handle_afterpay_shipping_requirement( WC_Order $order, Create_And_Confirm_Intention $request ): void { - $check_if_usable = function( array $address ): bool { + $check_if_usable = function ( array $address ): bool { return $address['country'] && $address['state'] && $address['city'] && $address['postal_code'] && $address['line1']; }; diff --git a/includes/class-wc-payments-account.php b/includes/class-wc-payments-account.php index 63226e95e31..e85ff32d603 100644 --- a/includes/class-wc-payments-account.php +++ b/includes/class-wc-payments-account.php @@ -315,7 +315,7 @@ public function get_account_status_data(): array { * * @return string Account statement descriptor. */ - public function get_statement_descriptor() : string { + public function get_statement_descriptor(): string { $account = $this->get_cached_account_data(); return ! empty( $account ) && isset( $account['statement_descriptor'] ) ? $account['statement_descriptor'] : ''; } @@ -325,7 +325,7 @@ public function get_statement_descriptor() : string { * * @return string Account statement descriptor. */ - public function get_statement_descriptor_kanji() : string { + public function get_statement_descriptor_kanji(): string { $account = $this->get_cached_account_data(); return ! empty( $account ) && isset( $account['statement_descriptor_kanji'] ) ? $account['statement_descriptor_kanji'] : ''; } @@ -335,7 +335,7 @@ public function get_statement_descriptor_kanji() : string { * * @return string Account statement descriptor. */ - public function get_statement_descriptor_kana() : string { + public function get_statement_descriptor_kana(): string { $account = $this->get_cached_account_data(); return ! empty( $account ) && isset( $account['statement_descriptor_kana'] ) ? $account['statement_descriptor_kana'] : ''; } @@ -345,7 +345,7 @@ public function get_statement_descriptor_kana() : string { * * @return string Business profile name. */ - public function get_business_name() : string { + public function get_business_name(): string { $account = $this->get_cached_account_data(); return isset( $account['business_profile']['name'] ) ? $account['business_profile']['name'] : ''; } @@ -355,7 +355,7 @@ public function get_business_name() : string { * * @return string Business profile url. */ - public function get_business_url() : string { + public function get_business_url(): string { $account = $this->get_cached_account_data(); return isset( $account['business_profile']['url'] ) ? $account['business_profile']['url'] : ''; } @@ -365,7 +365,7 @@ public function get_business_url() : string { * * @return array Business profile support address. */ - public function get_business_support_address() : array { + public function get_business_support_address(): array { $account = $this->get_cached_account_data(); return isset( $account['business_profile']['support_address'] ) ? $account['business_profile']['support_address'] : []; } @@ -375,7 +375,7 @@ public function get_business_support_address() : array { * * @return string Business profile support email. */ - public function get_business_support_email() : string { + public function get_business_support_email(): string { $account = $this->get_cached_account_data(); return isset( $account['business_profile']['support_email'] ) ? $account['business_profile']['support_email'] : ''; } @@ -385,7 +385,7 @@ public function get_business_support_email() : string { * * @return string Business profile support phone. */ - public function get_business_support_phone() : string { + public function get_business_support_phone(): string { $account = $this->get_cached_account_data(); return isset( $account['business_profile']['support_phone'] ) ? $account['business_profile']['support_phone'] : ''; } @@ -395,7 +395,7 @@ public function get_business_support_phone() : string { * * @return string branding logo. */ - public function get_branding_logo() : string { + public function get_branding_logo(): string { $account = $this->get_cached_account_data(); return isset( $account['branding']['logo'] ) ? $account['branding']['logo'] : ''; } @@ -405,7 +405,7 @@ public function get_branding_logo() : string { * * @return string branding icon. */ - public function get_branding_icon() : string { + public function get_branding_icon(): string { $account = $this->get_cached_account_data(); return isset( $account['branding']['icon'] ) ? $account['branding']['icon'] : ''; } @@ -415,7 +415,7 @@ public function get_branding_icon() : string { * * @return string branding primary color. */ - public function get_branding_primary_color() : string { + public function get_branding_primary_color(): string { $account = $this->get_cached_account_data(); return isset( $account['branding']['primary_color'] ) ? $account['branding']['primary_color'] : ''; } @@ -425,7 +425,7 @@ public function get_branding_primary_color() : string { * * @return string branding secondary color. */ - public function get_branding_secondary_color() : string { + public function get_branding_secondary_color(): string { $account = $this->get_cached_account_data(); return isset( $account['branding']['secondary_color'] ) ? $account['branding']['secondary_color'] : ''; } @@ -1847,7 +1847,7 @@ private function get_actioned_notes(): array { } // Fetch the last 10 actioned wcpay-promo admin notifications. - $add_like_clause = function( $where_clause ) { + $add_like_clause = function ( $where_clause ) { return $where_clause . " AND name like 'wcpay-promo-%'"; }; @@ -2023,7 +2023,7 @@ public function get_tracking_info( $force_refresh = false ): ?array { return $this->database_cache->get_or_add( Database_Cache::TRACKING_INFO_KEY, - function(): array { + function (): array { return $this->payments_api_client->get_tracking_info(); }, 'is_array', // We expect an array back from the cache. diff --git a/includes/class-wc-payments-action-scheduler-service.php b/includes/class-wc-payments-action-scheduler-service.php index 1952d427a31..d66677834c6 100644 --- a/includes/class-wc-payments-action-scheduler-service.php +++ b/includes/class-wc-payments-action-scheduler-service.php @@ -38,7 +38,8 @@ class WC_Payments_Action_Scheduler_Service { * @param WC_Payments_Order_Service $order_service - Order Service. */ public function __construct( - WC_Payments_API_Client $payments_api_client, WC_Payments_Order_Service $order_service + WC_Payments_API_Client $payments_api_client, + WC_Payments_Order_Service $order_service ) { $this->payments_api_client = $payments_api_client; $this->order_service = $order_service; diff --git a/includes/class-wc-payments-captured-event-note.php b/includes/class-wc-payments-captured-event-note.php index 40209e86927..f5b38ada258 100644 --- a/includes/class-wc-payments-captured-event-note.php +++ b/includes/class-wc-payments-captured-event-note.php @@ -390,7 +390,6 @@ private function format_fx( self::format_exchange_rate( $exchange_rate, $to_currency ), WC_Payments_Utils::format_explicit_currency( $to_display_amount, $to_currency, false ) ); - } /** @@ -410,7 +409,7 @@ private function format_exchange_rate( float $rate, string $currency ): string { [ 'decimals' => $num_decimals ] ); - $func_remove_ending_zeros = function( $str ) { + $func_remove_ending_zeros = function ( $str ) { return rtrim( $str, '0' ); }; diff --git a/includes/class-wc-payments-checkout.php b/includes/class-wc-payments-checkout.php index 360b9ac07b7..9552c0439a2 100644 --- a/includes/class-wc-payments-checkout.php +++ b/includes/class-wc-payments-checkout.php @@ -358,7 +358,7 @@ public function payment_fields() { wp_enqueue_script( 'wcpay-upe-checkout' ); add_action( 'wp_footer', - function() use ( $payment_fields ) { + function () use ( $payment_fields ) { wp_localize_script( 'wcpay-upe-checkout', 'wcpay_upe_config', $payment_fields ); } ); @@ -453,5 +453,4 @@ public function set_gateway( $payment_method_id ) { $this->gateway = $this->gateway->wc_payments_get_payment_gateway_by_id( $payment_method_id ); } } - } diff --git a/includes/class-wc-payments-db.php b/includes/class-wc-payments-db.php index 95692fab841..dc9cc0a458c 100644 --- a/includes/class-wc-payments-db.php +++ b/includes/class-wc-payments-db.php @@ -50,7 +50,7 @@ public function orders_with_charge_id_from_charge_ids( array $charge_ids ): arra ); return array_map( - function ( WC_Order $order ) : array { + function ( WC_Order $order ): array { return [ 'order' => $order, 'charge_id' => $order->get_meta( self::META_KEY_CHARGE_ID ), @@ -58,7 +58,6 @@ function ( WC_Order $order ) : array { }, $orders ); - } /** diff --git a/includes/class-wc-payments-dependency-service.php b/includes/class-wc-payments-dependency-service.php index 3934be7ebad..a976febb405 100644 --- a/includes/class-wc-payments-dependency-service.php +++ b/includes/class-wc-payments-dependency-service.php @@ -45,7 +45,6 @@ public function has_valid_dependencies() { } return empty( $this->get_invalid_dependencies( true ) ); - } /** @@ -107,7 +106,6 @@ public function get_invalid_dependencies( bool $check_account_connection = false } return $invalid_dependencies; - } /** diff --git a/includes/class-wc-payments-file-service.php b/includes/class-wc-payments-file-service.php index 784d39d0532..f8eea316d9b 100644 --- a/includes/class-wc-payments-file-service.php +++ b/includes/class-wc-payments-file-service.php @@ -29,8 +29,7 @@ class WC_Payments_File_Service { * * @return bool */ - public function is_file_public( string $purpose ) : bool { + public function is_file_public( string $purpose ): bool { return in_array( $purpose, static::FILE_PURPOSE_PUBLIC, true ); } - } diff --git a/includes/class-wc-payments-fraud-service.php b/includes/class-wc-payments-fraud-service.php index 75071acce6b..2a500e5e34a 100644 --- a/includes/class-wc-payments-fraud-service.php +++ b/includes/class-wc-payments-fraud-service.php @@ -256,7 +256,7 @@ function () { // This is OK to do since we are not accepting data entries with HTML. return WC_Payments_Utils::array_map_recursive( $fraud_services, - function( $value ) { + function ( $value ) { // Only apply `sanitize_text_field()` to string values since this function will cast to string. if ( is_string( $value ) ) { return sanitize_text_field( $value ); diff --git a/includes/class-wc-payments-incentives-service.php b/includes/class-wc-payments-incentives-service.php index 77fc841e523..692f744669e 100644 --- a/includes/class-wc-payments-incentives-service.php +++ b/includes/class-wc-payments-incentives-service.php @@ -184,7 +184,7 @@ public function fetch_connect_incentive_details(): ?array { if ( ! empty( $results ) ) { $incentive = array_filter( $results, - function( array $incentive ) { + function ( array $incentive ) { return isset( $incentive['type'] ) && 'connect_page' === $incentive['type']; } )[0] ?? []; diff --git a/includes/class-wc-payments-onboarding-service.php b/includes/class-wc-payments-onboarding-service.php index 2fd28026802..eb7da0b288c 100644 --- a/includes/class-wc-payments-onboarding-service.php +++ b/includes/class-wc-payments-onboarding-service.php @@ -259,7 +259,7 @@ public static function is_test_mode_enabled(): bool { * * @return string The source or empty string if the source is unsupported. */ - public static function get_source( string $referer, array $get_params ) : string { + public static function get_source( string $referer, array $get_params ): string { $wcpay_connect_param = sanitize_text_field( wp_unslash( $get_params['wcpay-connect'] ) ); if ( 'WCADMIN_PAYMENT_TASK' === $wcpay_connect_param ) { return self::SOURCE_WCADMIN_PAYMENT_TASK; diff --git a/includes/class-wc-payments-order-service.php b/includes/class-wc-payments-order-service.php index f5bd1c2458f..b3e45084522 100644 --- a/includes/class-wc-payments-order-service.php +++ b/includes/class-wc-payments-order-service.php @@ -476,7 +476,7 @@ function ( array $event ) { * * @throws Order_Not_Found_Exception */ - public function get_intent_id_for_order( $order ) : string { + public function get_intent_id_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::INTENT_ID_META_KEY, true ); } @@ -510,7 +510,7 @@ public function set_intent_id_for_order( $order, $intent_id ) { * * @throws Order_Not_Found_Exception */ - public function get_payment_method_id_for_order( $order ) : string { + public function get_payment_method_id_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::PAYMENT_METHOD_ID_META_KEY, true ); } @@ -575,7 +575,7 @@ public function set_payment_transaction_id_for_order( $order, $payment_transacti * * @throws Order_Not_Found_Exception */ - public function get_charge_id_for_order( $order ) : string { + public function get_charge_id_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::CHARGE_ID_META_KEY, true ); } @@ -603,7 +603,7 @@ public function set_intention_status_for_order( $order, $intention_status ) { * * @throws Order_Not_Found_Exception */ - public function get_intention_status_for_order( $order ) : string { + public function get_intention_status_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::INTENTION_STATUS_META_KEY, true ); } @@ -617,7 +617,7 @@ public function get_intention_status_for_order( $order ) : string { * * @throws Order_Not_Found_Exception */ - public function has_open_authorization( $order ) : bool { + public function has_open_authorization( $order ): bool { $order = $this->get_order( $order ); return Intent_Status::REQUIRES_CAPTURE === $order->get_meta( self::INTENTION_STATUS_META_KEY, true ); } @@ -646,7 +646,7 @@ public function set_customer_id_for_order( $order, $customer_id ) { * * @throws Order_Not_Found_Exception */ - public function get_customer_id_for_order( $order ) : string { + public function get_customer_id_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::CUSTOMER_ID_META_KEY, true ); } @@ -674,7 +674,7 @@ public function set_wcpay_intent_currency_for_order( $order, $wcpay_intent_curre * * @throws Order_Not_Found_Exception */ - public function get_wcpay_intent_currency_for_order( $order ) : string { + public function get_wcpay_intent_currency_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::WCPAY_INTENT_CURRENCY_META_KEY, true ); } @@ -716,7 +716,7 @@ public function set_wcpay_refund_transaction_id_for_order( WC_Order_Refund $orde * * @throws Order_Not_Found_Exception */ - public function get_wcpay_refund_id_for_order( $order ) : string { + public function get_wcpay_refund_id_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::WCPAY_REFUND_ID_META_KEY, true ); } @@ -744,7 +744,7 @@ public function set_wcpay_refund_status_for_order( $order, $wcpay_refund_status * * @throws Order_Not_Found_Exception */ - public function get_wcpay_refund_status_for_order( $order ) : string { + public function get_wcpay_refund_status_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::WCPAY_REFUND_STATUS_META_KEY, true ); } @@ -772,7 +772,7 @@ public function set_fraud_outcome_status_for_order( $order, $fraud_outcome_statu * * @throws Order_Not_Found_Exception */ - public function get_fraud_outcome_status_for_order( $order ) : string { + public function get_fraud_outcome_status_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::WCPAY_FRAUD_OUTCOME_STATUS_META_KEY, true ); } @@ -800,7 +800,7 @@ public function set_fraud_meta_box_type_for_order( $order, $fraud_meta_box_type * * @throws Order_Not_Found_Exception */ - public function get_fraud_meta_box_type_for_order( $order ) : string { + public function get_fraud_meta_box_type_for_order( $order ): string { $order = $this->get_order( $order ); return $order->get_meta( self::WCPAY_FRAUD_META_BOX_TYPE_META_KEY, true ); } @@ -1138,7 +1138,6 @@ public function attach_transaction_fee_to_order( $order, $charge ) { // Log the error and don't block checkout. Logger::log( 'Error saving transaction fee into metadata for the order ' . $order->get_id() . ': ' . $e->getMessage() ); } - } /** @@ -1266,7 +1265,7 @@ public function create_refund_for_order( WC_Order $order, float $amount, string ); if ( is_wp_error( $refund ) ) { - throw new Exception( $refund->get_error_message() ); + throw new Exception( esc_html( $refund->get_error_message() ) ); } return $refund; @@ -1495,7 +1494,6 @@ private function generate_capture_expired_note( $intent_id, $charge_id ) { ), WC_Payments_Utils::get_transaction_url_id( $intent_id, $charge_id ) ); - } /** @@ -1917,7 +1915,7 @@ private function get_order( $order ) { $order = $this->is_order_type_object( $order ) ? $order : wc_get_order( $order ); if ( ! $this->is_order_type_object( $order ) ) { throw new Order_Not_Found_Exception( - __( 'The requested order was not found.', 'woocommerce-payments' ), + esc_html__( 'The requested order was not found.', 'woocommerce-payments' ), 'order_not_found' ); } diff --git a/includes/class-wc-payments-session-service.php b/includes/class-wc-payments-session-service.php index 6410c684073..f4aadd68a4a 100644 --- a/includes/class-wc-payments-session-service.php +++ b/includes/class-wc-payments-session-service.php @@ -164,7 +164,7 @@ private function generate_store_id(): string { $char_length = strlen( $include_chars ); $random_string = ''; - for ( $i = 0; $i < $length; $i ++ ) { + for ( $i = 0; $i < $length; $i++ ) { $random_string .= $include_chars [ wp_rand( 0, $char_length - 1 ) ]; } diff --git a/includes/class-wc-payments-status.php b/includes/class-wc-payments-status.php index 6f3caf46c14..da480abe413 100644 --- a/includes/class-wc-payments-status.php +++ b/includes/class-wc-payments-status.php @@ -83,7 +83,8 @@ public function debug_tools( $tools ) { /** * Renders WCPay information on the status page. */ - public function render_status_report_section() { ?> + public function render_status_report_section() { + ?> @@ -98,7 +99,7 @@ public function render_status_report_section() { ?> @@ -108,7 +109,7 @@ public function render_status_report_section() { ?> @@ -116,12 +117,12 @@ public function render_status_report_section() { ?> http->is_connected() ) : ?> - + - + ?> - + - + - + @@ -150,7 +151,7 @@ public function render_status_report_section() { ?> @@ -158,7 +159,7 @@ public function render_status_report_section() { ?> - + - + - + - + gateway->get_option( 'current_protection_level' ) === 'advanced' ) : ?> - + - + - + - + - + - + diff --git a/includes/class-wc-payments-utils.php b/includes/class-wc-payments-utils.php index 83e845fc9cd..cddc49dff88 100644 --- a/includes/class-wc-payments-utils.php +++ b/includes/class-wc-payments-utils.php @@ -606,7 +606,7 @@ public static function get_filtered_error_message( Exception $e ) { * * @return int */ - public static function get_filtered_error_status_code( Exception $e ) : int { + public static function get_filtered_error_status_code( Exception $e ): int { $status_code = null; if ( $e instanceof API_Exception ) { $status_code = $e->get_http_code(); diff --git a/includes/class-wc-payments-webhook-processing-service.php b/includes/class-wc-payments-webhook-processing-service.php index 39c9d70ba78..e9806dbc395 100644 --- a/includes/class-wc-payments-webhook-processing-service.php +++ b/includes/class-wc-payments-webhook-processing-service.php @@ -142,7 +142,7 @@ public function process( array $event_body ) { if ( $this->is_webhook_mode_mismatch( $event_body ) ) { return; - }; + } try { do_action( 'woocommerce_payments_before_webhook_delivery', $event_type, $event_body ); @@ -757,7 +757,7 @@ private function get_order_from_event_body_intent_id( $event_body ) { * * @return string The failure message. */ - private function get_failure_message_from_error( $error ):string { + private function get_failure_message_from_error( $error ): string { $code = $error['code'] ?? ''; $decline_code = $error['decline_code'] ?? ''; $message = $error['message'] ?? ''; diff --git a/includes/class-wc-payments.php b/includes/class-wc-payments.php index cff5cbcd618..3d0c073fc54 100644 --- a/includes/class-wc-payments.php +++ b/includes/class-wc-payments.php @@ -1065,7 +1065,6 @@ public static function init_rest_api() { include_once WCPAY_ABSPATH . 'includes/admin/class-wc-rest-woopay-session-controller.php'; $woopay_session_controller = new WC_REST_WooPay_Session_Controller(); $woopay_session_controller->register_routes(); - } /** @@ -1388,7 +1387,7 @@ function wcpay_show_old_woocommerce_for_norway_notice() {

the plugins page.', 'woocommerce-payments' ), @@ -1866,7 +1865,7 @@ public static function wcpay_show_old_woocommerce_for_hungary_sweden_and_czech_r

get_value(); - } else { - if ( ! defined( static::class . "::$value" ) ) { + } elseif ( ! defined( static::class . "::$value" ) ) { throw new \InvalidArgumentException( "Constant with name '$value' does not exist." ); - } } $this->value = $value; diff --git a/includes/core/class-mode.php b/includes/core/class-mode.php index 721b8ea689d..f3a795678c1 100644 --- a/includes/core/class-mode.php +++ b/includes/core/class-mode.php @@ -94,7 +94,7 @@ private function maybe_init() { * @throws Exception In case the class has not been initialized yet. * @return bool */ - public function is_live() : bool { + public function is_live(): bool { $this->maybe_init(); return ! $this->test_mode && ! $this->dev_mode; } @@ -105,7 +105,7 @@ public function is_live() : bool { * @throws Exception In case the class has not been initialized yet. * @return bool */ - public function is_test() : bool { + public function is_test(): bool { $this->maybe_init(); return $this->test_mode; @@ -117,7 +117,7 @@ public function is_test() : bool { * @throws Exception In case the class has not been initialized yet. * @return bool */ - public function is_dev() : bool { + public function is_dev(): bool { $this->maybe_init(); return $this->dev_mode; } @@ -157,7 +157,7 @@ public function dev() { * * @return bool Whether `WCPAY_DEV_MODE` is defined and true. */ - protected function is_wcpay_dev_mode_defined() : bool { + protected function is_wcpay_dev_mode_defined(): bool { return( defined( 'WCPAY_DEV_MODE' ) && WCPAY_DEV_MODE diff --git a/includes/core/server/class-request.php b/includes/core/server/class-request.php index c2e83e73041..ddf1f042e8d 100644 --- a/includes/core/server/class-request.php +++ b/includes/core/server/class-request.php @@ -273,10 +273,12 @@ final public function get_params() { if ( ! empty( $missing_params ) ) { throw new Invalid_Request_Parameter_Exception( - sprintf( - 'Trying to access the parameters of a request which is not (fully) initialized yet. Missing parameter(s) for %s: %s', - get_class( $this ), - implode( ', ', $missing_params ) + esc_html( + sprintf( + 'Trying to access the parameters of a request which is not (fully) initialized yet. Missing parameter(s) for %s: %s', + get_class( $this ), + implode( ', ', $missing_params ) + ) ), 'wcpay_core_invalid_request_parameter_missing_parameters' ); @@ -305,9 +307,11 @@ final public function get_param( $key ) { return $this->params[ $key ]; } throw new Invalid_Request_Parameter_Exception( - sprintf( - 'The passed key %s does not exist in Request class', - $key + esc_html( + sprintf( + 'The passed key %s does not exist in Request class', + $key + ) ), 'wcpay_core_invalid_request_parameter_uninitialized_param' ); @@ -457,7 +461,7 @@ final public static function extend( Request $base_request ) { if ( ! $base_request->protected_mode ) { throw new Extend_Request_Exception( - get_class( $base_request ) . ' can only be extended within its ->apply_filters() method.', + esc_html( get_class( $base_request ) . ' can only be extended within its ->apply_filters() method.' ), 'wcpay_core_extend_class_incorrectly' ); } @@ -538,10 +542,12 @@ final public function apply_filters( $hook, ...$args ) { */ private function throw_immutable_exception( string $param ) { throw new Immutable_Parameter_Exception( - sprintf( - 'The value of %s::%s is immutable and cannot be changed.', - get_class( $this ), - $param + esc_html( + sprintf( + 'The value of %s::%s is immutable and cannot be changed.', + get_class( $this ), + $param + ) ), 'wcpay_core_immutable_parameter_changed' ); @@ -608,7 +614,7 @@ public static function traverse_class_constants( string $constant_name, bool $un * @return array The difference between the two arrays. */ private function array_diff( $array1, $array2 ) { - $arr_to_json = function( $item ) { + $arr_to_json = function ( $item ) { return is_array( $item ) ? wp_json_encode( $item ) : $item; }; @@ -629,7 +635,7 @@ private function array_diff( $array1, $array2 ) { protected function validate_stripe_id( $id, $prefixes = null ) { if ( empty( $id ) ) { throw new Invalid_Request_Parameter_Exception( - __( 'Empty parameter is not allowed', 'woocommerce-payments' ), + esc_html__( 'Empty parameter is not allowed', 'woocommerce-payments' ), 'wcpay_core_invalid_request_parameter_stripe_id' ); } @@ -657,10 +663,12 @@ protected function validate_stripe_id( $id, $prefixes = null ) { } throw new Invalid_Request_Parameter_Exception( - sprintf( + esc_html( + sprintf( // Translators: %s is a Stripe ID. - __( '%s is not a valid Stripe identifier', 'woocommerce-payments' ), - $id + __( '%s is not a valid Stripe identifier', 'woocommerce-payments' ), + $id + ) ), 'wcpay_core_invalid_request_parameter_stripe_id' ); @@ -680,11 +688,13 @@ protected function validate_is_larger_than( float $value_to_validate, float $val } throw new Invalid_Request_Parameter_Exception( - sprintf( + esc_html( + sprintf( /* translators: %1$s and %2$s are both numbers */ - __( 'Invalid number passed. Number %1$s needs to be larger than %2$s', 'woocommerce-payments' ), - $value_to_validate, - $value_to_compare + __( 'Invalid number passed. Number %1$s needs to be larger than %2$s', 'woocommerce-payments' ), + $value_to_validate, + $value_to_compare + ) ), 'wcpay_core_invalid_request_parameter_order' ); @@ -702,10 +712,12 @@ public function validate_currency_code( string $currency_code ) { $account_data = WC_Payments::get_account_service()->get_cached_account_data(); if ( isset( $account_data['customer_currencies']['supported'] ) && ! in_array( $currency_code, $account_data['customer_currencies']['supported'], true ) ) { throw new Invalid_Request_Parameter_Exception( - sprintf( - // Translators: %s is a currency code. - __( '%s is not a supported currency for payments.', 'woocommerce-payments' ), - $currency_code + esc_html( + sprintf( + // Translators: %s is a currency code. + __( '%s is not a supported currency for payments.', 'woocommerce-payments' ), + $currency_code + ) ), 'wcpay_core_invalid_request_parameter_currency_not_available' ); @@ -725,15 +737,16 @@ public function validate_extended_class( $child_class, string $parent_class ) { if ( ! is_subclass_of( $child_class, $parent_class ) ) { throw new Extend_Request_Exception( - sprintf( - 'Failed to extend request. %s is not a subclass of %s', - is_string( $child_class ) ? $child_class : get_class( $child_class ), - $parent_class + esc_html( + sprintf( + 'Failed to extend request. %s is not a subclass of %s', + is_string( $child_class ) ? $child_class : get_class( $child_class ), + $parent_class + ) ), 'wcpay_core_extend_class_not_subclass' ); } - } /** @@ -749,11 +762,13 @@ public function validate_date( string $date, string $format = 'Y-m-d H:i:s' ) { $d = DateTime::createFromFormat( $format, $date ); if ( ! ( $d && $d->format( $format ) === $date ) ) { throw new Invalid_Request_Parameter_Exception( - sprintf( + esc_html( + sprintf( // Translators: %1$s is a provided date string, %2$s is a date format. - __( '%1$s is not a valid date for format %2$s.', 'woocommerce-payments' ), - $date, - $format + __( '%1$s is not a valid date for format %2$s.', 'woocommerce-payments' ), + $date, + $format + ) ), 'wcpay_core_invalid_request_parameter_invalid_date' ); @@ -772,10 +787,12 @@ public function validate_redirect_url( string $redirect_url ) { $check_fallback_url = wp_generate_password( 12, false ); if ( hash_equals( $check_fallback_url, wp_validate_redirect( $redirect_url, $check_fallback_url ) ) ) { throw new Invalid_Request_Parameter_Exception( - sprintf( - // Translators: %s is a currency code. - __( '%1$s is not a valid redirect URL. Use a URL in the allowed_redirect_hosts filter.', 'woocommerce-payments' ), - $redirect_url + esc_html( + sprintf( + // Translators: %s is a currency code. + __( '%1$s is not a valid redirect URL. Use a URL in the allowed_redirect_hosts filter.', 'woocommerce-payments' ), + $redirect_url + ) ), 'wcpay_core_invalid_request_parameter_invalid_redirect_url' ); @@ -794,10 +811,12 @@ public function validate_user_name( string $user_name ) { $user = get_user_by( 'login', $user_name ); if ( false === $user ) { throw new Invalid_Request_Parameter_Exception( - sprintf( + esc_html( + sprintf( // Translators: %s is a provided username. - __( '%s is not a valid username.', 'woocommerce-payments' ), - $user_name + __( '%s is not a valid username.', 'woocommerce-payments' ), + $user_name + ) ), 'wcpay_core_invalid_request_parameter_invalid_username' ); @@ -821,6 +840,5 @@ public function validate_api_route( string $api_route ) { return; } throw new Invalid_Request_Parameter_Exception( 'Invalid request api route', 'wcpay_core_invalid_request_parameter_api_route_not_defined' ); - } } diff --git a/includes/core/server/class-response.php b/includes/core/server/class-response.php index ab56103bbe9..8357bc772be 100644 --- a/includes/core/server/class-response.php +++ b/includes/core/server/class-response.php @@ -36,7 +36,7 @@ public function __construct( array $data ) { * @param mixed $offset The key to check. * @return bool */ - public function offsetExists( $offset ) : bool { + public function offsetExists( $offset ): bool { return isset( $this->data[ $offset ] ); } diff --git a/includes/core/server/request/class-create-and-confirm-setup-intention.php b/includes/core/server/request/class-create-and-confirm-setup-intention.php index bf8831e293a..e38c581d7c4 100644 --- a/includes/core/server/request/class-create-and-confirm-setup-intention.php +++ b/includes/core/server/request/class-create-and-confirm-setup-intention.php @@ -102,7 +102,7 @@ public function set_payment_method_types( array $payment_methods ) { // Hard to validate without hardcoding a list here. if ( empty( $payment_methods ) ) { throw new Invalid_Request_Parameter_Exception( - __( 'Intentions require at least one payment method', 'woocommerce-payments' ), + esc_html__( 'Intentions require at least one payment method', 'woocommerce-payments' ), 'wcpay_core_invalid_request_parameter_missing_payment_method_types' ); } @@ -119,7 +119,6 @@ public function set_payment_method_types( array $payment_methods ) { */ public function set_mandate_data( array $mandate_data ) { $this->set_param( 'mandate_data', $mandate_data ); - } /** diff --git a/includes/core/server/request/class-generic.php b/includes/core/server/request/class-generic.php index 9e6b51ea8c5..36543990864 100644 --- a/includes/core/server/request/class-generic.php +++ b/includes/core/server/request/class-generic.php @@ -71,8 +71,6 @@ public function __construct( string $api, string $method, array $parameters = nu $this->set( $key, $value ); } } - - return $this; } /** diff --git a/includes/core/server/request/class-list-disputes.php b/includes/core/server/request/class-list-disputes.php index 94790e06d8e..87519aa4abb 100644 --- a/includes/core/server/request/class-list-disputes.php +++ b/includes/core/server/request/class-list-disputes.php @@ -192,7 +192,4 @@ public function format_response( $response ) { return new Response( $response ); } - - - } diff --git a/includes/core/server/request/class-list-fraud-outcome-transactions.php b/includes/core/server/request/class-list-fraud-outcome-transactions.php index 4e15c21cf5f..d7d3770c7c5 100644 --- a/includes/core/server/request/class-list-fraud-outcome-transactions.php +++ b/includes/core/server/request/class-list-fraud-outcome-transactions.php @@ -232,7 +232,7 @@ private function get_search_result( $found, $term, $outcome ) { // Search by order id. if ( preg_match( '/#(\d+)/', $term, $matches ) ) { return $matches[1] === (string) $outcome['order_id']; - }; + } // Search by customer name. return (bool) preg_match( "/{$term}/i", $outcome['customer_name'] ); @@ -260,11 +260,11 @@ private function get_sort_result( $a, $b, $sort, $direction ) { if ( $a === $b ) { return 0; - }; + } if ( 'desc' === $direction ) { return $a < $b ? 1 : -1; - }; + } return $a < $b ? -1 : 1; } diff --git a/includes/core/server/request/class-list-transactions.php b/includes/core/server/request/class-list-transactions.php index baaa0154a92..4a2b998622e 100644 --- a/includes/core/server/request/class-list-transactions.php +++ b/includes/core/server/request/class-list-transactions.php @@ -19,7 +19,8 @@ */ class List_Transactions extends Paginated { - use Date_Parameters, Order_Info; + use Date_Parameters; + use Order_Info; const DEFAULT_PARAMS = [ 'sort' => 'date', @@ -309,5 +310,4 @@ public function format_response( $response ) { return new Response( $response ); } - } diff --git a/includes/core/server/request/class-request-utils.php b/includes/core/server/request/class-request-utils.php index 0090ad7ec90..aff6f59436d 100644 --- a/includes/core/server/request/class-request-utils.php +++ b/includes/core/server/request/class-request-utils.php @@ -46,5 +46,4 @@ public static function format_transaction_date_by_timezone( $transaction_date, $ return $formatted_date->format( 'Y-m-d H:i:s' ); } - } diff --git a/includes/core/server/request/class-woopay-create-and-confirm-intention.php b/includes/core/server/request/class-woopay-create-and-confirm-intention.php index 587f79b5b19..f1bdb75f9f2 100644 --- a/includes/core/server/request/class-woopay-create-and-confirm-intention.php +++ b/includes/core/server/request/class-woopay-create-and-confirm-intention.php @@ -43,5 +43,4 @@ public function set_has_woopay_subscription( $has = true ) { public function set_save_payment_method_to_platform( $save = true ) { $this->set_param( 'save_payment_method_to_platform', $save ); } - } diff --git a/includes/core/server/request/class-woopay-create-and-confirm-setup-intention.php b/includes/core/server/request/class-woopay-create-and-confirm-setup-intention.php index 350eb2103ac..eb04ecfdbe8 100644 --- a/includes/core/server/request/class-woopay-create-and-confirm-setup-intention.php +++ b/includes/core/server/request/class-woopay-create-and-confirm-setup-intention.php @@ -43,5 +43,4 @@ public function set_save_in_platform_account( $save = true ) { public function set_save_payment_method_to_platform( $save = true ) { $this->set_param( 'save_payment_method_to_platform', $save ); } - } diff --git a/includes/core/server/request/trait-date-parameters.php b/includes/core/server/request/trait-date-parameters.php index d933279c176..2565ecc8eef 100644 --- a/includes/core/server/request/trait-date-parameters.php +++ b/includes/core/server/request/trait-date-parameters.php @@ -59,5 +59,3 @@ public function set_date_between( array $date_between ) { } } } - - diff --git a/includes/core/server/request/trait-order-info.php b/includes/core/server/request/trait-order-info.php index 30f8b6cd9be..837e75cc7d2 100644 --- a/includes/core/server/request/trait-order-info.php +++ b/includes/core/server/request/trait-order-info.php @@ -65,5 +65,3 @@ private function get_customer_url( WC_Order $order ) { ); } } - - diff --git a/includes/core/service/class-wc-payments-customer-service-api.php b/includes/core/service/class-wc-payments-customer-service-api.php index 8431fcd18d5..b8d70deea58 100644 --- a/includes/core/service/class-wc-payments-customer-service-api.php +++ b/includes/core/service/class-wc-payments-customer-service-api.php @@ -10,8 +10,8 @@ use WCPay\Exceptions\API_Exception; use WC_Payments_Customer_Service; use WP_User; -use \WC_Customer; -use \WC_Order; +use WC_Customer; +use WC_Order; defined( 'ABSPATH' ) || exit; diff --git a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php index 50b7694c091..6a16348b260 100644 --- a/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php +++ b/includes/express-checkout/class-wc-payments-express-checkout-button-display-handler.php @@ -159,7 +159,7 @@ public function add_pay_for_order_params_to_js_config() { if ( isset( $_GET['pay_for_order'] ) && isset( $_GET['key'] ) && current_user_can( 'pay_for_order', $order_id ) ) { add_filter( 'wcpay_payment_fields_js_config', - function( $js_config ) use ( $order ) { + function ( $js_config ) use ( $order ) { $session = wc()->session; $session_email = ''; diff --git a/includes/fraud-prevention/class-fraud-risk-tools.php b/includes/fraud-prevention/class-fraud-risk-tools.php index 9b116ae980e..27cf2dc8154 100644 --- a/includes/fraud-prevention/class-fraud-risk-tools.php +++ b/includes/fraud-prevention/class-fraud-risk-tools.php @@ -7,8 +7,8 @@ namespace WCPay\Fraud_Prevention; -require_once dirname( __FILE__ ) . '/models/class-check.php'; -require_once dirname( __FILE__ ) . '/models/class-rule.php'; +require_once __DIR__ . '/models/class-check.php'; +require_once __DIR__ . '/models/class-rule.php'; use WC_Payments; use WC_Payments_Account; diff --git a/includes/fraud-prevention/models/class-check.php b/includes/fraud-prevention/models/class-check.php index ae463ba2239..39e2a557c1e 100644 --- a/includes/fraud-prevention/models/class-check.php +++ b/includes/fraud-prevention/models/class-check.php @@ -161,7 +161,7 @@ public static function list( string $operator, array $checks ) { if ( 0 < count( array_filter( $checks, - function( $check ) { + function ( $check ) { return ! ( $check instanceof Check ); } ) ) ) { @@ -207,7 +207,7 @@ public function to_array() { return [ 'operator' => $this->operator, 'checks' => array_map( - function( Check $check ) { + function ( Check $check ) { return $check->to_array(); }, $this->checks diff --git a/includes/in-person-payments/class-wc-payments-in-person-payments-receipts-service.php b/includes/in-person-payments/class-wc-payments-in-person-payments-receipts-service.php index af9d4d3b2e6..f24261a038a 100644 --- a/includes/in-person-payments/class-wc-payments-in-person-payments-receipts-service.php +++ b/includes/in-person-payments/class-wc-payments-in-person-payments-receipts-service.php @@ -21,7 +21,7 @@ class WC_Payments_In_Person_Payments_Receipts_Service { * * @return string */ - public function get_receipt_markup( array $settings, WC_Order $order, array $charge ) :string { + public function get_receipt_markup( array $settings, WC_Order $order, array $charge ): string { $this->validate_settings( $settings ); $this->validate_charge( $charge ); @@ -90,7 +90,7 @@ public function send_customer_ipp_receipt_email( WC_Order $order, array $merchan * @param array $order the order. * @return array */ - private function format_line_items( array $order ) :array { + private function format_line_items( array $order ): array { $line_items_data = []; foreach ( $order['line_items'] as $item ) { @@ -152,7 +152,6 @@ private function validate_charge( array $charge ) { $charge['payment_method_details']['card_present']['receipt'], 'Error validating receipt information' ); - } /** @@ -167,7 +166,7 @@ private function validate_charge( array $charge ) { private function validate_required_fields( array $required_fields, array $data, string $message ) { foreach ( $required_fields as $required_key ) { if ( ! array_key_exists( $required_key, $data ) ) { - throw new \RuntimeException( sprintf( '%s. Missing key: %s', $message, $required_key ) ); + throw new \RuntimeException( esc_html( sprintf( '%s. Missing key: %s', $message, $required_key ) ) ); } } } diff --git a/includes/in-person-payments/class-wc-payments-printed-receipt-sample-order.php b/includes/in-person-payments/class-wc-payments-printed-receipt-sample-order.php index f0a9a501ffa..33ec20f3a75 100644 --- a/includes/in-person-payments/class-wc-payments-printed-receipt-sample-order.php +++ b/includes/in-person-payments/class-wc-payments-printed-receipt-sample-order.php @@ -73,5 +73,4 @@ public function __construct() { public function get_data(): array { return self::PREVIEW_RECEIPT_ORDER_DATA; } - } diff --git a/includes/in-person-payments/templates/html-in-person-payment-receipt.php b/includes/in-person-payments/templates/html-in-person-payment-receipt.php index 1b370b05e5e..e575e52fd03 100644 --- a/includes/in-person-payments/templates/html-in-person-payment-receipt.php +++ b/includes/in-person-payments/templates/html-in-person-payment-receipt.php @@ -129,7 +129,7 @@ function format_price_helper( array $product, string $currency ): string {

-

+


@@ -140,7 +140,7 @@ function format_price_helper( array $product, string $currency ): string { @@ -157,7 +157,7 @@ function format_price_helper( array $product, string $currency ): string { @@ -211,9 +211,9 @@ function format_price_helper( array $product, string $currency ): string {
-

-

-

+

+

+

diff --git a/includes/migrations/class-allowed-payment-request-button-sizes-update.php b/includes/migrations/class-allowed-payment-request-button-sizes-update.php index 4be05fa2bf2..629d1114356 100644 --- a/includes/migrations/class-allowed-payment-request-button-sizes-update.php +++ b/includes/migrations/class-allowed-payment-request-button-sizes-update.php @@ -64,6 +64,5 @@ private function migrate() { 'small' ); } - } } diff --git a/includes/migrations/class-update-service-data-from-server.php b/includes/migrations/class-update-service-data-from-server.php index 10ecb0e5d9f..f674018619e 100644 --- a/includes/migrations/class-update-service-data-from-server.php +++ b/includes/migrations/class-update-service-data-from-server.php @@ -62,5 +62,4 @@ public function maybe_migrate() { private function migrate() { $this->account->refresh_account_data(); } - } diff --git a/includes/multi-currency/Compatibility/WooCommerceNameYourPrice.php b/includes/multi-currency/Compatibility/WooCommerceNameYourPrice.php index c716e985acc..0095bc70559 100644 --- a/includes/multi-currency/Compatibility/WooCommerceNameYourPrice.php +++ b/includes/multi-currency/Compatibility/WooCommerceNameYourPrice.php @@ -106,7 +106,6 @@ public function convert_cart_currency( $cart_item, $values ) { } return $cart_item; - } /** diff --git a/includes/multi-currency/Currency.php b/includes/multi-currency/Currency.php index 238281a2049..23050339271 100644 --- a/includes/multi-currency/Currency.php +++ b/includes/multi-currency/Currency.php @@ -188,7 +188,7 @@ public function get_symbol(): string { * * @return string Currency position (left/right). */ - public function get_symbol_position() : string { + public function get_symbol_position(): string { $localization_service = new WC_Payments_Localization_Service(); return $localization_service->get_currency_format( $this->code )['currency_pos']; } diff --git a/includes/multi-currency/MultiCurrency.php b/includes/multi-currency/MultiCurrency.php index 6b95ea66778..5a5c8662662 100644 --- a/includes/multi-currency/MultiCurrency.php +++ b/includes/multi-currency/MultiCurrency.php @@ -412,7 +412,7 @@ public function get_cached_currencies() { return $this->database_cache->get_or_add( Database_Cache::CURRENCIES_KEY, - function() { + function () { try { $currency_data = $this->payments_api_client->get_currency_rates( strtolower( get_woocommerce_currency() ) ); return [ @@ -646,7 +646,7 @@ private function initialize_enabled_currencies() { // This allows to keep the alphabetical sorting by name. $enabled_currencies = array_filter( $available_currencies, - function( $currency ) use ( $enabled_currency_codes ) { + function ( $currency ) use ( $enabled_currency_codes ) { return in_array( $currency->get_code(), $enabled_currency_codes, true ); } ); @@ -1407,7 +1407,7 @@ private function simulate_client_currency() { // Simulate client currency from geolocation. add_filter( 'wcpay_multi_currency_override_notice_currency_name', - function( $selected_currency_name ) use ( $simulation_currency_name ) { + function ( $selected_currency_name ) use ( $simulation_currency_name ) { return $simulation_currency_name; } ); @@ -1415,7 +1415,7 @@ function( $selected_currency_name ) use ( $simulation_currency_name ) { // Simulate client country from geolocation. add_filter( 'wcpay_multi_currency_override_notice_country', - function( $selected_country ) use ( $simulation_country ) { + function ( $selected_country ) use ( $simulation_country ) { return $simulation_country; } ); @@ -1427,7 +1427,6 @@ function( $selected_country ) use ( $simulation_country ) { // Skip recalculating the cart to prevent infinite loop in simulation. remove_action( 'wp_loaded', [ $this, 'recalculate_cart' ] ); - } /** @@ -1500,7 +1499,7 @@ private function add_simulation_params_to_preview_urls() { $params = $this->simulation_params; add_filter( 'wp_footer', - function() use ( $params ) { + function () use ( $params ) { ?>
http->is_connected() ? esc_html__( 'Yes', 'woocommerce-payments' ) : ' ' . esc_html__( 'No', 'woocommerce-payments' ) . ''; ?>
: http->is_connected() ? $this->http->get_blog_id() : '-' ); ?>
: gateway->is_connected() ? esc_html( $this->account->get_stripe_account_id() ?? '-' ) : ' ' . esc_html__( 'Not connected', 'woocommerce-payments' ) . ''; ?>
: gateway->needs_setup() ? ' ' . esc_html__( 'Needs setup', 'woocommerce-payments' ) . '' : ( $this->gateway->is_enabled() ? esc_html__( 'Enabled', 'woocommerce-payments' ) : esc_html__( 'Disabled', 'woocommerce-payments' ) ); ?>
: is_test() ? esc_html_e( 'Enabled', 'woocommerce-payments' ) : esc_html_e( 'Disabled', 'woocommerce-payments' ); ?>
: gateway->get_upe_enabled_payment_method_ids() ) ); ?>
: gateway->get_option( 'platform_checkout_button_locations', [] ); @@ -169,14 +170,14 @@ public function render_status_report_section() { ?>
:
: gateway->get_option( 'payment_request' ); @@ -188,20 +189,20 @@ public function render_status_report_section() { ?>
: gateway->get_option( 'current_protection_level' ) ); ?>
: gateway->get_option( 'advanced_fraud_protection_settings' ) ), true ); $list = array_filter( array_map( - function( $rule ) { + function ( $rule ) { if ( empty( $rule['key'] ) ) { return null; } @@ -236,29 +237,29 @@ function( $rule ) {
:
:
:
:
:
@
-
+
$order['currency'] ] ), 'post' ); ?>
-
+
$order['currency'] ] ), 'post' ); ?>