Closed samsonasik closed 1 year ago
It seems stuck on RemoveUnusedVariableAssignRector
:
[file] system/Images/Handlers/GDHandler.php
[rule] Rector\CodeQuality\Rector\FuncCall\ChangeArrayPushToArrayAssignRector
--- consumed 0 B, total 198.5 MB, took 0.00 s
[file] system/Images/Handlers/GDHandler.php
[rule] Rector\DeadCode\Rector\Assign\RemoveUnusedVariableAssignRector
It seems due 2 rules combined:
$rectorConfig->rule(RemoveUnusedVariableAssignRector::class);
$rectorConfig->rule(SimplifyIfElseToTernaryRector::class);
with namespaced class:
<?php
namespace CodeIgniter\Images\Handlers;
class GDHandler
{
protected function _flatten(int $red = 255, int $green = 255, int $blue = 255)
{
$srcImg = $this->createImage();
if (function_exists('imagecreatetruecolor')) {
$create = 'imagecreatetruecolor';
$copy = 'imagecopyresampled';
} else {
$create = 'imagecreate';
$copy = 'imagecopyresized';
}
$dest = $create($this->width, $this->height);
$matte = imagecolorallocate($dest, $red, $green, $blue);
imagefilledrectangle($dest, 0, 0, $this->width, $this->height, $matte);
imagecopy($dest, $srcImg, 0, 0, 0, 0, $this->width, $this->height);
// Kill the file handles
imagedestroy($srcImg);
$this->resource = $dest;
return $this;
}
}
Ref https://getrector.com/demo/14526a95-140e-49dc-99c1-c53c2c8b25e1
Bug Report
Minimal PHP Code Causing Issue
Tested in
CodeIgniter 4
project system directory, stuck on 99%:Expected Behaviour
It should not stack, I will look into it.