rector
rector copied to clipboard
RemoveExtraParametersRector removes all parameters
Bug Report
| Subject | Details |
|---|---|
| Rector version | v1.2.4 |
The RemoveExtraParametersRector removes the mandatory parameter.
Minimal PHP Code Causing Issue
INPUT
$query = $xtf0FDatabaseDriver->getQuery(true);
$query->select('extension_id')
->from('#__extensions')
->where($xtf0FDatabaseDriver->qn('type').' = '.$xtf0FDatabaseDriver->q('component'))
->where($xtf0FDatabaseDriver->qn('element').' = '.$xtf0FDatabaseDriver->q($this->componentName));
$xtf0FDatabaseDriver->setQuery($query);
qn is an alias of quoteName defined via a magic method. public function __call($name, array $arguments) calls
public function quoteName($name, $as = null)
OUTPUT
$xtf0FDatabaseDriver = XTF0FPlatform::getInstance()->getDbo();
$query = $xtf0FDatabaseDriver->getQuery(true);
$query->select('extension_id')
->from('#__extensions')
->where($xtf0FDatabaseDriver->qn().' = '.$xtf0FDatabaseDriver->q())
->where($xtf0FDatabaseDriver->qn().' = '.$xtf0FDatabaseDriver->q());
$xtf0FDatabaseDriver->setQuery($query);
I tried to create the isolated test case, but it didn't produce the same result.
Expected Behaviour
Rector shouldn't drop the required parameters.
That's usually due to some autoload not setup properly, ensure it setup properly, and it will works as is, see https://getrector.com/documentation/static-reflection-and-autoload
closing as answered and needs reproducible code/config to make a fix.