Bug Report
Description
Running the SDK on PHP 8.x produces a fatal error at class load time due to a property type
declaration mismatch between TransactionBuilder and ManagementBuilder.
TransactionBuilder declares $paymentMethod with no type:
// src/Builders/TransactionBuilder.php:32
public $paymentMethod = null;
ManagementBuilder then redeclares the same property with the mixed type:
// src/Builders/ManagementBuilder.php:159
public mixed $paymentMethod = null;
PHP 8.0+ enforces that a child class cannot add a type where the parent had none — even
mixed counts as a type declaration. This causes a fatal error before any SDK code runs.
Error Message
PHP Fatal error: Type of GlobalPayments\Api\Builders\ManagementBuilder::$paymentMethod
must not be defined (as in class GlobalPayments\Api\Builders\TransactionBuilder)
in src/Builders/ManagementBuilder.php on line 29
Environment
- PHP version: 8.3.30
- globalpayments/php-sdk version: 14.1.12
Steps to Reproduce
Simply boot any application that loads the SDK — the error occurs on class load,
before any payment method is called.
Expected Behaviour
SDK loads without error on PHP 8.x.
Actual Behaviour
Fatal error on startup.
Fix
There are two equivalent options:
Option A (recommended): Add mixed to the parent property in TransactionBuilder
to match what the child already declares:
// src/Builders/TransactionBuilder.php
// Before:
public $paymentMethod = null;
// After:
public mixed $paymentMethod = null;
Note that $transactionType on the same class is already correctly declared as mixed
(line 24), so this change makes $paymentMethod consistent with the existing pattern.
Option B: Remove the mixed type from ManagementBuilder to match the parent's
untyped declaration:
// src/Builders/ManagementBuilder.php
// Before:
public mixed $paymentMethod = null;
// After:
public $paymentMethod = null;
Option A is preferred because it keeps the explicit mixed annotation and is consistent
with how $transactionType is already declared in TransactionBuilder.
Bug Report
Description
Running the SDK on PHP 8.x produces a fatal error at class load time due to a property type
declaration mismatch between
TransactionBuilderandManagementBuilder.TransactionBuilderdeclares$paymentMethodwith no type: