как говорится хочешь сделать хорошо - сделай сам...
пакет
https://github.com/badoo/phpcf
$formatter = new \Phpcf\Formatter(new \Phpcf\Options());
$result = $formatter->formatFile('path/to/file.php');
if ($result->getError()) {
throw $result->getError();
} else {
file_put_contents($result->getFile(), $result->getContent());
}
и CS Fixer:
$file = __DIR__ . '/demo.php';
$config = \PhpCsFixer\Config::create()
->setRules([
'@PSR12' => true,
'list_syntax' => ['syntax' => 'short'],
])
->setFinder(new ArrayIterator([new SplFileInfo($file)]));
$resolver = new \PhpCsFixer\Console\ConfigurationResolver(
$config,
[],
__DIR__,
new \PhpCsFixer\ToolInfo()
);
$runner = new \PhpCsFixer\Runner\Runner(
$config->getFinder(),
$resolver->getFixers(),
$resolver->getDiffer(),
null,
new \PhpCsFixer\Error\ErrorsManager(),
$resolver->getLinter(),
$resolver->isDryRun(),
$resolver->getCacheManager(),
$resolver->getDirectory(),
$resolver->shouldStopOnViolation()
);
$runner->fix();