-
-
Notifications
You must be signed in to change notification settings - Fork 739
Closed
Closed
Copy link
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | last dev-master |
| Installed as | composer dependency |
Minimal PHP Code Causing Issue
See https://getrector.org/demo/fa9b69b8-58ba-4f8c-b06b-ff59b18f795c
<?php
interface ValueAccessor
{
public function & accessValue($object, $memberName);
}
final class DemoFile implements ValueAccessor
{
public function & accessValue($object, $memberName)
{
$value = count($object);
return $value;
}
}NB: I am completely aware that return-by-ref and param-by-ref is a snake pit and that this kind of code should be abolished. Dealing with legacy code here.
Responsible rules
SimplifyUselessVariableRector
Expected Behavior
return by ref must return a var or use a function that returns by-ref. count() does not return by-ref. If the change is applied this will result in PHP warnings: https://3v4l.org/f8GDO
Rector should skip this kind of return statements for simplifying.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels