escpos-tools icon indicating copy to clipboard operation
escpos-tools copied to clipboard

Update to PHP 8.0

Open farktronix opened this issue 2 years ago • 2 comments

When running esc2html with PHP v8.2.9 on MacOS I got some warnings and errors:

PHP Deprecated:  Using ${var} in strings is deprecated, use {$var} instead in /Users/pharkas/code/escpos-tools/esc2html.php on line 104
PHP Fatal error:  Uncaught TypeError: implode(): Argument #1 ($separator) must be of type string, array given in /Users/pharkas/code/escpos-tools/esc2html.php:63

It looks like the old implode(array $array, string $separator): string API was removed in PHP 8.0.0, but the fix is simple- just swap the arguments. I also fixed the warning about ${var} in strings being deprecated.

I ran a code style check with php vendor/bin/phpcs --standard=psr2 src/ -n but got an error because php_codesniffer was out of date, so I bumped it up to ^3.0

farktronix avatar Aug 21 '23 18:08 farktronix

Reviewd it works well, thank you. Someone should really merge that.

michi-s avatar Apr 28 '24 21:04 michi-s

I can also add/confirm that this allowed me to use esc2html with PHP 8.0.

jayaddison avatar May 04 '24 16:05 jayaddison