aldas / modbus-tcp-client

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

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

Closed leoshtika closed 1 year ago

leoshtika commented 1 year 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: