aldas / modbus-tcp-client

PHP client for Modbus TCP and Modbus RTU over TCP (can be used for serial)
Apache License 2.0
191 stars 55 forks source link

Fix deprecated ${} string interpolation for PHP8.2 #152

Closed leoshtika closed 11 months ago

leoshtika commented 11 months ago

Hi everyone!

After updating to PHP8.2, when running for example ReadRegistersBuilder::newReadHoldingRegisters()->allFromArray($requests)->build(); I am getting a PHP Deprecated Warning 'ErrorException' with message 'Using ${var} in strings is deprecated, use {$var} instead'

I discovered that ${} string interpolation was deprecated in PHP8.2 https://www.php.net/releases/8.2/en.php#deprecations_and_bc_breaks

I will upload a patch that fixes this problem shortly!

Environment: