verze-app / solana-php-sdk

Simple PHP SDK for Solana JSON RPC endpoints
MIT License
88 stars 45 forks source link

Fix "Return value of Tighten\SolanaPhpSdk\Program::__call() must be of the type array or null, int returned" #18

Closed miguilimzero closed 2 years ago

miguilimzero commented 2 years ago

If we try to use this code to get the current block value from node, we get error Return value of Tighten\SolanaPhpSdk\Program::__call() must be of the type array or null, int returned.

$client = new Connection(new SolanaRpcClient('api.mainnet-beta.solana.com'));
var_dump($client->getBlockHeight());

This occurr because the magic method expects the result to be an array or null, but int and strings can be returned as well depending on the RPC method called.

mattstauffer commented 2 years ago

Thanks @srdante!