I'm using this Composer package for a development that requires the functionality this package provides. Looking for alternatives, I found out that this is my best bet, as the available alternatives are way too barebones to be implemented in the time constraints I'm dealing with.
Now, I've tested it in a local machine running PHP 5.5 (on Linux Subsystem for Windows 10), on a personal server running PHP 5.6, but the production server is running PHP 5.4, which can't be upgraded because of reasons.
First I had this error:
Parse error: syntax error, unexpected 'class' (t_class), expecting identifier (t_string) in …
Looking for solutions I hit this question, so I went to the package code and found the following snippet:
protected static $classmap = [
'getTransactionResult' => getTransactionResult::class,
'getTransactionResultResponse' => getTransactionResultResponse::class,
'transactionResultOutput' => transactionResultOutput::class,
'cardDetail' => cardDetail::class,
'wsTransactionDetailOutput' => wsTransactionDetailOutput::class,
'wsTransactionDetail' => wsTransactionDetail::class,
'acknowledgeTransaction' => acknowledgeTransaction::class,
'acknowledgeTransactionResponse' => acknowledgeTransactionResponse::class,
'initTransaction' => initTransaction::class,
'wsInitTransactionInput' => wsInitTransactionInput::class,
'wpmDetailInput' => wpmDetailInput::class,
'initTransactionResponse' => initTransactionResponse::class,
'wsInitTransactionOutput' => wsInitTransactionOutput::class
];
I find out that the ::class
definition is not compatible with PHP 5.4, and while attempting to do what the answer to the question suggested, I had the results in this commentary to that answer.
Now, so far I've commented the lines with issues (both are array
s containing these ::class
definitions), tested on the production server, and works so far. But I want to know if there's an actual replacement for this ::class
definition.
Important note: The examples I've seen on the web talk about get_class('ClassName')
referring to ClassName::class
, but not about classMethod::class
cases. I've also ran into this question, but the example provided in the answer doesn't give me a clue of how to use it.