rector
rector copied to clipboard
Incorrect behavior of SwapFuncCallArgumentsRector, RenameFunctionRector
Bug Report
Hi, I'm expecting here that mysql_query gets renamed mysqli_query and the parameters swapped. However all that's happening is the first parameter is deleted and the function isn't renamed. Unsure if I've maybe configured this incorrectly?
config is as follows (am using the demo):
`use Rector\Config\RectorConfig; use Rector\Php74\Rector\Property\TypedPropertyRector; use Rector\Set\ValueObject\SetList; use MysqlQueryMysqlErrorWithLinkRector;
return static function (RectorConfig $rectorConfig): void { // A. run whole set $rectorConfig->sets([ SetList::MYSQL_TO_MYSQLI, ]);
// B. or single rule
$rectorConfig->rule(TypedPropertyRector::class);
};`
| Subject | Details |
|---|---|
| Rector version | last dev-main |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/e9378e6a-04dc-4ec5-9a47-58f744372868
<?php
$sql_delivery_method = "SELECT * FROM DeliveryMethod";
$query_delivery_method = mysql_query($sql_delivery_method, conn());
$rownum_delivery_method = mysql_num_rows($query_delivery_method);
$row_delivery_method = mysql_fetch_array($query_delivery_method);
for ($i = 0; $i < $rownum_delivery_method; $i++) {
echo "_delivery_method[" . $i . "] = new Array('" . $row_delivery_method['enquiry_delivery_no'] . "','" . $row_delivery_method['enquiry_delivery'] . "')\n";
$row_delivery_method = mysql_fetch_array($query_delivery_method);
}
Responsible rules
-
SwapFuncCallArgumentsRector -
RenameFunctionRector