Configurable

EncapsedStringsToSprintfRector

Convert enscaped {$string} to more readable sprintf or concat, if no mask is used

-echo "Unsupported format {$format} - use another";
+echo sprintf('Unsupported format %s - use another', $format);

-echo "Try {$allowed}";
+echo 'Try ' . $allowed;

Configure your rector.php:

<?php

use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(EncapsedStringsToSprintfRector::class, [
        'always' => false,
    ]);

-echo "Unsupported format {$format} - use another";
+echo sprintf('Unsupported format %s - use another', $format);

-echo "Try {$allowed}";
+echo sprintf('Try %s', $allowed);

Configure your rector.php:

<?php

use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
use Rector\Config\RectorConfig;

return RectorConfig::configure()
    ->withConfiguredRule(EncapsedStringsToSprintfRector::class, [
        'always' => true,
    ]);
SETS:  Coding Style