Current Behaviour
Rector works for Mautic!!! 🎉 I tried to run Rector on AssetBundle and noticed following removed lines which I don't think is correct.
We use a static method to convert upload size to bytes in Mautic, but it was borrowed from Symfony:
Rector suggests to remove these lines:
switch (strtolower(substr($size, -1))) {
case 't':
- $max *= 1024;
// no break
case 'g':
- $max *= 1024;
// no break
case 'm':
- $max *= 1024;
// no break
case 'k':
$max *= 1024;
----------- end diff -----------
Minimal PHP Code Causing Issue
<?php declare(strict_types=1);
final class DemoFile
{
public static function convertSizeToBytes($size)
{
if ('' === $size) {
return PHP_INT_MAX;
}
$max = ltrim($size, '+');
if (0 === strpos($max, '0x')) {
$max = intval($max, 16);
} elseif (0 === strpos($max, '0')) {
$max = intval($max, 8);
} else {
$max = intval($max);
}
switch (strtolower(substr($size, -1))) {
case 't':
$max *= 1024;
// no break
case 'g':
$max *= 1024;
// no break
case 'm':
$max *= 1024;
// no break
case 'k':
$max *= 1024;
}
return $max;
}
}
Expected Behaviour
I don't think it should remove the lines.
mautic (3.x) $ bin/rector process app/bundles/AssetBundle --set dead-code --dry-run1Current Behaviour
Rector works for Mautic!!! 🎉 I tried to run Rector on AssetBundle and noticed following removed lines which I don't think is correct.
We use a static method to convert upload size to bytes in Mautic, but it was borrowed from Symfony:
Rector suggests to remove these lines:
Minimal PHP Code Causing Issue
Expected Behaviour
I don't think it should remove the lines.