Bug Report
Hello!
This rule is breaking the code by replacing a legitimate typed parameter with garbage.
| Subject |
Details |
| Rector version |
last dev-main |
| Installed as |
composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.com/demo/557185d8-0255-4ce0-8388-8015527140fe
<?php
interface ConnectionInterface {}
class Connection extends ConnectionInterface
{
public function getSchemaState(): array
{
return [];
}
}
class SqlServerConnection extends ConnectionInterface {}
interface ConnectionResolverInterface
{
/**
* @param string|null $name
* @return ConnectionInterface
*/
public function connection($name = null);
}
final class DemoFile
{
public function __invoke(ConnectionResolverInterface $resolver): void
{
$connection = $resolver->connection();
if (
$connection instanceof SqlServerConnection
|| ! method_exists($connection, 'getSchemaState')
) {
return;
}
$this->ensureCleanDatabase($connection);
}
private function ensureCleanDatabase(ConnectionInterface $connection): void
{
}
}
Responsible rules
AddMethodCallBasedStrictParamTypeRector
Expected Behavior
The signature should not be changed.
Thanks!
Bug Report
Hello!
This rule is breaking the code by replacing a legitimate typed parameter with garbage.
Minimal PHP Code Causing Issue
See https://getrector.com/demo/557185d8-0255-4ce0-8388-8015527140fe
Responsible rules
AddMethodCallBasedStrictParamTypeRectorExpected Behavior
The signature should not be changed.
Thanks!