Skip to content

"Only variables should be passed by reference" with DowngradeTrailingCommasInFunctionCallsRector #7969

Description

@leoloso

I'm using getrector.org/demo to create an issue with DowngradeTrailingCommasInFunctionCallsRector, and somehow, with any simple test case including sprintf the output produces an error:

{ "totals": { "changed_files": 0, "removed_and_added_files_count": 0, "removed_node_count": 0, "errors": 1 }, "errors": [ { "message": "System error: \"Only variables should be passed by reference\"\nRun Rector with \"--debug\" option and post the report here: https://github.com/rectorphp/rector/issues/new", "file": "/var/www/src/../storage/demo/ffsb1tn8xhkhjl4qruvy/rector_analyzed_file.php", "line": 71 } ] } 

Check: https://getrector.com/demo/e60bf8e6-ff43-49f1-92c4-11d53ed03089

Test code:

<?php

final class DemoFile
{
    public function run()
    {
        return sprintf("%s", "1");
    }
}

config:

<?php

use Rector\Config\RectorConfig;
use Rector\DowngradePhp73\Rector\FuncCall\DowngradeTrailingCommasInFunctionCallsRector;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->rule(DowngradeTrailingCommasInFunctionCallsRector::class);
};

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions