pronamic / wp-mollie

Mollie API client for WordPress.
GNU General Public License v2.0
2 stars 0 forks source link

PHP 8.2: Dynamic Properties are deprecated #4

Closed remcotolsma closed 11 months ago

remcotolsma commented 1 year ago

https://php.watch/versions/8.2/dynamic-properties-deprecated

https://github.com/pronamic/wp-mollie/blob/a6e16581d7f64f6be5d823ad8c07cae00d121c95/src/PaymentDetails.php#L25-L39

remcotolsma commented 11 months ago

Related to:

Payment method-specific response parameters If the payment has been created with a method, or if the customer selected a method in the payment method selection screen, a details object becomes available on the payment object. This object contains detail fields specific to the selected payment method.

Source: https://docs.mollie.com/reference/v2/payments-api/get-payment

Scherm­afbeelding 2023-09-29 om 14 08 29

We use the details for example in:

https://github.com/pronamic/wp-pronamic-pay-mollie/blob/918d67d6cac1fd7e72fd122e2378718ec4d477ff/src/Gateway.php#L1267-L1363

Payment details class could extend https://github.com/pronamic/wp-mollie/blob/192e04ade34b0725b0f741187be22e955494ad82/src/ObjectAccess.php to make it easy and flexibel.

Other option is to introduce different classes for each method PaymentDetailsIDeal, PaymentDetailsBancontact, etc. How to improve?

rvdsteege commented 11 months ago

Discussed at HQ and decided on extending ObjectAccess.