Configurable

WrapReturnRector

Wrap return value of specific method

 final class SomeClass
 {
     public function getItem()
     {
-        return 1;
+        return [1];
     }
 }

Configure your rector.php:

<?php

use Rector\Config\RectorConfig;
use Rector\Transform\Rector\ClassMethod\WrapReturnRector;
use Rector\Transform\ValueObject\WrapReturn;

return RectorConfig::configure()
    ->withConfiguredRule(WrapReturnRector::class, [
        new WrapReturn('SomeClass', 'getItem', true),
    ]);
SETS:  symfony/* 4.2