driade / phpfmt8

PHP formatter for Sublime Text 4, with PHP 8 support.
BSD 3-Clause "New" or "Revised" License
46 stars 2 forks source link

phpfmt destroys this code #74

Closed giopk closed 5 months ago

giopk commented 5 months ago
function hexToRgb($hex) {
    $length = strlen($hex);
    $rgb[] = hexdec(($length == 6) ? substr($hex, 0, 2) : (($length == 3) ? str_repeat(substr($hex, 0, 1), 2) : 0));
    $rgb[] = hexdec(($length == 6) ? substr($hex, 2, 2) : (($length == 3) ? str_repeat(substr($hex, 1, 1), 2) : 0));
    $rgb[] = hexdec(($length == 6) ? substr($hex, 4, 2) : (($length == 3) ? str_repeat(substr($hex, 2, 1), 2) : 0));
    return $rgb;
}

class MYPDF extends TCPDF
{
}

becomes

function hexToRgb1($hex)
{
    $length = strlen($hex);
    $rgb[] = hexdec(($length == 6)  substr(? $hex, 0, 2) : (($length == 3)  str_repeat(substr(? $hex, 0, 1), 2) : 0));
    $rgb[] = hexdec(($length == 6)  substr(? $hex, 2, 2) : (($length == 3)  str_repeat(substr(? $hex, 1, 1), 2) : 0));
    $rgb[] = hexdec(($length == 6)  substr(? $hex, 4, 2) : (($length == 3)  str_repeat(substr(? $hex, 2, 1), 2) : 0));
    return $rgb;
}

class MYPDF extends TCPDF
{
}

But only when it's followed by a class declaration, otherwhise it works fine.

driade commented 5 months ago

Thanks @giopk , I'll check it

driade commented 5 months ago

Hi, this you be fixed in the latest release. Thanks!

giopk commented 5 months ago

Hi David, Thanks a lot! That was super fast! Ciao, Gio

Il Lun 25 Mar 2024, 22:47 David Fernández @.***> ha scritto:

Hi, this you be fixed in the latest release. Thanks!

— Reply to this email directly, view it on GitHub https://github.com/driade/phpfmt8/issues/74#issuecomment-2018976130, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQOM2GQSQHN2ZJ5AXX7KQ3Y2CLP7AVCNFSM6AAAAABFG6GYB2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJYHE3TMMJTGA . You are receiving this because you were mentioned.Message ID: @.***>